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 { |
View tm.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 <stdint.h> | |
#define BASE_SIZE 8 | |
struct cell { | |
uint64_t value : 1; | |
uint64_t reps : 17; | |
uint64_t prev : 23; | |
uint64_t next : 23; |
View log.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 <stdint.h> | |
#include <string.h> | |
#define PRIME ((1ul << 31) - 1) | |
#define GEN ((1ul << 11) - 1) | |
unsigned | |
fastlog(uint64_t x) | |
{ |
View generators.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 <stdint.h> | |
#include <string.h> | |
#define PRIME ((1ull << 31) - 1) | |
uint32_t | |
cycle(uint32_t seed, uint32_t prev) | |
{ | |
uint64_t x = prev; |
View picklejson.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
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() |
View dice.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 <time.h> | |
unsigned long long counts[6] = {0}; | |
unsigned long long trials = 0; | |
void | |
roll_dice(void) | |
{ |
View generator.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> | |
#define FIRST(N, ...) (N) | |
#define foreach(X, F, ...) \ | |
for (init_##F(__VA_ARGS__), X = F(FIRST(__VA_ARGS__));\ | |
FIRST(__VA_ARGS__)->_running;\ | |
X = F(FIRST(__VA_ARGS__))) | |
struct count_state { | |
int _running; |
View menger.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
import numpy as np | |
from svg import * | |
compose = lambda f: lambda g: lambda *a, **k: f(g(*a, **k)) | |
PURPLE = '#6a1eb0' | |
ORANGE = '#ff824a' | |
BLUE = '#75c1ff' | |
VP_WIDTH = 2.0 |
View pool.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 <stdint.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#define POOL_NODE_HEADERS struct pool_node *prev, *next | |
struct pool_node { | |
POOL_NODE_HEADERS; | |
}; |
NewerOlder