Skip to content

Instantly share code, notes, and snippets.

View wuputah's full-sized avatar
🐘

Jonathan Dance (JD) wuputah

🐘
View GitHub Profile
% gst
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: vendor/gems/faraday_middleware-parse_oj-0.3.0.gem
% grep parse_oj Gemfile
#!/usr/bin/env ruby
# 1. Add your environment variable keys below to check them
# for connectivity.
CHECK = [
'DATABASE_URL',
'MEMCACHIER_SERVERS',
'REDISCLOUD_URL',
]
#!/usr/bin/ruby
def burn
Thread.new { loop { rand() * rand() } }
Thread.new { loop { rand(100) * rand(100) } }
end
pids = (1..4).collect do
fork do
burn
@wuputah
wuputah / cap
Created January 15, 2015 23:37
#!/bin/sh
scrot -s -e 'cloudapp $f; rm $f'
diff --git a/lib/rack/server.rb b/lib/rack/server.rb
index 33d5389..27f1244 100644
--- a/lib/rack/server.rb
+++ b/lib/rack/server.rb
@@ -233,6 +233,7 @@ module Rack
logging_middleware,
[Rack::TempfileReaper]
]
+ m["production"] = m["deployment"]
m["development"] = [

For Sale

  • [Sony RX-100 camera: $260][camera] - great camera, good condition, cosmetic scuff marks on edges, 2 batteries, 16 gb sd card, battery charger / usb cable, wrist strap.
  • [32 GB Eyefi Mobi SD Memory Card: $60][eyefi] - 2 weeks old, very little use; no packaging. Did not use 90-day eyefi cloud trial.
  • [Roku 3: $60][roku] - excellent condition, factory reset, all items and original box + bonus free HDMI cable.
  • [Sharp 310W Soundbar: $100][soundbar] - from late 2013, excellent condition, includes remote, no box
  • [Samsung 26" LCD HDTV / Monitor: $100][lcdtv] - used
  • [Sennheiser PXC 450: $200][pxc 450] - new in box
  • [Automatic pet feeder: $40][feeder]
~/Dropbox (Personal)/Photos % ls
2002 2005 2011 2014 RAW
2003 2006 2012 2015 RAW ONLY
2004 2007 2013 No metadata
~/Dropbox (Personal)/Photos % du -sh .
58G .
~/Dropbox (Personal)/Photos % find . | grep -i jpg$ | wc -l
7946
~/Dropbox (Personal)/Photos % find . | grep -vi jpg$ | wc -l
2813
# e is for efficient. There's not really a way to eager load associations yourself
# without AR thinking you're trying to assign or create something.
attr_accessor :echildren
def self.find_all_efficiently
categories = find(:all, :order => 'position ASC, name ASC').inject(Hash.new) do |h, c|
h[c.parent_id] ||= []
h[c.parent_id] << c
h
end
@wuputah
wuputah / s3-copy-bucket.rb
Created September 29, 2008 04:25
Copies contents of S3 bucket
#!/usr/bin/ruby
require 'rubygems'
require 'right_aws'
access_key = 'abc'
secret = 'xyz'
src = 'src'
dest = 'dest'
@wuputah
wuputah / grant-public-read-to-bucket.rb
Created September 29, 2008 22:34
Grants public read to an S3 bucket
#!/usr/bin/ruby
require 'rubygems'
require 'aws/s3'
include AWS::S3
AWS::S3::Base.establish_connection!(
:access_key_id => 'abc',
:secret_access_key => '123'