Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Force e0da

View GitHub Profile
@e0da
e0da / gist:1989787
Created Mar 6, 2012
Hashing and checking SSHA passwords in Ruby
View gist:1989787
#!/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 Apr 6, 2012
Depaginate Phoronix articles
View gist:2323037
/**
* 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 Apr 10, 2012
Backup minecraft files
View gist:2352953
#!/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 Apr 13, 2012
The Gevirtz School Currently Funded Page
View muster.currentlyfunded.js
/*!
* 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 Apr 13, 2012
The Gevirtz School Faculty Listing
View muster.faculty-listing.js
/*!
* 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 Apr 13, 2012
The Gevirtz School Faculty Listing Bio
View muster.faculty-listing.bio.js
/*!
* 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 Apr 13, 2012
Generate a list of GGSE instructional hostnames
View ggse_hostnames.rb
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 Apr 26, 2012
Remove HTML5 videos from page with a bookmarklet
View gist:2500865

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
demo monkey patching
View monkey.rb
word = 'potato'
puts word.yell # NoMethodError
class ::String
def yell
"HEY! #{self.upcase}!"
end
end
View notes.sh
# 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
You can’t perform that action at this time.