Skip to content

Instantly share code, notes, and snippets.

View timhaines's full-sized avatar

Tim Haines timhaines

View GitHub Profile

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg

@timhaines
timhaines / gist:2474197
Created April 23, 2012 22:05
riak console
Exec: /usr/local/Cellar/riak/1.1.1x86_64/libexec/erts-5.8.5/bin/erlexec -boot /usr/local/Cellar/riak/1.1.1x86_64/libexec/releases/1.1.1/riak -embedded -config /usr/local/Cellar/riak/1.1.1x86_64/libexec/etc/app.config -pa ./lib/basho-patches -args_file /usr/local/Cellar/riak/1.1.1x86_64/libexec/etc/vm.args -- console
Root: /usr/local/Cellar/riak/1.1.1x86_64/libexec
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:64] [hipe] [kernel-poll:true]
=INFO REPORT==== 23-Apr-2012::15:03:29 ===
alarm_handler: {set,{system_memory_high_watermark,[]}}
** ./lib/basho-patches/etop_txt.beam hides /usr/local/Cellar/riak/1.1.1x86_64/libexec/lib/observer-0.9.10/ebin/etop_txt.beam
** /usr/local/Cellar/riak/1.1.1x86_64/libexec/lib/observer-0.9.10/ebin/etop_txt.beam hides /usr/local/Cellar/riak/1.1.1x86_64/libexec/lib/basho-patches/etop_txt.beam
** Found 2 name clashes in code paths
@timhaines
timhaines / gist:1896693
Created February 24, 2012 02:06
stats slabs
stats slabs
STAT 1:chunk_size 96
STAT 1:chunks_per_page 10922
STAT 1:total_pages 1
STAT 1:total_chunks 10922
STAT 1:used_chunks 10344
STAT 1:free_chunks 578
STAT 1:free_chunks_end 0
STAT 1:mem_requested 936814
STAT 1:get_hits 5477766
@timhaines
timhaines / name_display.rb
Created February 22, 2012 00:09
Name Display in Page Title
def name_for_page_title user
result = "@" + user.screen_name
if I18n.locale == :en
result += user.screen_name.last == "s" ? "’" : "’s"
result += " (#{user.name.strip})" unless user.screen_name == user.name
end
return result
end
@timhaines
timhaines / resque_retry.rb
Created September 9, 2011 06:17 — forked from PatrickTulskie/resque_retry.rb
Retry failed Resque jobs in Ruby
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs
# retry all failed Resque jobs except the ones that have already been retried
# This is, for instance, useful if you have already retried some jobs via the web interface.
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present?
end
# retry all :)
Resque::Failure.count.times do |i|
@timhaines
timhaines / th_tweets.txt
Created January 1, 2011 03:25
@TrainedHedonist's tweets
View these by putting the ID in the url. I.e. for the first one,
On Twitter: http://twitter.com/TrainedHedonist/status/16086877353
On Favstar: http://favstar.fm/t/16086877353
16086877353: I hope I'm never with a woman that cackles. A laugh, chortle, or guffaw is fine. Cackling, no.
16116045254: Just went jogging and some hotshot blew right by me. I showed him a thing or two when I ran past him and tumbled over a birch tree stump.
16132364963: Discovering the woman you're with is wearing granny panties is sort of like seeing a Unicorn drop a deuce.
16163485559: I like to spice up speed dating with an impromptu existential meltdown.
16180942217: It's been a while since I've had a hangover. It's supposed to feel like John Goodman is sitting on your face, right?
16317523206: "I get what you're saying about climate change, but I would like to talk about pornography now instead." (inappropriate segue)
require "nestful"
require "roauth"
def upload(path_to_file)
twitpic_key = "my_twitpic_api_key"
oauth_url = "https://api.twitter.com/1/account/verify_credentials.json"
oauth = {
:access_key => "account_access_key",
:access_secret => "account_access_secret",
# IO speed tests on a new softlayer server using the cheap 500gb Sata drives.
#62500 blocks per gig
# want to double ram
# have 12gb, so want 24gb worth
# 62500 * 24 = 1500000
time sh -c "dd if=/dev/zero of=ddfile bs=16k count=1500000 && sync"
#paste output:
1500000+0 records in
def measure_time task_description
beginning = Time.now
yield
puts "Time to #{task_description}: #{Time.now - beginning} seconds"
end
def add a, i
a << i