Skip to content

Instantly share code, notes, and snippets.

View jgarber's full-sized avatar

Jason Garber jgarber

View GitHub Profile
@jgarber
jgarber / gist:8918120
Created February 10, 2014 15:42
Reset CloudStack fast
curl -Lo Vagrantfile http://git.io/Wt4DiQ
vagrant up
export VBOXID=`cat .vagrant/machines/default/virtualbox/id`
# Wait for it to come up and be ready.
VBoxManage snapshot $VBOXID take clean --live
# Make some VMs on CloudStack: http://10.0.123.101:8080/client/
time (VBoxManage controlvm $VBOXID poweroff && VBoxManage snapshot $VBOXID restorecurrent && VBoxManage startvm $VBOXID --type headless)
...
0.05s user 0.06s system 2% cpu 4.667 total

Keybase proof

I hereby claim:

  • I am jgarber on github.
  • I am jasongarber (https://keybase.io/jasongarber) on keybase.
  • I have a public key whose fingerprint is 70B9 220F 2F0C 6508 1DCD 6009 21EB 9232 CC6C 2F8B

To claim this, I am signing this object:

@jgarber
jgarber / dotenv-proposal.md
Last active August 29, 2015 14:06
dotenv environments loading proposal

A proposal for loading multiple dotenv files

In regards to my comment on bkeepers/dotenv#120

Proposed heirarchy of environment variable sources

  1. ENV
  2. config/**/env
  3. .env
  4. config/**/env.#{Rails.env}
@jgarber
jgarber / private.xml
Created December 23, 2014 21:21
Karabiner config
<?xml version="1.0"?>
<root>
<deviceproductdef>
<productname>APPLE_INTERNAL_KEYBOARD_TRACKPAD_0x0259</productname>
<productid>0x0259</productid>
</deviceproductdef>
<deviceproductdef>
<productname>APPLE_WIRELESS_KEYBOARD_0x0255</productname>
<productid>0x255</productid>
</deviceproductdef>
This was just a branch off of master. We're not using the Federated path,
but we are using SSO (it'd be nice if we could make this a separate setting)
"""Logs a user in using a token from Keystone's POST."""
referer = request.META.get('HTTP_REFERER')
auth_url = re.sub(r'/auth.*', '', referer)
- request.federated_login = True
+ request.federated_login = False
request.user = auth.authenticate(request=request, auth_url=auth_url)
[Wed May 27 10:48:29 2009] [error] cgid daemon process died, restarting
[Wed May 27 10:48:29 2009] [warn] long lost child came home! (pid 10881)
[ pid=10888 file=ext/apache2/Hooks.cpp:566 time=2009-05-27 10:48:31.874 ]:
Unexpected error in mod_passenger: The ApplicationPool server unexpectedly closed the connection while we're reading a response for the 'g
et' command.
Backtrace:
(empty)
[ pid=10888 file=ext/apache2/Hooks.cpp:566 time=2009-05-27 10:48:31.875 ]:
Unexpected error in mod_passenger: The ApplicationPool server unexpectedly closed the connection while we're reading a response for the 'g
et' command.
require File.dirname(__FILE__) + '/spec_helper'
class Page
def part_with_array_find(name)
parts.to_a.find {|p| p.name == name.to_s }
end
def part_with_sql_find(name)
parts.find_by_name name.to_s
end
end
@jgarber
jgarber / gist:164899
Created August 9, 2009 21:06
Color management with Photoshop and Illustrator
I struggled with color management all day (or you might say, for years now).
Here's what I did:
Read http://www.viget.com/inspire/the-mysterious-save-for-web-color-shift/.
He's exactly right. Doesn't cover Illustrator, though. Here's what I figured
out:
Calibrate your monitor. I use Huey Pro. I use a color temperature of D65 and a
Gamma of 2.2.
require File.dirname(__FILE__) + '/../spec_helper'
require 'benchmark'
class DeepChildPagesDataset < Dataset::Base
uses :home_page
def load
create_page "Parent" do
1.upto(50) do |num|
@jgarber
jgarber / gist:1022726
Created June 13, 2011 13:00
Costs of running a production Rails app
Monthly costs associated with a solid setup for a Rails app (based on minimal traffic).
* Linode 512 - $19.95
* Github account - $7
* Pingdom uptime monitoring - $9.95 ($0.50 to add 1 check to existing account.)
* New Relic performance monitoring - $24 (or on-demand if you want to do shorter tests)
* Amazon CloudFront - less than $5
Other service possibilities:
* Basecamp - project management and collaboration