Skip to content

Instantly share code, notes, and snippets.

View obfusk's full-sized avatar
🏳️‍🌈
hacking ⇒ ¬sleeping 😸

FC (Fay) Stegerman obfusk

🏳️‍🌈
hacking ⇒ ¬sleeping 😸
View GitHub Profile
@obfusk
obfusk / mongo.bash
Created October 20, 2013 19:39 — forked from noxqsgit/mongo.bash
mongo dump/restore
ssh -Nv -L 8888:localhost:27017 user1@server1
ssh -Nv -L 9999:localhost:27017 user2@server2
mongodump -h localhost:8888 -d db1 -u user1 -p ''
mongorestore -h localhost:9999 -d db2 -u user2 -p '' dump/db1/
@obfusk
obfusk / packages
Created October 20, 2013 19:37 — forked from noxqsgit/packages
libav/ffmpeg packages
libav-tools
libavcodec-extra-53
libavdevice-extra-53
libavfilter-extra-2
libavformat-extra-53
libpostproc-extra-52
@obfusk
obfusk / Gemfile
Created October 20, 2013 19:36 — forked from noxqsgit/Gemfile
sqlite -> postgres
source 'https://rubygems.org'
gem 'taps'
gem 'rack', '1.5.0' # see https://github.com/rack/rack/issues/528
gem 'sinatra'
gem 'pg'
gem 'sqlite3'
@obfusk
obfusk / cfg-ex.rb
Created October 20, 2013 19:29 — forked from noxqsgit/cfg-ex.rb
actionmailer + smtp + CFG
CFG = {
test: {},
prod: {},
dev: {
...
# smtp: { ... }
}
}
@obfusk
obfusk / 7z.bash
Created October 20, 2013 19:18
7z w/ encryption
7z a -mhe=on -p foo.7z foo/
@obfusk
obfusk / README.md
Created October 20, 2013 19:15
build ffmpeg

Prepare

$ aptitude install yasm libvorbis-dev libvpx-dev libsdl1.2-dev

Build

$ mkdir -p ~/tmp/build && cd ~/tmp/build
$ git clone git://source.ffmpeg.org/ffmpeg.git

$ cd ffmpeg

@obfusk
obfusk / relpath.bash
Created October 20, 2013 19:14
relative path
# 1
# usage: relpath <to> <from>
relpath () { python -c \
'import os.path, sys; print os.path.relpath(*sys.argv[1:])' "$@"; }
# 2
rel_bin="${bin#"$PREFIX"}"
@obfusk
obfusk / grep.sh
Created October 20, 2013 19:11
DO NOT USE "foo $@ bar" !!! only use "$@" !!!
grep -R '[^"]\$@\|\$@[^"]' --exclude-dir=.git . 2>/dev/null | grep -v Binary
@obfusk
obfusk / sig.bash
Created October 20, 2013 19:10
sigusr1 + wait
ME=$$; echo "I'm $ME"
( echo $BASHPID; sleep 5; echo 1; kill -SIGUSR1 $ME ) &
( echo $BASHPID; sleep 10; echo 2; kill -SIGUSR1 $ME ) &
( echo $BASHPID; sleep 15; echo 3; kill -SIGUSR1 $ME ) &
foo () { echo "USR1 received"; }
bar () { echo "USR2 received"; }
trap foo SIGUSR1
@obfusk
obfusk / reduce_mbind.coffee
Created October 20, 2013 19:06
obfusk.coffee - reduce + mbind
O = require 'obfusk'; U = require 'underscore'
f = (x) -> O.Just x + 1
g = (x) -> O.Just x * 42
h = (x) -> O.Nothing()
x = U.reduce([f,g], O.mbind, O.Just(2))
y = U.reduce([f,h,g], O.mbind, O.Just(2))
console.log O.match(x, Nothing: (-> 'too bad'), Just: ((x) -> "#{x.value}!!!"))