Skip to content

Instantly share code, notes, and snippets.

View mikiobraun's full-sized avatar

Mikio L. Braun mikiobraun

View GitHub Profile
@mikiobraun
mikiobraun / drill.rb
Created February 14, 2014 14:24
If you know how to Ruby you can torture Twitter's servers, too, now.
require 'rubygems'
require 'net/http'
require 'uri'
require 'hpricot'
def get(url)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@mikiobraun
mikiobraun / gist:9001788
Last active August 29, 2015 13:56
Twitter status links drill-down
#1 https://twitter.com/mikiobraun/status/434321864249184256
#2 https://twitter.com/josephreisinger/status/434320973878161409
#3 https://twitter.com/mdreid/status/434264621227073536
#4 https://twitter.com/rickyrobinson/status/434241202200662016
#5 https://twitter.com/pmarca/status/434215519630008321
#6 https://twitter.com/cdixon/status/433468068237692928
#7 https://twitter.com/sacca/status/433467363623583745
#8 https://twitter.com/trammell/status/433462737151488000
#9 https://twitter.com/danadanger/status/433462152590929921
#10 https://twitter.com/omid/status/433460895323127808
require 'time'
require 'rubygems'
require 'json'
def usage
puts <<EOS
Usage:
ruby track_stream.rb <username> <password> <keyword1> <keyword2> ...
EOS
end
#!/usr/bin/env ruby
# -*- ruby -*-
# Usage:
# ruby printjson.rb field1 fields2 file
#
# if file == '-' then read from stdin
#
# Install the json gem first:
#
# gems you need
#
# dbi
# dbd-jdbc
# jdbc-postgres
require 'java'
require 'rubygems'
require 'dbi'
@mikiobraun
mikiobraun / autoreload.rb
Created January 15, 2010 15:14
autoreloading of ruby files which have changed in the meantime
# This file extends the Kernel's require function and adds the
# AutoReload module which allows to reload files once they have changed
# on the disk.
#
# Basically, you just require your files as usual, and if you want to update
# the files, either call AutoReload.reload(file) or AutoReload.reload_all.
#
# Usage:
# irb -rautoload
#
@mikiobraun
mikiobraun / bundle-compiled.sh
Created January 6, 2010 11:37
script to compile a rails app with jrubyc and bundle
#!/bin/bash
#
# Script to bundle this rails app with compiled ruby files.
# The main problem is that rails very much assumes that files
# end in ".rb", although jruby is also fine with loading
# ".class" files.
#
# The "solution" is to replace each ".rb" file with a file
# which loads the associated ".class" file.