Skip to content

Instantly share code, notes, and snippets.

Avatar
At harbour

John Barton joho

At harbour
View GitHub Profile
@joho
joho / gist:3735740
Created Sep 17, 2012 — forked from rafaelss/gist:3700977
PostgreSQL 9.2 upgrade steps
View gist:3735740
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
@joho
joho / iam-mfa-password-self-service-policy.json
Created May 6, 2021
IAM policy that allows full IAM self service including MFA
View iam-mfa-password-self-service-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowViewAccountInfo",
"Effect": "Allow",
"Action": [
"iam:GetAccountPasswordPolicy",
"iam:GetAccountSummary",
"iam:ListUsers",
@joho
joho / buildbox_cloudwatch.sh
Created Nov 11, 2014
Script for publishing buildbox build wait times as an AWS cloudwatch metric
View buildbox_cloudwatch.sh
#!/bin/bash
#
# Publishes CloudWatch metrics about Buildbox queue length
set -e
API='https://api.buildbox.io'
BUILDS_ROUTE='v1/accounts/ACCOUNT_NAME/projects/PROJECT_NAME/builds'
# Determines whether a binary exists on the current $PATH
@joho
joho / gzip_net_http.rb
Created Sep 19, 2012
Handling gzip responses in Ruby Net::HTTP library
View gzip_net_http.rb
# from http://pushandpop.blogspot.com.au/2011/05/handling-gzip-responses-in-ruby-nethttp.html
# i wanted syntax highlighting
require 'net/http'
debug = Proc.new{|msg| STDERR.puts "[#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}] #{msg}" }
page = nil
http = Net::HTTP.new( "www.google.com", 80 )
req = Net::HTTP::Get.new( "/search?num=20&hl=en&noj=1&q=test&btnG=Search", { "Accept-Encoding" => "gzip", "User-Agent" => "gzip" } )
@joho
joho / hecate.yml
Last active Jun 4, 2019
Reference configuration for Hecate Dispatch https://hecate.co/products/dispatch
View hecate.yml
# Required: an admin contact for errors, billing issues, and the like
admin_email: your.name@yourcompany.com
# Optional: timezone for when to send and how to format emails
# defaults to "Australia/Melbourne"
timezone: "Australia/Melbourne"
# Required: config for shipping news (notify on merged PRs)
shipping:
# Array of release notifications to send
-
@joho
joho / hecate.yml
Created May 13, 2019
Hecate team config example
View hecate.yml
admin_email: billing.email@yourdomain.com
timezone: Australia/Melbourne
team:
lead: yourgithublogin
engineers: ["engineerlogin", "engineerlogin"]
owned_repos: ["repo-name", "other-repo-name"]
@joho
joho / deploy.rb
Created Sep 13, 2012
How to serve emergency "signed out" views from page cache without affecting signed in users in rails.
View deploy.rb
set :path_to_repo, "/path_to_repo/"
set :running_app_user, "appusername"
namespace :webscale do
desc "Cache a signed out version of the path. Usage: cap webscale:signed_out_cache_page -s path_to_cache=/films/on_netflix"
task :signed_out_cache, roles: :app do
cache_base_path = "#{path_to_repo}/public/signed_out"
cached_destination_path = "#{cache_base_path}#{path_to_cache}.html"
working_path = "#{cached_destination_path}.tmp"
View .env
import _ "github.com/joho/godotenv/autoload"
@joho
joho / envato-dev.markdown
Created Oct 24, 2011
Ruby on Rails Developer @ Envato
View envato-dev.markdown

Ruby on Rails Developer @ Envato

Hi, we're Envato and we're looking for Ruby on Rails developers.

Actually, we're just looking for developers. Good developers who either already know a bit of Ruby and/or Rails, or are keen to stretch their skills a bit and learn a new platform. If you're enthusiastic about solving real problem for real users the best way you can, you're probably the kind of developer who would fit right in here.

First though: a bit about us. We're a youngish company, transitioning out of the hectic startup days and into something a bit bigger and more settled. We operate a series of online stock digital media marketplaces such as Activeden (formerly FlashDen), GraphicRiver, ThemeForest, AudioJungle, VideoHive, 3DOcean, CodeCanyon, Tuts+ Marketplace, and PhotoDune.

@joho
joho / Makefile
Created Oct 4, 2014
Building and deploying static sites to s3 with http://harpjs.com/
View Makefile
# Variables
SRC=src
DIST=dist
# Destroy the final targets
clean:
rm -rf $(DIST)/*
# Compile the final targets
all: