Moved to https://github.com/shamrin/bigcheck
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/sh | |
git filter-branch --env-filter ' | |
an="$GIT_AUTHOR_NAME" | |
am="$GIT_AUTHOR_EMAIL" | |
cn="$GIT_COMMITTER_NAME" | |
cm="$GIT_COMMITTER_EMAIL" | |
if [ "$GIT_COMMITTER_EMAIL" = "root@ubuntu.(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
function Gauge(placeholderName, configuration) | |
{ | |
this.placeholderName = placeholderName; | |
var self = this; // for internal d3 functions | |
this.configure = function(configuration) | |
{ | |
this.config = configuration; | |
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
# `env` that also supports fish functions | |
function env | |
set -l vars | |
set -l vals | |
set -l save_vars | |
set -l save_vals | |
set -l save_empty_vars | |
# parse var=val pairs into `vars` and `vals` arrays | |
set -l n 1 |
$ rm -f test.sqlite && python bug_models.py create && python bug_add.py && echo '.schema' | sqlite3 test.sqlite
CREATE TABLE "device" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(20) NOT NULL, "owner_id" INTEGER, "network_id" INTEGER, FOREIGN KEY ("owner_id") REFERENCES "user" ("id"));
CREATE TABLE "network" ("id" INTEGER NOT NULL PRIMARY KEY, "name" TEXT NOT NULL);
CREATE TABLE "user" ("id" INTEGER NOT NULL PRIMARY KEY, "full_name" VARCHAR(128) NOT NULL);
CREATE INDEX "device_network_id" ON "device" ("network_id");
CREATE INDEX "device_owner_id" ON "device" ("owner_id");
$ rm -f test.sqlite && python bug_models.py create && python bug_drop.py
…
peewee.OperationalError: unknown column "owner_id" in foreign key definition
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
# this makes sure libraries are installed and up-to-date (with requirements.txt) | |
venv: venv/bin/activate | |
venv/bin/activate: requirements.txt | |
test -d venv || virtualenv venv | |
. venv/bin/activate && pip install -Ur requirements.txt | |
touch venv/bin/activate |
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
def add_preview_for(*fields): | |
""" | |
This is a decorator for model classes that adds preview methods. | |
So instead of manually adding preview methods: | |
>>> class Student(models.Model): | |
... photo = models.ImageField() | |
... icon = models.ImageField() | |
... |
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 | |
# source data | |
a = numpy.ones(4000000, dtype=numpy.uint8).reshape((2000,2000)) | |
# make gray RGB image | |
g = numpy.empty((2000,2000,3)) | |
g[...] = a[..., numpy.newaxis] | |
# make image width divisable by 4 |
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
test: | |
# Usage: | |
# $ make test TEST="grep pattern" | |
ifdef TEST | |
env TESTING=1 mocha --compilers coffee:coffee-script -u tdd -g "$(TEST)" | |
else | |
env TESTING=1 mocha --compilers coffee:coffee-script -u tdd | |
endif |
OlderNewer