Skip to content

Instantly share code, notes, and snippets.

View e0da's full-sized avatar

Justin Force e0da

View GitHub Profile
@e0da
e0da / gist:1989787
Created March 6, 2012 23:35
Hashing and checking SSHA passwords in Ruby
#!/usr/bin/env ruby
require 'base64'
require 'digest'
# get 16 random hex bytes
#
def new_salt
16.times.inject('') {|t| t << rand(16).to_s(16)}
end
@e0da
e0da / gist:2323037
Created April 6, 2012 21:18
Depaginate Phoronix articles
/**
* Depaginate Phoronix articles
*
* Script by Justin Force, 2012. Released to the public domain.
*
* Stick this in whatever user scripts you have. I keep an unpacked Chrome
* extension. You could also use this with GreaseMonkey or something as long as
* you load jQuery first.
*/
@e0da
e0da / gist:2352953
Created April 10, 2012 17:16
Backup minecraft files
#!/usr/bin/env ruby
# minecraft source and backup destination directories
SRC = '/home/force/minecraft'
DST = '/home/force/mincraft_backup'
# maximimum total size for all backups in bytes
MAX = 10**9 # about 1 GB
def backup
@e0da
e0da / muster.currentlyfunded.js
Created April 13, 2012 17:51
The Gevirtz School Currently Funded Page
/*!
* The Gevirtz School Currently Funded Page v1.1.2
* http://education.ucsb.edu/Faculty-Research/Research-Office/currentlyfunded.htm
*
* Copyright (c) 2011, Justin Force
* Licensed under the BSD 3-Clause License
*/
/*jslint browser: true, indent: 2 */
/*global jQuery, muster */
@e0da
e0da / muster.faculty-listing.js
Created April 13, 2012 17:53
The Gevirtz School Faculty Listing
/*!
* Faculty Listing
* http://education.ucsb.edu/Faculty-Research/Faculty-Listing/
*
* Copyright (c) 2011 Justin Force and the UC Regents
* Licensed under the BSD 3-Clause License
*/
/*jslint browser: true, indent: 2 */
/*global jQuery, muster */
@e0da
e0da / muster.faculty-listing.bio.js
Created April 13, 2012 17:54
The Gevirtz School Faculty Listing Bio
/*!
* Faculty Listing Bio
* http://education.ucsb.edu/Faculty-Research/Faculty-Listing/
*
* Copyright (c) 2011 Justin Force and the UC Regents
* Licensed under the BSD 3-Clause License
*/
/*jslint browser: true, indent: 2 */
/*global jQuery, muster */
@e0da
e0da / ggse_hostnames.rb
Created April 13, 2012 19:45
Generate a list of GGSE instructional hostnames
all_rooms = []
%w[
4211 4219 4108 4205 4201
3242 3209 3138 3134 3130
3112 2209 2101 1217 1215
1213 1211 1207 1205 1203
1201
].map do |room|
@e0da
e0da / gist:2500865
Created April 26, 2012 16:40
Remove HTML5 videos from page with a bookmarklet

Make a bookmarklet out of this and you can click it to remove all videos from a page.

javascript:v=document.getElementsByTagName('video');while(v.length>0)v[0].parentNode.removeChild(v[0]);

And here's a permanent user script that will delete them as soon as the page loads

(function () {
@e0da
e0da / monkey.rb
Created May 16, 2012 17:29
demo monkey patching
word = 'potato'
puts word.yell # NoMethodError
class ::String
def yell
"HEY! #{self.upcase}!"
end
end
# vim: set ft=sh:
# setup
ip tuntap add mode tap $TAP user $USER
ip link set $TAP up
brctl addif $BR $TAP
# teardown
ip link set $TAP down
brctl delif $BR $TAP