Skip to content

Instantly share code, notes, and snippets.

// Playground - noun: a place where people can play
// https://developer.apple.com/library/prerelease/ios/navigation/index.html
import Cocoa
// variables
var string = "Hello, playground"
@drtoast
drtoast / gist:7159912
Created October 25, 2013 18:54
Jailbreaking a Google Search Appliance
These are my notes from my abandoned project to wipe and reuse a Google Search Appliance:
Dell PowerEdge 2950 (model EMS01)
http://support.dell.com/support/edocs/systems/pe2950/en/hom/html/index.htm
Disable BIOS Password
http://support.dell.com/support/edocs/systems/pe2950/en/hom/html/jumpers.htm#wp1054535
@drtoast
drtoast / endpoint.rb
Last active December 14, 2015 22:19
Using Faraday and Typhoeus to post parallel JSON requests to an API endpoint, and asynchronously handling the responses using custom middleware.
require 'sinatra'
require 'json'
post '/example' do
sleep 5
if request.accept?('application/json')
content_type :json
data = JSON.parse request.body.read
data[:status] = 'OK'
data.to_json
@drtoast
drtoast / authentication_cheatsheet.rb
Created February 18, 2011 21:23
how to use SHA1 digests to encrypt passwords, based on Clearance authentication gem
require 'digest/sha1'
class User
=begin
u = User.new
u.set_password "hello"
u.sign_in "hello"
=> true
u.sign_in "blah"
# A more elegant solution for: http://thedailywtf.com/Articles/Got_Time_0x3f_.aspx
class DH
def hours_to_days_and_hours(hours)
self.send "days_and_hours_in_#{hours}_hours"
end
def method_missing(method)
method.to_s.match(/(\d+)/)