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 <sys/time.h> | |
#include <math.h> | |
#define min(a,b) ((a) < (b) ? (a) : (b)) | |
int expboff(int n, int lmin, int lmax) | |
{ | |
return min(lmin + (pow(n + 1, 2) - 1) / 2, lmax); | |
} |
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 pickle | |
class TolerantPickler(pickle.Pickler): | |
def save(self, obj): | |
try: | |
pickle.Pickler.save( self, obj ) | |
except (TypeError, pickle.PicklingError, RuntimeError): | |
pickle.Pickler.save( self, None ) | |
from StringIO import StringIO | |
def dumps(obj, protocol=None): |
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
df <- read.csv("myRandomFile.csv", header=TRUE) |
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
python setup.py bdist_wheel | |
python setup.py sdist bdist_wheel upload |
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 (COMMAND git diff --name-only xxx) |
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
hexdump -v -e '/32 "%05_ad |"' -e '/1 "%3_c"' -e '/32 "|\n"' tmp.queue |
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
# Django database checking | |
from django.db import connection; connection.queries | |
from django.db import connection; print "\n\n".join([v.values()[1] for v in connection.queries]) | |
# Profiling | |
import cProfile, StringIO | |
pr = cProfile.Profile() | |
pr.enable() | |
# ... do something ... |
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(reshape) | |
library(ggplot2) | |
library(scales) | |
library(cairoDevice) | |
data <- read.csv("birds.csv", head=TRUE, sep=",") | |
Cairo_png("Birds.png", width=10, height=7) | |
ggplot(data, aes(x=Letter,y=Frequency,fill=Frequency)) + |