Skip to content

Instantly share code, notes, and snippets.

View mnem's full-sized avatar

Dave Clayton-Wagner mnem

View GitHub Profile
@mnem
mnem / gist:3797163
Created September 27, 2012 23:53
Hmm.
Generating tests.
Running each test 10000 times.
Running: UTHash test add
########################################
Running: Boost hash test add
########################################
Running: Std::map hash test add
########################################
@mnem
mnem / file.js
Created June 12, 2012 20:07
Hacked file.js to work around node_redis breaking binary data.
// Read a file from disk, store it in Redis, then read it back from Redis.
var redis = require("redis"),
client = redis.createClient(),
fs = require("fs"),
filename = "kids_in_cart.jpg";
// Get the file I use for testing like this:
// curl http://ranney.com/kids_in_cart.jpg -o kids_in_cart.jpg
// or just use your own file.
@mnem
mnem / tools_osx_edition.md
Last active October 5, 2015 17:17
Tools and setup for doing stuff, for my future reference when I accidentally destroy my computer. Again.

OS X Edition

Stuff I install to make creating magic rubbish easier.

General tools

  • OSX Terminal: Good enough when combined with tmux.
  • tmux: Terminals done proper; tmuxinator: handy tmux session templates.
  • Homebrew: The only package manager that matters.
  • git: Source control that works.
  • The Silver Searcher: A faster, better ack.
@mnem
mnem / README.md
Created April 9, 2012 22:03
Simple entity framework in lua for Love2D (or LÖVE if you want to be fancy). Still very much a work in progress.
@mnem
mnem / gist:2136505
Created March 20, 2012 14:55
Installing pysvn on an Amazon Linux AMI.
@mnem
mnem / .nah_xcode_uncrustify.cfg
Created January 20, 2012 09:38
My uncrustify script which has an eye towards making Objective-C code sane. See also https://gist.github.com/1641451
# Uncrustify 0.59
###########################################################################
# nah_xcode_uncrustify.rb default
# configuration
#
# config_version: 1.1.0
#
# Default uncrustify config to use for
# the nah_xcode_uncrustify.rb script
@mnem
mnem / pester.sh
Created January 7, 2012 18:22
Spammer takes over friends account, utilise scripting for minor lulz
# One `brew install watch` later...
watch -n 5 ./pester.sh
@mnem
mnem / pwgen_a.sh
Created January 5, 2012 20:07
Quick 'n' dirty password generation commands for *nix/mac
# Will generate passwords up to 76 characters long.
#
# Change the 20 at the end to change the length.
dd if=/dev/urandom count=1 2> /dev/null | base64 | sed -ne 2p | cut -c-20
@mnem
mnem / ebook_select_ipad_versions.rb
Created December 26, 2011 15:43
Script to look in each subfolder containing ebook files and select the 'best' candidates for chucking on an iPad
#!/usr/bin/env ruby
require "fileutils"
output_folder_name = "_ipad_selection"
output = File.expand_path File.join(Dir.pwd, output_folder_name)
selected = []
# Gather folders to look at
folders = Dir.glob(%w{*/*.epub */*.pdf}).map {|file| File.dirname file}
folders.delete_if { | item | item.match(/^#{output_folder_name}/)}
@mnem
mnem / ebook_tidy_to_subfolders.rb
Created December 26, 2011 15:41
Script to move and group all ebook files in the current folder into a pretty named subfolder.
#!/usr/bin/env ruby
require "fileutils"
folder_map = {}
def make_folder_name name
return name.gsub /_/, " "
end
# Gather all the files in this directory