Skip to content

Instantly share code, notes, and snippets.

JD wuputah

Block or report user

Report or block wuputah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:11203806
% 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
View check-connection.rb
#!/usr/bin/env ruby
# 1. Add your environment variable keys below to check them
# for connectivity.
CHECK = [
'DATABASE_URL',
'MEMCACHIER_SERVERS',
'REDISCLOUD_URL',
]
View cpu-burn.rb
#!/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
View cap
#!/bin/sh
scrot -s -e 'cloudapp $f; rm $f'
View rack-rack-env-production.diff
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"] = [
View for-sale.md

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]
View gist:f03f35d5530d3339239b
~/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
View gist:6804
# 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 Sep 29, 2008
Copies contents of S3 bucket
View s3-copy-bucket.rb
#!/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 Sep 29, 2008
Grants public read to an S3 bucket
View grant-public-read-to-bucket.rb
#!/usr/bin/ruby
require 'rubygems'
require 'aws/s3'
include AWS::S3
AWS::S3::Base.establish_connection!(
:access_key_id => 'abc',
:secret_access_key => '123'
You can’t perform that action at this time.