Skip to content

Instantly share code, notes, and snippets.

@tessro
tessro / redis-server
Created December 16, 2009 14:20
A CentOS initscript for Redis
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
# My new git commit shortcut, thanks to http://whatthecommit.com/ :-)
alias commit='git commit -m "$(curl -s http://whatthecommit.com/ |grep '<p>' |cut -c 4-)"'
#!/usr/bin/env zsh
if [[ -s "${TM_PROJECT_DIRECTORY}/.rvmrc" ]]
then
source "${TM_PROJECT_DIRECTORY}/.rvmrc"
fi
`which ruby` $*
# backup redis databases to s3 on the engineyard platform
require 'zlib'
require 'rubygems'
require 'crack/json'
require 'aws/s3'
class Redis2S3
DATABASE = '/db/redis/redis_state.rdb'
@croaky
croaky / example.feature
Created September 24, 2010 21:34
how we do something similar to the first part of http://mislav.uniqpath.com/2010/09/cuking-it-right/
When I follow the comments link
Then the page should not have the leaderboard
And I should see the activity feed
And the activity feed should have a loading indicator
@gravis
gravis / readme
Created September 26, 2010 17:26
tcp syslog logger for rails draft
tcp_syslog is now a gem :
https://github.com/tech-angels/tcp_syslog
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
class QueryTracer < ActiveSupport::LogSubscriber
ACCEPT = %r{^(app|config|lib)}.freeze
FRAMES = 5
THRESHOLD = 300 # In ms
def sql(event)
return unless event.duration > THRESHOLD
callers = Rails.
backtrace_cleaner.
@bleything
bleything / passwords.rake
Created February 9, 2011 21:48
A Rakefile for managing an encrypted password file
########################################################################
### Rakefile for encrypted passwords
########################################################################
#
# Here's a little Rakefile to manage your encrypted password file! It's
# really easy to use:
#
# 1) put the email addresses of the keys you want in AUTHORIZED_USERS
# 2) create a passwords.txt (and ignore it in your SCM)
# 3) run `rake passwords:encrypt`
@brixen
brixen / memory.rb
Created February 18, 2011 21:56
Easy tool for checking how much memory Rubinius uses
$ rbx memory.rb
memory used: 19.4M
$ bin/mspec ci -T -rmemory core/array
rubinius 1.2.1 (1.8.7 cdbdd275 2011-02-15 JI) [i686-apple-darwin9.8.0]
................................................................................................................
Finished in 3.992361 seconds
112 files, 2166 examples, 4420 expectations, 0 failures, 0 errors