Skip to content

Instantly share code, notes, and snippets.

# This is a code example for the Ruby HTTP library Typhoeus
# here's an example for twitter search
# Including Typhoeus adds http methods like get, put, post, and delete.
# What's more interesting though is the stuff to build up what I call
# remote_methods.
class Twitter
include Typhoeus
remote_defaults :on_success => lambda {|response| JSON.parse(response.body)},
:on_failure => lambda {|response| puts "error code: #{response.code}"},
#!/usr/bin/ruby
require 'socket'
require 'rubygems'
require "xmpp4r"
require "xmpp4r/pubsub"
require "xmpp4r/pubsub/helper/servicehelper.rb"
require "xmpp4r/pubsub/helper/nodehelper.rb"
require "xmpp4r/pubsub/helper/nodehelper.rb"
@jage
jage / unipong.rb
Created November 20, 2012 01:19
Ruby 1.8.7
require 'curses'
include Curses
stdscr.keypad c=v=h=1
def w t,*o
setpos *o
addstr t
refresh
end
l=7
p=0
@jage
jage / README.md
Last active December 14, 2015 02:28
Group domain counts by main domain.

Data

123 oh.duh.se
9000  duh.se

Output

@jage
jage / find_gitlab_git.sh
Created July 16, 2013 17:12
Find gitlab repositories
find . -name '.git' -type d | while read git_path; do
(
cd `dirname $git_path`
(git remote -v|grep -q gitlab) && echo "`dirname $git_path` is still on gitlab"
)
done
@jage
jage / execution_visualizer.rb
Last active December 22, 2015 04:48
Show which line is executing
# Please convert this to a Sublime Text 3 plugin.
require 'curses'
Curses.init_screen
SOURCE_LINES = File.read(__FILE__).split("\n")
TracePoint.trace(:line) do |tp|
Curses.clear
SOURCE_LINES.each_with_index do |src,row|
Curses.setpos(row, 0)
Curses.addstr(src)
end
@jage
jage / kif_bonnie.txt
Created May 11, 2014 18:22
Bonnie++ on Kif. OpenBSD 5.5, 2x 500 GB SATA in softraid 1.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
@jage
jage / ping.lua
Created June 21, 2014 17:39
XML-RPC ping payload for https://github.com/wg/wrk
wrk.method = "POST"
wrk.body = "<?xml version=\"1.0\"?><methodCall><methodName>weblogUpdates.ping</methodName><params><param><value>Twingly Blog</value></param></params></methodCall>"
wrk.headers["Content-Type"] = "text/xml"
@jage
jage / iozone.md
Last active August 29, 2015 14:03 — forked from nicwi/iozone.md

iozone: marv vs hild vs Storm SSD

  • marv: MacBook Air 11-inch, Mid 2013 (256 GB APPLE SSD SM0256F)
  • hild: Supermicro SuperServer 2027TR-H72RF+ (6x Samsung 840 Pro, HW RAID10)
  • Storm SSD
$ iozone -l 32 -O -i 0 -i 1 -i 2 -e -+n -r 4K -s 4G

    Iozone: Performance Test of File I/O
--- nginx.conf.prev Sun Oct 12 20:44:43 2014
+++ nginx.conf Sun Oct 12 20:52:44 2014
@@ -8,13 +8,13 @@
events {
- worker_connections 1024;
+ worker_connections 1024;
}