Skip to content

Instantly share code, notes, and snippets.

View trshafer's full-sized avatar

Thomas Shafer trshafer

View GitHub Profile
@trshafer
trshafer / directions.md
Last active August 29, 2015 14:02
Upload ssl certificate to cloudfront

A successful ssl upload command to cloudfront using a ssl certificate signed by comodo.

This is the cloudfront documentation: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/SecureConnections.html#CNAMEsAndHTTPS

Here's my successful command:

aws iam upload-server-certificate --server-certificate-name myServerCertificate --certificate-body file:///Users/..../from_comodo.pem --private-key file:///Users/.../server.key.pem --certificate-chain file:///Users/.../chain.pem --path=/cloudfront/production/

Replace /Users/.... with the path to those files. And yes keep the three three slashes in the beginning.

@trshafer
trshafer / index.html
Last active August 29, 2015 14:07
publish with onTextData
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta http-equiv="Content-type" content="text/html; charset=us-ascii" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="description" content="" />
<title>ActionScript Publisher</title>
@trshafer
trshafer / remove_none_images.sh
Created October 30, 2014 19:21
remove untagged "<none>" images in docker
docker images | grep "<none>" | awk '{print $3}' | tr "\\n" " " | xargs docker rmi
require File.dirname(__FILE__) + '/../config/database'
register DatabaseSetup
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Migration.verbose = true
ActiveRecord::Migrator.migrate(File.dirname(__FILE__)+"/../db/migrate")
# you can make as many tabs as you wish...
# tab names are actually arbitrary at this point too.
---
- tab1: cd ~/foo/bar
- tab2:
- mysql -u root
- use test;
- show tables;
- tab3: echo "hello world"
- tab4: cd ~/baz/ && svn up
@trshafer
trshafer / Infinitely Nested Hashes
Created May 13, 2010 23:49
infinitely nested hashes
default = lambda { |h,k| h[k] = Hash.new(&default) }
top = Hash.new(&default)
@trshafer
trshafer / gist:402088
Created May 15, 2010 07:52
Kings Cup in Ruby
require 'rubygems'
require 'active_support'
while (deck ||= %w(Diamond Heart Spade Club).collect{ |suit| {'Ace' => 'Waterfall', 2 => 'You', 3 => 'Me', 4 => 'Women of Society', 5 => 'Category', 6 => 'Gentlemen', 7 => 'Heaven', 8 => 'Mate', 9 => 'Rhyme', 'Jack' => 'Thumb Master', 'Queen' => 'Questions', 'King' => 'Pour'}.collect{|card, rule| "#{(card)} of #{suit}s: #{rule}"} }.flatten.shuffle).select {|card| card =~ /king/i}.present? do puts deck.pop end
@trshafer
trshafer / git svn create branch
Created August 2, 2010 18:21
git svn branch
git svn branch remote_name
git checkout -b local_name -t remote_name
@trshafer
trshafer / gist:519251
Created August 11, 2010 16:24
git ps1
# GIT PS1
# COLORS
LIGHT_GRAY="\[\033[0;37m\]"; BLUE="\[\033[0;34m\]"; RED="\[\033[0;31m\]"; LIGHT_RED="\[\033[1;31m\]";
GREEN="\[\033[0;32m\]"; WHITE="\[\033[1;37m\]"; LIGHT_GRAY="\[\033[0;37m\]"; YELLOW="\[\033[1;33m\]";
BROWN="\[\033[0;33m\]"; BLACK="\[\033[0;30m\]";PURPLE="\[\033[0;35m\]";CYAN="\[\033[0;36m\]";
# GIT PROMPT (http://gist.github.com/120804)
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \(\1\)/';
}
function parse_git_status {
@trshafer
trshafer / Database Branches
Created September 9, 2010 18:10
Database Branches
## database.yml (after)
<%
# http://mislav.uniqpath.com/rails/branching-the-database-along-with-your-code/
branch = `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '')
suffix = `git config --bool branch.#{branch}.database`.chomp == 'true' ? "_#{branch}" : ""
%>
development:
# ... adapter/auth config ...
database: myapp<%= suffix %>