This file contains hidden or 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 = gcc-4.7.1 | |
GMP = gmp-5.0.5 | |
MPFR = mpfr-3.1.0 | |
MPC = mpc-0.9 | |
PARALLEL="-j8" | |
PREFIX=$(PWD) | |
all: $(GCC) |
This file contains hidden or 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 <fcntl.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <termios.h> | |
#include <time.h> | |
#include <sys/ioctl.h> | |
int b(int a, struct winsize *w); | |
int main() |
This file contains hidden or 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
f = open("sowpods.txt", "r") | |
canonized_words = {} | |
word1 = "" | |
word2 = "" | |
max_len = 0 | |
for line in f: | |
if len(line) > max_len: | |
sorted_word = ''.join(sorted(line)) |
This file contains hidden or 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
void printx(char *s, uint8_t *x, int n) { | |
char buf[PS]; | |
for (int i = 0; i < PS; i++){ | |
if(*s == '%'){ | |
for(int j = n-1; j >= 0; j--){ | |
buf[i++%128] = ((*(x+j)>>4)&0xf)[ | |
"0123456789ABCDEF" | |
]; | |
buf[i++%128] = (*(x+j)&0xf)[ |
This file contains hidden or 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
<?xml version='1.0' encoding='ASCII'?> | |
<flow_graph> | |
<timestamp>Tue Aug 12 14:13:51 2014</timestamp> | |
<block> | |
<key>options</key> | |
<param> | |
<key>id</key> | |
<value>fm_receiver</value> | |
</param> | |
<param> |
This file contains hidden or 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/env python | |
import gym | |
import gym.envs | |
import numpy as np | |
gym.envs.register(id='NChainCustom-v0', | |
entry_point='gym.envs.toy_text:NChainEnv', | |
kwargs={'large':100}, | |
timestep_limit=200) |
This file contains hidden or 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/env python | |
import gym | |
import sys | |
env = gym.make(sys.argv[1]) | |
num_episodes = 200 | |
max_timestep = 1000 | |
env.monitor.start(sys.argv[1]) | |
for _ in xrange(num_episodes): |
This file contains hidden or 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
# Useful stuff | |
from operator import mul | |
def prod(x): | |
""" Product reducer """ | |
return reduce(mul, x, 1) | |
This file contains hidden or 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
// logger.c - hook into python's logging module | |
#include <Python.h> | |
#include <stdarg.h> | |
#include "logger.h" | |
static PyObject *logger; | |
// logger = logging.getLogger('libvncdriver') | |
int logger_init(void) { |
This file contains hidden or 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 pyximport | |
import numpy as np | |
pyximport.install() | |
cmap = pyximport.load_module('cmap', 'cmap.pyx') | |
cadd = pyximport.load_module('cadd', 'cadd.pyx') | |
a = np.arange(6, dtype='i') | |
print('start', a) | |
cmap.pymap(a, cadd.pyadd_one) | |
print('add_one', a) |