Skip to content

Instantly share code, notes, and snippets.

@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
@jasonrudolph
jasonrudolph / mongo-console
Created June 9, 2012 13:07
Passing Query and Sort Params to MongoHQ RESTful API
# Assuming you're familiar with specifying query and sort options
# via the MongoDB console as shown here, you can specify these same
# options via the MongoHQ RESTful API using the approach shown in the
# file below.
$ mongo staff.mongohq.com:10095/one-rep-max -u REDACTED -p
MongoDB shell version: 2.0.4
Enter password:
connecting to: staff.mongohq.com:10095/one-rep-max
> use one-rep-max;