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); |
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
import io | |
import sys | |
class wrap_stdio: | |
def __init__(self, io_in = ''): | |
self.io_in = io.StringIO(io_in) | |
self.io_out = io.StringIO() | |
self.stdin = sys.stdin | |
self.stdout = sys.stdout |
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 |
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); |
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 { |
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 <stdint.h> | |
#define BASE_SIZE 8 | |
struct cell { | |
uint64_t value : 1; | |
uint64_t reps : 17; | |
uint64_t prev : 23; | |
uint64_t next : 23; |
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 <stdint.h> | |
#include <string.h> | |
#define PRIME ((1ul << 31) - 1) | |
#define GEN ((1ul << 11) - 1) | |
unsigned | |
fastlog(uint64_t x) | |
{ |
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 <stdint.h> | |
#include <string.h> | |
#define PRIME ((1ull << 31) - 1) | |
uint32_t | |
cycle(uint32_t seed, uint32_t prev) | |
{ | |
uint64_t x = prev; |
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
import sys | |
import pickle | |
import json | |
def usage(): | |
print("Usage:") | |
print(f"\t{sys.argv[0]} --tojson [PICKLE FILES]") | |
print(f"\t{sys.argv[0]} --topickle [JSON FILES]") | |
JD = json.JSONDecoder() |
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 <time.h> | |
unsigned long long counts[6] = {0}; | |
unsigned long long trials = 0; | |
void | |
roll_dice(void) | |
{ |