View graphs.mac
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
anyp(pred, seq) := lreduce(lambda([P, x], P or pred(x)), seq, false); | |
allp(pred, seq) := lreduce(lambda([P, x], P and pred(x)), seq, true); | |
walklength(seq) := (length(seq)-1)/2; | |
walkverts(seq) := makelist(seq[2*i-1], i, 1, walklength(seq)+1); | |
walkedges(seq) := makelist(seq[2*i], i, 1, walklength(seq)); | |
closedp(seq) := is(first(seq) = last(seq)); | |
vertexset(G) := first(G); | |
edgeset(G) := second(G); |
View .gitignore
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
primesmodule.o | |
primes.*.so |
View private_ips.py
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
IPV4_OCTET_TYPES = { | |
4: (24, 16, 8, 0,), | |
3: (24, 16, 0,), | |
2: (24, 0,), | |
1: ( 0,), | |
} | |
def num(ip): | |
octets = tuple(map(int, ip.split('.'))) | |
bases = IPV4_OCTET_TYPES[len(octets)] |
View Makefile
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
.PHONY: default | |
default: dict | |
./dict | |
dict: dict.c set.o | |
test: test.c set.o | |
set.o: set.c set.h |
View flexible-in-flexible.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 <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
struct a { | |
char x; | |
char buf[]; | |
}; |
View test.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
int | |
check(const char *s, int p) | |
{ | |
static int passes = 0; | |
static int failures = 0; | |
const char *fail = "\x1B[31mFAIL\x1B[0m"; | |
const char *pass = "\x1B[34mPASS\x1B[0m"; | |
if (s) { | |
fprintf(stderr, "[%s] %s\n", p ? pass : fail, s); |
View pre-commit.R.bash
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
#!/bin/bash | |
# | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=$(git hash-object -t tree /dev/null) | |
fi |
View easy_passwords.py
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
# Generate passwords which can be typed without using any finger to press two | |
# different keys in a row. | |
from math import log, ceil | |
# For each finger, write the letters *you* type with that finger. | |
finger_classes = [ | |
'qaz', | |
'wsx', | |
'edc', |
View rcpp-trycatch.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
library(Rcpp) | |
library(profvis) | |
cppFunction(' | |
double | |
call_rnorm(int ignored) | |
{ | |
Function f("rnorm"); | |
NumericVector x = f(1); |
View expandable_list.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 <stdlib.h> | |
#include <stdint.h> | |
struct node { | |
struct node *next; | |
long v; | |
}; | |
struct list { |
NewerOlder