Skip to content

Instantly share code, notes, and snippets.

@advaitraut
advaitraut / curl.md
Created September 20, 2018 17:56 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@advaitraut
advaitraut / epoll.cpp
Created September 5, 2017 20:44 — forked from dtoma/epoll.cpp
C++ epoll
// https://banu.com/blog/2/how-to-use-epoll-a-complete-example-in-c/
// http://www.kegel.com/poller/
/** Todo
* - [ ] Split i/o and logic
* - [ ] Unit test logic
* - [ ] Logging
* - [ ] Continuous integration
* - [ ] Linux
* - [ ] Windows
@advaitraut
advaitraut / build.ninja
Created June 13, 2017 08:57 — forked from kamillys/build.ninja
Sample ninja build file. Plus Makefile to compare syntax and conclude why make is not the best tool for build manager.
# Makefile
outdir = build_make
ldflags = -lstdc++ -lm
cflags = -DFOO
cxxflags = ${cflags} -std=c++11
${outdir}/main: ${outdir}/main.o ${outdir}/hello.o
gcc ${ldflags} $^ -o $@
@advaitraut
advaitraut / Makefile
Created May 2, 2017 06:42 — forked from KholdStare/Makefile
Example code from articles on perfect forwarding to async lambdas. Involves moves, async, templates and perfect forwarding.
PROGS=part1 part2
CC=g++-4.7
CFLAGS= -Wall -Werror -O3 -std=c++0x
LIBS= -lpthread
all: $(PROGS)
@advaitraut
advaitraut / observer.cpp
Created May 2, 2017 06:39 — forked from lasty/observer.cpp
Variation on Observer pattern, using C++11 move/copy
/*
Variation on the Observer design pattern.
I just want to keep a list of items, and call methods on them. (Similar to observer's notify)
But the items will always be in a list (ie, automatic registration)
Instead of the items requiring to be inside pointers or pointer wrappers, this handles stack allocated
items too, and items inside std containers, using copy and move semantics.
Uses C++11 features, compile with gcc -std=c++11 or equivalent
@advaitraut
advaitraut / test.cpp
Created May 2, 2017 06:38 — forked from luca3m/test.cpp
C++ Usage of copy/move constructors on argument passing
#include <iostream>
#include <vector>
using namespace std;
class my
{
public:
my()
{
@advaitraut
advaitraut / lldb_cheat_sheet.md
Last active March 23, 2017 06:58 — forked from ryanchang/lldb_cheat_sheet.md
LLDB Cheat Sheet

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
@advaitraut
advaitraut / either.cpp
Created March 22, 2017 17:43 — forked from jvranish/either.cpp
Example Either type in C++
#include <stdio.h>
template <class T1, class T2>
class Either
{
bool isLeft;
union
{
T1 left;
T2 right;
@advaitraut
advaitraut / LICENSE
Created March 22, 2017 16:56 — forked from jvranish/LICENSE
Simple makefiles for C/C++ projest with automatic determination of header dependencies, source files, and include paths
ISC License
Copyright (c) 2016, Job Vranish
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.