Skip to content

Instantly share code, notes, and snippets.

View DanielVF's full-sized avatar

Daniel Von Fange DanielVF

View GitHub Profile
@DanielVF
DanielVF / gist:1074014
Created July 9, 2011 22:36
Solving the Teleprompter coding kata in clojure
; Solving the Teleprompter coding kata in clojure
; (http://codingkata.org/katas/unit/teleprompter)
(defn de-slang [text dictionary]
(->>
(.split text "\\$")
(map (fn [word] [(str "\\$" word "\\$") (get dictionary word)]))
(filter (fn [word_set] (last word_set)) )
(reduce (fn [str, word_set] (.replaceAll str (first word_set) (last word_set))) text)) )
@DanielVF
DanielVF / gist:1261888
Created October 4, 2011 15:06
Change all objects in an Amazon S3 bucket to public-read.
require 'rubygems'
require 'aws-sdk'
# Change this stuff.
AWS.config({
:access_key_id => 'YOURS_HERE',
:secret_access_key => 'YOURS_HERE',
})
bucket_name = 'YOUR_BUCKET_NAME'
@DanielVF
DanielVF / middleware.py
Created June 17, 2013 13:04
Ghetto Django page profiler
"""
Source, unknown.
Tweaked by Daniel Von Fange.
"""
import sys
import tempfile
import hotshot
import hotshot.stats
@DanielVF
DanielVF / gist:8370906
Created January 11, 2014 13:24
Collect all ebay prices on page, for pasting into excel/numbers.
$.makeArray($('div[itemprop=price]').map(function(){return $(this).text().replace(/[^0-9]/g,'');}) ).join("\n")
@DanielVF
DanielVF / parser.peg
Last active August 29, 2015 13:57
peg.js parser for kerbal config files
start
= nodes
nodes
= node*
node
= list
/ stringkeyvalue
@DanielVF
DanielVF / gist:61229d54311a42fe2a93
Last active August 29, 2015 14:01
Using imapsync to copy accounts
# Install and use imapsync to copy imap accounts between servers
# Known issues:
# - Same username on both servers
# - Same password on both servers
# - No special characters in passwords
# - You'll want to run in parallel on big moves.
aptitude install libmail-imapclient-perl libterm-readkey-perl libio-socket-ssl-perl libdigest-hmac-perl liburi-perl libfile-copy-recursive-perl
git clone https://github.com/imapsync/imapsync.git
@DanielVF
DanielVF / gist:d715a290bc920a162d2a
Created June 4, 2014 12:12
ffmpeg losslessly trim H264 files
ffmpeg -i INPUT.MOV -ss 39 -to 52 -async 1 -acodec copy -vcodec copy OUTPUT.cut.MOV
@DanielVF
DanielVF / gist:d07b081efadc472e1721
Created August 18, 2014 13:06
random line of input, os x
perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);' | head -n 1
@DanielVF
DanielVF / gist:6299261a7413ec52a2e2
Created September 1, 2014 23:00
show a process's syscalls
strace -c -p {PID}
@DanielVF
DanielVF / Readme.md
Created May 26, 2015 02:21
Kerbin Altitude vs Pressure - KSP 1.0

Accurate to four decimal places. Verified through multiple data recorded flights. In CSV Format.