Skip to content

Instantly share code, notes, and snippets.

@ryana
ryana / sh200.headers.txt
Created February 21, 2015 18:19
Southwest WIFI Hacking lingers on...
Remote Address:199.27.79.184:80
Request URL:http://s7.addthis.com/static/r07/sh200.html
Request Method:GET
Status Code:304 Not Modified
Request Headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-GB,en;q=0.8,en-US;q=0.6
Cache-Control:max-age=0
@ryana
ryana / application.js.coffee
Created August 27, 2014 14:26
Pretty spotlighting for shepherd.js
Shepherd.on 'show', (o) ->
el = $(o.step.options.attachTo.element).first()
width = el.outerWidth() + 10
height = el.outerHeight() + 10
offset = el.offset()
$('.shep-overlay').show().css({
position: 'absolute',
width: width,
height: height,
@ryana
ryana / a.rb
Last active August 29, 2015 14:00 — forked from ahoward/3.1.6.txt
require 'mongoid'
Mongoid.configure do |config|
config.connect_to('test')
end
class Room
include Mongoid::Document
has_one :table, as: :parent, autobuild: true
@ryana
ryana / commands.sh
Created July 21, 2013 20:24
Monkey patch Sprockets so that non-digest assets will be generated when ENV['SPROCKETS_NON_DIGEST'] is present
# Run locally
$ SPROCKETS_NON_DIGEST=true RAILS_ENV=production rake assets:precompile
# Heroku setup
$ heroku labs:enable user-env-compile
$ heroku config:add SPROCKETS_NON_DIGEST=true
@ryana
ryana / gist:2891715
Created June 7, 2012 21:42
UnixBench on our SoftLayer box
sg@max:/tmp/UnixBench$ ./Run
gcc -o ./pgms/arithoh -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Darithoh ./src/arith.c
gcc -o ./pgms/register -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum='register int' ./src/arith.c
gcc -o ./pgms/short -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=short ./src/arith.c
gcc -o ./pgms/int -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=int ./src/arith.c
gcc -o ./pgms/long -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=long ./src/arith.c
gcc -o ./pgms/float -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=float ./src/arith.c
gcc -o ./pgms/double -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=double ./src/arith.c
gcc -o ./pgms/hanoi -DTIME -Wall -pedantic -ansi -O2 -fomi
@ryana
ryana / gist:2891714
Created June 7, 2012 21:41
UnixBench on our SoftLayer box
sg@max:/tmp/UnixBench$ ./Run
gcc -o ./pgms/arithoh -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Darithoh ./src/arith.c
gcc -o ./pgms/register -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum='register int' ./src/arith.c
gcc -o ./pgms/short -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=short ./src/arith.c
gcc -o ./pgms/int -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=int ./src/arith.c
gcc -o ./pgms/long -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=long ./src/arith.c
gcc -o ./pgms/float -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=float ./src/arith.c
gcc -o ./pgms/double -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -Ddatum=double ./src/arith.c
gcc -o ./pgms/hanoi -DTIME -Wall -pedantic -ansi -O2 -fomi
@ryana
ryana / hydra.rb
Created October 7, 2011 16:36
hydra is hawt
ruby-1.9.2-p180 :033 > Benchmark.measure { urls.each {|u| req = Typhoeus::Request.new(u); req.on_complete {|resp| puts [resp.code, resp.body.size].map(&:to_s).join(', ') }; hydra.queue(req) }; hydra.run }
301, 242
302, 352
301, 337
302, 0
301, 0
200, 3291
301, 350
301, 178
301, 417
@ryana
ryana / mini_pca.rb
Created September 27, 2011 05:17
ruby-svd seg fault
require 'ruby-svd'
class MiniPca
def self.go
var_count = 300
doc_count = 100
m = SVDMatrix.new(doc_count, var_count)
doc_count.times do |n|
@ryana
ryana / tha_jesus.txt
Created September 12, 2011 21:00
do not fuck with
ra:~ ryan$ nl scope.c
1 int main() {
2 int c = 0;
3 if (1) {
4 int i = 0;
5 }
6 c = 5;
7 i = 10;
@ryana
ryana / url_regex.rb
Created August 8, 2011 19:23
@gruber's improved regex for matching URLs written in Ruby
# From @gruber http://daringfireball.net/2010/07/improved_regex_for_matching_urls
UrlRegex = /\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/?)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s\`!()\[\]{};:\'\".,<>?«»“”‘’]))/i