View tries.rb
class Trie
Node =, :children, :is_complete_word)
attr_reader :root
def initialize
@root ='', {}, false)
def add_word(word)
View download-url-to-file.rb
#!/usr/bin/env ruby
# Ruby script to download a number of files
# from individual URLs via HTTP/HTTPS/FTP
# specified in an external file.
# Author: Tobias Preuss
# Revision: 2013-04-18 16:26 +0100 UTC
# License: Creative Commons Attribution-ShareAlike 3.0 Unported
View Dockerfile
FROM ruby:2.2
RUN gem update --system && gem install bundler
RUN sed -i 's/deb http:\/\/\/debian jessie main/deb http:\/\/\/debian jessie main non-free/' /etc/apt/sources.list
RUN sed -i 's/deb http:\/\/ jessie\/updates main/deb http:\/\/ jessie\/updates main non-free/' /etc/apt/sources.list
RUN curl -sL | bash - && apt-get install -y nodejs unrar && npm install -g phantomjs
View application.js
//= require jquery
//= require jquery_ujs
$(function() {
var source = new EventSource('/stream');
source.addEventListener('counter', function(e) {
$('body').after( + '<br />');
View counter.rb
require 'sinatra'
set server: :thin
get '/' do
erb :welcome
get '/stream', provides: 'text/event-stream' do
stream do |out|
loop do
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
#! /usr/bin/python
# coding: utf-8
import codecs
import re
from string import punctuation
import collections
import sys
punctuation_regexp = re.compile(r'[\s{}]+'.format(re.escape(punctuation)))
View leakedin.go
// SHA Hash presence web server.
// Requires a file containing sorted sha1s in binary form (20 bytes each).
package main
import (

Blogging with octopress:

  • new post: bundle exec rake new_post["title"]
  • write stuff
  • bundle exec rake preview
  • git add .
  • git commit -m 'add awesome post'
  • git push origin source
  • bundle exec rake generate
  • bundle exec rake deploy
View proxy.rb
# Based on by # Copyright (C) 2009 Torsten Becker <>
# Rewrited by gazay
require 'socket'
require 'uri'
class Proxy
attr_accessor :socket