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
# Whiteboard photo cleanup script | |
# inspired by https://gist.github.com/lelandbatey/8677901 | |
# converts an image to png, extracts strokes, traces etc. | |
whiteboard() { | |
convert "$1" "$1.converted.png" | |
echo "Converted" | |
convert "$1.converted.png" \ | |
-morphology Convolve DoG:15,100,0 \ | |
-negate -normalize -blur 0x1 -channel RBG \ |
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
anaglyph.plot <- function(x,y,z,left="red",right="cyan",depth="med",style="pop-out",type="p",...) { | |
if (depth=="low") { | |
scale <- 0.1 | |
} else if (depth=="med") { | |
scale <- 0.2 | |
} else if (depth=="high") { | |
scale <- 0.5 | |
} |
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
# infnoise | |
# | |
# Feed entropy pool using the Infinite Noise TRNG | |
description "Infinite Noise" | |
start on filesystem or runlevel [2345] | |
stop on runlevel [!2345] | |
respawn |
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
# At first glance, this doesn't seem so useful. | |
def a | |
def b | |
'you called b' | |
end | |
'b is now defined' | |
end | |
# > b | |
# NameError: undefined local variable or method `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
// Needs to be run from a separate host that | |
// does not consider itself the server it's proxying to. | |
// So ghost the host to a VM running this (as root, for port 80). | |
var sys = require('sys'), | |
http = require('http'), | |
url = require('url'); | |
var port = 80; |
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
# NVM | |
if [[ -s $HOME/.nvm ]] ; then | |
setopt nullglob | |
NVM_DIR=$HOME/.nvm | |
source $NVM_DIR/nvm.sh | |
nvm use | |
fi |
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
common: &common | |
adapter: mysql | |
encoding: utf8 | |
username: root | |
password: | |
development: | |
<<: *common | |
database: app_name |
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
CFLAGS = -O2 -Wall $(OPTFLAGS) | |
CC = clang | |
SOURCES = $(wildcard *.c) | |
OBJECTS := $(patsubst %.c, %.o, $(SOURCES)) | |
all : main | |
main : $(OBJECTS) | |
$(CC) -o main $(CFLAGS) $(OBJECTS) |
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 unwrap_hash(hash, scope = []) | |
hash.each do |key, value| | |
scope.push key | |
if value.is_a? Hash | |
unwrap_hash value, scope | |
else | |
puts "#{scope.join(':')} = #{value.inspect}" | |
end | |
scope.pop | |
end |
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
# Uses 1.9.2 | |
# Makes use of existing day names in Date class | |
# Demeter is happy | |
# Support full and abbreviated names | |
# Doesn't use seconds (avoids error scenarios when crossing DST & leap-seconds) | |
class DDate < Date | |
def self.next(target_dayname) | |
target_wday = ABBR_DAYNAMES.index { |dayname| target_dayname =~ Regexp.new(dayname) } | |
diff = target_wday - today.wday |
OlderNewer