Skip to content

Instantly share code, notes, and snippets.

View colszowka's full-sized avatar

Christoph Olszowka colszowka

View GitHub Profile
@bitbckt
bitbckt / resque.rb
Created January 20, 2010 21:32
munin plugin for resque
#!/usr/bin/env ruby
require 'rubygems'
require 'resque'
HOST = ENV['host'] ? ENV['host'] : '127.0.0.1'
PORT = ENV['port'] ? ENV['port'] : '6379'
Resque.redis = "#{HOST}:#{PORT}"
@xaviershay
xaviershay / acceptance_runner.rb
Created June 4, 2011 05:04
Parallel tests with unified SimpleCov coverage
require 'parallel'
class AcceptanceRunner < MiniTest::Unit
def initialize(opts = {})
super()
@opts = opts
end
def _run_suites_in_parallel(suites, type)
@fguillen
fguillen / crontab
Created August 9, 2011 09:05
Cron & RVM & Bundle & Rails & Rake & log
00 01 * * * /bin/bash --login -c 'cd <your app> && RAILS_ENV=production /usr/bin/env bundle exec rake <your rake>' >> /var/log/<your app>.log 2>&1
SimpleCov.at_exit do
percent = SimpleCov.result.covered_percent
unless percent == 100.0
puts "Coverage is not at 100% !!!!"
Kernel.exit(1)
end
end
@krisleech
krisleech / README.md
Created February 23, 2012 15:50
A Micro Gem for commenting out lines of Ruby/Erb
hide do          
          _     _     _            
    /\  /(_) __| | __| | ___ _ __  
   / /_/ / |/ _` |/ _` |/ _ \ '_ \ 
  / __  /| | (_| | (_| |  __/ | | |
  \/ /_/ |_|\__,_|\__,_|\___|_| |_|
end
@dstrctrng
dstrctrng / gist:5315149
Last active December 15, 2015 19:59
Running a docker with runsvdir, ssh in, then destroy it
function d {
did=$(docker run -d precise runsvdir /etc/service)
ip=$(docker inspect $did | grep IpAddress | cut -d'"' -f4)
nc -z $ip 22 && ssh -oStrictHostKeyChecking=no root@$ip
docker kill $did
}
@bradleypriest
bradleypriest / konami.js
Last active December 17, 2015 00:29
Ember.KonamiCode
Ember.KonamiCode = Ember.Mixin.create({
konami: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13],
currentIndex: 0,
keyPress: function(event) {
this._super(event);
var index = this.get('currentIndex');
if (event.keyCode === this.konami[index]) {
if (index === 10) {
this.success();
} else {
@mbleigh
mbleigh / matchers.rb
Created September 7, 2012 16:53
RSpec matcher for JSON responses.
RSpec::Matchers.define :have_json_key do |expected_key|
match do |response|
@body = MultiJson.load(response.body)
result = @body.key?(expected_key.to_s)
result &&= @body[expected_key.to_s] == @expected_val if @val_provided
result
end
chain :with_value do |val|
@ericboehs
ericboehs / wpa_passphrase.rb
Last active May 29, 2017 20:28
Generating a WPA PSK hex key in Ruby
require 'openssl'
ssid = 'Delorean'
passphrase = 'hoverboardsdonotworkonwater'
puts OpenSSL::PKCS5.pbkdf2_hmac_sha1(passphrase, ssid, 4096, 32).unpack("H*").first
@grosser
grosser / resque_web.rb
Created September 13, 2011 15:08 — forked from skippy/resque_web.rb
Mountable resque-web for rails 3+ apps
# https://gist.github.com/1214052
require 'sinatra/base'
class ResqueWeb < Sinatra::Base
require 'resque/server'
use Rack::ShowExceptions
if CFG[:user].present? and CFG[:password].present?
Resque::Server.use Rack::Auth::Basic do |user, password|
user == CFG[:user] && password == CFG[:password]