This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <gmp.h> | |
unsigned urandom(void) { | |
unsigned r; | |
FILE *fp = fopen("/dev/urandom", "r"); | |
fread((void *)&r, sizeof r, 1, fp); | |
fclose(fp); | |
return r; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A background script is needed in order to store | |
// persistent objects in memory. Content scripts | |
// run a seperate instance for each open tab in Chrome. | |
var nextLink = (function(linkArray) { | |
// Initialize a copy of the original links | |
var currentSet = linkArray.slice(); | |
return function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
static char * | |
read_stdin (void) | |
{ | |
size_t cap = 4096, /* Initial capacity for the char buffer */ | |
len = 0; /* Current offset of the buffer */ | |
char *buffer = malloc(cap * sizeof (char)); | |
int c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
#include <stdlib.h> | |
#define LAMBDA(RETURN_TYPE, BODY) ({ RETURN_TYPE __fn__ BODY __fn__; }) | |
#define __NARG__(...) __NARG_I_(__VA_ARGS__,__RSEQ_N()) | |
#define __NARG_I_(...) __ARG_N(__VA_ARGS__) | |
#define __ARG_N( \ | |
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MT_H | |
#define MT_H | |
#define MT_GEN(TYPE, NAME, W, N, M, A, U, D, S, B, T, C, F, L, LM, UM) \ | |
typedef struct { \ | |
TYPE MT[N]; \ | |
TYPE index; \ | |
} NAME; \ | |
void NAME##_seed(NAME *mt, TYPE seed) { \ | |
mt->index = (N); \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmd: | |
disk part | |
list disk | |
select disk X | |
clean | |
create partition primary | |
select partition 1 | |
format fs=ntfs quick | |
active | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <regex> | |
std::regex::flag_type parse_flags(const std::string& flag_str) { | |
std::regex::flag_type grammar = std::regex::ECMAScript; | |
std::regex::flag_type flags = grammar ^ grammar; | |
for (const auto& c: flag_str) { | |
switch (c) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
from threading import Thread | |
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(('localhost', 9999,)) | |
class ReplyHandler(Thread): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log = console.log.bind(console); | |
var Heap = function(fn) { | |
this.fn = fn || function(e) { | |
return e; | |
}; | |
this.items = []; | |
}; | |
Heap.prototype = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* gcc -O2 -Werror -I/usr/include/libpng16 -lpng png.c -o png */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <png.h> | |
typedef struct PNG { | |
int width; | |
int height; | |
int depth; |
NewerOlder