Skip to content

Instantly share code, notes, and snippets.

@zmalltalker
zmalltalker / gitorious-unicorn-initd-script.sh
Created May 8, 2013 11:55
init.d script for Unicorn with Gitorious
#!/bin/sh
### BEGIN INIT INFO
# Provides: gitorious-unicorn
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Control the Gitorious application server
# Description: Unicorn is Gitorious' application server, accepting
# requests via a frontend web server like Nginx
### END INIT INFO
@zmalltalker
zmalltalker / .chruby
Created December 11, 2012 08:03
Switch rubies when cd-ing in zshell
chruby 1.9.3
@zmalltalker
zmalltalker / README.org
Created July 20, 2012 08:55
Thinkpad fan control

Thinkpad fan control

My Thinkpad T400s kept shutting down when it was busy doing CPU intensive work. It turns out that the fan did not speed up to a high enough level to cool down the CPU, and I’d find messages in /var/log/messages stating that the CPU was dangerously hot.

Load the thinkpad_acpi module with manual fan control enabled

The first thing I did was to make it possible to manually control the fan speed. In order for this to work, the thinkpad_acpi kernel module needs to be loaded with a specific parameter. This can be

@zmalltalker
zmalltalker / gist:1891397
Created February 23, 2012 07:53
Very simple upstart script for Unicorn
chdir /var/www/rails_apps/the_one
env RAILS_ENV=production
exec /usr/bin/bundle exec unicorn_rails -c config/unicorn.rb
respawn
# This start on stanza works, but it's simplistic
# Will add a stop on stanza once I make up my mind about stop on
start on runlevel [3]
@zmalltalker
zmalltalker / bzip2 vs pbzip2
Created February 22, 2011 08:18
pbzip2 runs on several cores
So let's see how bzip2 performs. It will run on a single core:
log ➤ time bzip2 test.log
bzip2 test.log 95.70s user 0.38s system 99% cpu 1:36.84 total
99% cpu. 1.36 minutes. Not too shabby
Now, for some multi core action, let's see how pbzip2 performs:
log ➤ time pbzip2 test.log
@zmalltalker
zmalltalker / udev_rules_for_nexus_one_on_fedora_14.mdown
Created November 25, 2010 11:49
This is a proven udev rule for running adb in Fedora 14

I had trouble getting the Android toolchain working under Fedora 14 with my Nexus One. The Android documentation only gives the correct udev rules for Ubuntu, so I had to dig around to find something that worked.

The solution

My solution is to add the following into /etc/udev/rules.d/51-nexus-one.rules. You should not need anything besides this to get it working.

SUBSYSTEM=="usb", ATTRS{idProduct}=="4e12", ATTRS{idVendor}=="18d1", MODE="0666" SYMLINK+="android_adb"

After which you run udevadm control --reload-rules, and plug in your phone. At this point, lsusb should display your Nexus in the listing.

class Project
has_many :events, :order => "created_at asc", :dependent => :destroy do
def nevermind
find(:all, :conditions => {:action => 99})
end
end
end
RATIONALE =<<_END
The case for a maybe:
We all know true and false, right? Larry Wall once said that truth should be
considered evident; therefore anything in Perl is either true or false, along with
anything else it may be. Truth is just an aspect.
And we use it easily, with the if/else construct:
if something
do_something
(function(Camping) {
var Blog = {
Models: {
},
Controllers: {
},
Views: {
}
};
Camping.goes(Blog);
require 'test/unit'
class Size
include Comparable
attr_reader :size
SIZE_LIST = %w(xxs xs s m l xl xxl)
def self.method_missing(m,*args,&blk)
if SIZE_LIST.include?(m.to_s)
return new(m.to_s)