Skip to content

Instantly share code, notes, and snippets.

View mrenouf's full-sized avatar

Mark Renouf mrenouf

View GitHub Profile
@mrenouf
mrenouf / Paths.java
Created January 30, 2011 11:46
Filesystem iterator, implemented with a stack instead of recursion. Returns only files.
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
public class Paths implements Iterable<File> {
@mrenouf
mrenouf / gwt-jso-generator
Created January 2, 2011 13:38
GWT JSO generator from JSON-Schema
// Input snippet of JSON-Schema:
{
"name": "email"
"type":"object",
"properties":{
"type":{"type":"string"},
"value":{"type":"string","format":"email"}
}
}
@mrenouf
mrenouf / simdir
Created November 12, 2010 15:38 — forked from Daenyth/simdir
Fuzzy directory match using simhash
#!/bin/bash
shingle_size=4
feature_count=1024
if [[ ! -d $1 || ! -d $2 ]]; then
echo "Usage: <dir1> <dir2>"
exit 1
fi;
# make sure we don't simhash simhash files
@mrenouf
mrenouf / compiz-grid-hotcorners.sh
Created November 1, 2010 01:08
Substitute for Aero Snap using Compiz Grid plugin, with hot corners and sides
#!/bin/sh
apt-get install compizconfig-settings-manager compiz-fusion-plugins-extra xautomation
gconftool-2 --set --type list --list-type string /apps/compiz/general/allscreens/options/active_plugins [grid,commands]
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_1 "xte 'keydown Control_L' 'keydown Alt_L' 'key KP_4' 'keyup Control_L' 'keyup Alt_L'"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_2 "xte 'keydown Control_L' 'keydown Alt_L' 'key KP_6' 'keyup Control_L' 'keyup Alt_L'"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_3 "xte 'keydown Control_L' 'keydown Alt_L' 'key KP_7' 'keyup Control_L' 'keyup Alt_L'"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_4 "xte 'keydown Control_L' 'keydown Alt_L' 'key KP_9' 'keyup Control_L' 'keyup Alt_L'"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_5 "xte 'keydown Control_L' 'keydown Alt_L' 'key KP_1' 'keyup Control_L' 'keyup Alt_L
@mrenouf
mrenouf / xstream
Created October 28, 2010 13:49
Like xargs, but for STDIN (run a command for each line, piping the line to STDIN)
#!/usr/bin/python
import sys, subprocess
def main(args=sys.argv):
if len(args) < 2:
print "Usage: %s <command>" % (args[0])
exit 1
while True:
try: line = raw_input(None)