Here is a checklist to follow if you want maximum battery life -- for instance if you're about to get on a long plane flight.
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 'connection_pool' | |
require 'redis' | |
require 'metriks' | |
class RedisClientWrapper | |
def initialize(options) | |
@options = options.delete(:pool) | |
@pool = ConnectionPool.new(@options) do | |
::Redis.new(options) | |
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
#!/usr/bin/env ruby -wKU | |
# Save: Nothing | |
# Input: Document | |
# Output: Replace Input | |
# Caret Placement: Line Interpolation | |
COCOA_DIALOG_COMMAND = "#{ENV["TM_SUPPORT_PATH"]}/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog" |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2012 François Vaux <[email protected]> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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/tclsh8.5 | |
# | |
# Usage: unmerged branch1 branch2 | |
proc getlog branch { | |
lrange [split [exec git log $branch --oneline] "\n"] 0 100 | |
} | |
proc diff {title c1 c2} { | |
puts "\n$title" |
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 perl | |
# Parameters supported: | |
# | |
# config | |
# autoconf | |
# | |
# Magic markers: | |
#%# family=auto | |
#%# capabilities=autoconf |
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
def pbcopy(str) | |
IO.popen('pbcopy', 'r+') {|io| io.puts str } | |
output.puts "-- Copy to clipboard --\n#{str}" | |
end | |
Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n| | |
pbcopy _pry_.input_array[n ? n.to_i : -1] | |
end | |
Pry.config.commands.command "copy", "Copy to clipboard" do |str| |
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
namespace :log_resque do | |
desc "Print out (every 2 seconds) the number of busy and total workers for Resque" | |
task :working do | |
# In your Rails app directory : | |
# bundle exec rake log_resque:working --silent >> log/resque_working.log & | |
interval = 2.0 | |
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
# cap deploy deploy:db_schema_load | |
namespace :deploy do | |
desc "Load the initial schema - it will WIPE your database, use with care" | |
task :db_schema_load, :roles => :db, :only => { :primary => true } do | |
puts <<-EOF | |
************************** WARNING *************************** | |
If you type [yes], rake db:schema:load will WIPE your database | |
any other input will cancel the operation. |
Yahoo! provides its GeoPlanet data as three separate TSV files, available for download here.
That's a database with some 17 million records:
- 5.7 million records: locations (aka places).
- 2.2 million records: alternative names for each place (aka aliases).
- 9.6 million records: matrix of neighbourhoods per place (aka adjacencies).