This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'benchmark' | |
require 'bcrypt' | |
REPITITIONS = 50 | |
passwords = %w(password) | |
passwords.each do |password| | |
puts "Password to hash: #{password}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseTask | |
def self.perform(*args) | |
ActiveRecord::Base.verify_active_connections! | |
end | |
end | |
class SomeTask < BaseTask | |
def self.perform(*args) | |
super | |
# do some stuff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StAnOfFiCe:api_frontend stan$ unicorn -c unicorn.conf.rb | |
dyld: lazy symbol binding failed: Symbol not found: _capi_get_constant | |
Referenced from: /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn_http.bundle | |
Expected in: flat namespace | |
dyld: Symbol not found: _capi_get_constant | |
Referenced from: /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn_http.bundle | |
Expected in: flat namespace | |
Trace/BPT trap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An exception occurred running /Users/stan/.rvm/gems/rbx-1.0.0-rc5/bin/unicorn | |
directory for pid=/Users/stan/tmp/unicorn.pid not writable (ArgumentError) | |
Backtrace: | |
Unicorn::Configurator#reload {} at /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn/configurator.rb:58 | |
Array#each at kernel/bootstrap/array.rb:158 | |
Unicorn::Configurator#reload at /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn/configurator.rb:54 | |
Unicorn::Configurator#initialize at /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn/configurator.rb:46 | |
Class#subclass_new (new) at kernel/alpha.rb:94 | |
#<Class:0x462>.new at kernel/common/struct.rb:69 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
not sure where it starts/ends. was looping this: | |
[2010-05-14T09:56:45.466816 #27335] INFO -- : worker=0 spawning... | |
[2010-05-14T09:56:45.467432 #27335] ERROR -- : Unhandled master loop exception #<Errno::EAGAIN: Resource temporarily unavailable - fork(2) failed>. | |
[2010-05-14T09:56:45.467432 #27978] ERROR -- : kernel/common/process.rb:58:in `fork' | |
kernel/common/process.rb:601:in `fork' | |
/Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:602:in `spawn_missing_workers {}' | |
kernel/common/range.rb:162:in `each' | |
/Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:598:in `spawn_missing_workers' | |
/Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:611:in `maintain_worker_count' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An exception occurred running /Users/stan/.rvm/gems/rbx-1.0.0-rc5/bin/unicorn | |
assertion failed: current_unwind < kMaxUnwindInfos (Rubinius::Internal) | |
Backtrace: | |
An exception occurred running /Users/stan/.rvm/gems/rbx-1.0.0-rc5/bin/unicorn | |
assertion failed: current_unwind < kMaxUnwindInfos (Rubinius::Internal) | |
Backtrace: | |
ESC[0;31m Unicorn::HttpServer#worker_loop at /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:698ESC[0m | |
Unicorn::HttpServer#spawn_missing_workers {} at /Users/stan/.rvm/gems/rbx-1.0.0-rc5/gems/unicorn-0.99.0/lib/unicorn.rb:605ESC[0m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
%w(rubygems open-uri nokogiri).each { |lib| require lib} | |
doc = Nokogiri::HTML(open('http://xkcd.com/').read) | |
img = doc.at_css("#middleContent img") | |
puts %|Content-type: text/html | |
<html> | |
<head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gemcutter => redis downloads spec | |
================================= | |
keys | |
---- | |
downloads => global counter for all gem downloads | |
downloads:today => sorted set for downloads from today | |
downloads:rubygem:rails => counter for all rails downloads | |
downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Integer | |
def prime? | |
!("1" * self).match(/^1?$|^(11+?)\1+$/).nil? | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run with: curl -s http://gist.github.com/265272.txt | bash | |
set -e | |
localdir=$HOME/.mongodb | |
datadir=$localdir/data | |
conf=$localdir/mongod.conf | |
agentdir=$HOME/Library/LaunchAgents | |
agent=$agentdir/org.mongodb.mongod.plist |