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
" Vim syntax file | |
" | |
" Modification of vims Haskell syntax file: | |
" - match types using regular expression | |
" - highlight toplevel functions | |
" - use "syntax keyword" instead of "syntax match" where appropriate | |
" - functions and types in import and module declarations are matched | |
" - removed hs_highlight_more_types (just not needed anymore) | |
" - enable spell checking in comments and strings only | |
" - FFI highlighting |
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 <unistd.h> | |
#include <string.h> /* for strncpy */ | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <sys/ioctl.h> | |
#include <netinet/in.h> | |
#include <net/if.h> | |
#include <arpa/inet.h> |
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/env python | |
# coding: utf8 | |
# GistID: 8605391 | |
""" Add type checking decorators to functions. | |
@in_types(int, str) | |
@out_types(str) | |
def mul(a, b): | |
return a * b |
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/env python2 | |
# coding: utf8 | |
# GistID: 8446782 | |
import hashlib | |
import os | |
import sys | |
def get_size(path): |
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
# GistID: 8301919 | |
import numpy as np | |
import gc | |
from memory_profiler import profile | |
n = 30 | |
m = 1000000 | |
@profile |
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 | |
#GistID: 8245054 | |
# By default we take a full screen shot and name it the current time | |
# If -s is passed as first argument, we do window/selection mode | |
DATETIME=$(date +%F_%T.%N | rev | cut -c 8- | rev) | |
OUTPUTDIR="~/Pictures/Screenshots/" |
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/env python | |
# coding: utf8 | |
import sys | |
from numpy import loadtxt | |
from matplotlib.pyplot import matshow, show | |
mat = loadtxt(sys.stdin, dtype=bool, delimiter=',') | |
matshow(mat) | |
show() |
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
// GistID: 7920541 | |
// | |
// | |
// In this exercise you should get familiar with closures and | |
// implement an elementary cellular automaton (CA) | |
// [http://en.wikipedia.org/wiki/Elementary_cellular_automaton]. Read | |
// the article before proceeding. Then study closures from | |
// https://developer.mozilla.org/en/JavaScript/Guide/Closures and make | |
// sure you understand "Emulating private methods with closures" part |
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/env python | |
# coding: utf8 | |
# GistID: 7893054 | |
""" A generic preprocessor. | |
Replace `#include "<file>"` lines with file contents. | |
If the line starts with '//' then leave the include line in the output | |
for reference. |
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/env python3 | |
# coding: utf-8 | |
# GistID: 7799767 | |
from __future__ import print_function | |
# import cStringIO | |
import itertools | |
import os | |
import re |