Skip to content

Instantly share code, notes, and snippets.

View dliggat's full-sized avatar

Dave Liggat dliggat

View GitHub Profile
@dliggat
dliggat / ssh.config
Last active October 18, 2016 19:23
SSH into a private subnet via a bastion host
Host buildserver # bastion
HostName 50.123.123.123
User ec2-user
ForwardAgent yes
IdentityFile /Users/dliggat/.ssh/key.pem
Host buildagent # tunnel ssh through a bastion
HostName 10.0.0.100
User ec2-user
IdentityFile /Users/dliggat/.ssh/key.pem
@dliggat
dliggat / production.rake
Created January 8, 2015 22:54
Dump a postgresql production database excluding migrations; and restore locally
namespace :production do
task sync: :environment do |t, args|
user_at_host = 'ubuntu@aws-host.com'
user_keypair = '-i ~/.ec2/gsg-keypair'
filename = Time.now.strftime "production_dump_%Y-%m-%d_%H-%M-%S.psql"
dump_path = "/tmp/#{filename}"
project = 'project'
# Dumping the table (excluding schema_migrations) on the server.
dump_command = ["pg_dump --exclude-table=schema_migrations",
@dliggat
dliggat / mixpanel_export.rb
Last active January 14, 2017 14:41
Export data from Mixpanel
#!/usr/bin/env ruby
require 'active_support/time'
require 'digest'
API_KEY = 'YOUR KEY'
API_SECRET = 'YOUR SECRET'
args = {
'from_date' => Date.new(2014,9,1).iso8601,
@dliggat
dliggat / public_read.json
Created August 8, 2014 19:28
S3 Bucket Policy for all files public read: http://awspolicygen.s3.amazonaws.com/policygen.html
{
"Id": "Policy1407525880036",
"Statement": [
{
"Sid": "Stmt1407525872165",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::$BUCKET_NAME/*",
@dliggat
dliggat / mixin2.rb
Last active August 29, 2015 14:04
Module function collision => super calls most recent definition
module Foo
def blar
puts 'blar!'
end
end
module Bar
def blar
puts 'barry!'
end
@dliggat
dliggat / thirty_day_challenges.md
Created June 2, 2014 02:58
Thirty Day Challenges

Thirty-day Challenges:

  • 2014-05: No financial news, checking portfolio performance, etc
    • Very relaxing. Demonstrative of the reality that the markets carry out happily without intervention and without needing to be watched. A good reminder to focus on life and not monkey with financial stuff.
  • 2014-06: Hit 10,000 steps a day

Backlog

  • no caffeine
@dliggat
dliggat / sublime_settings.json
Created May 30, 2014 15:39
Sublime settings
{
"auto_complete_commit_on_tab": true,
"auto_match_enabled": false,
"binary_file_patterns":
[
"*.doc",
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",

Keybase proof

I hereby claim:

  • I am dliggat on github.
  • I am dliggat (https://keybase.io/dliggat) on keybase.
  • I have a public key whose fingerprint is A683 E518 CE53 D80E E0AE ABF3 E913 BB24 FEDA BC07

To claim this, I am signing this object:

@dliggat
dliggat / states.md
Last active October 28, 2016 20:07
US States I've Visited
  • Alabama
  • Alaska
  • Arizona
  • Arkansas
  • California
  • Colorado
  • Connecticut
  • Delaware
  • Florida
  • Georgia
@dliggat
dliggat / photo_bin.rb
Created March 21, 2014 01:18
A ruby script to bin photos by year-month directories (assumes jpgs are in a standard ISO8601ish format; e.g. 2014-01-10_13-23-22.jpg).
#!/usr/bin/env ruby
require 'date'
require 'fileutils'
raise ArgumentError.new "Usage: #{$0} directory" unless ARGV.count == 1
root_dir = File.expand_path ARGV.first
Dir.glob "#{root_dir}/*.jpg" do |file|