Skip to content

Instantly share code, notes, and snippets.

View DanielVF's full-sized avatar

Daniel Von Fange DanielVF

View GitHub Profile
you = "Frog"
me = "Frog"
you == me # True
@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
using System.Reflection;
using System.Collections;
public static void ShowProperties(Object myObject){
Hashtable PropertiesOfMyObject = new Hashtable();
Type t = myObject.GetType();
PropertyInfo[] pis = t.GetProperties();
for (int i=0; i<pis.Length; i++) {
PropertyInfo pi = (PropertyInfo)pis.GetValue(i);
Console.WriteLine(pi.Name);
@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}
-- Learning both Lua, and OpenGL. Probably NOT GOOD CODE.
-- But it's pretty in action.
-- Click to add squares.
require 'luagl'
require 'luaglut'
local fps = 60
local msec = 1000 / fps
quit = false
//in public void Update()
//change
if (updateResult.Errors) { throw new CouldNotUploadBudget(); }
//to
if (updateResult.Errors) { throw new CouldNotUploadBudget( this, updateResult); }
//change
public class CouldNotUploadBudget : System.Exception { }
//to
public class CouldNotUploadBudget : System.Exception {
<?
// Written for my own use, 2009
function select_exisiting_or_new($object,$field_name){
// To use:
// echo select_exisiting_or_new($product,'manufacturer')?
$current_value = $object->$field_name;
$possible_values = $object->query("SELECT `$field_name` from $object->table_name GROUP BY `$field_name` ORDER BY `$field_name`");