Skip to content

Instantly share code, notes, and snippets.

View steveh's full-sized avatar

Steve Hoeksema steveh

View GitHub Profile
@steveh
steveh / roar.rb
Last active October 3, 2016 21:21
require "roar/coercion"
require "roar/json/hal"
require "json"
module CategoryRepresenter
include Roar::JSON::HAL
include Roar::Hypermedia
include Roar::Coercion
property :name
[steve:~/Sites/flick/packer] master* ± PACKER_LOG=1 packer build vault.json
2016/09/16 13:39:50 [INFO] Packer version: 0.10.1
2016/09/16 13:39:50 Packer Target OS/Arch: darwin amd64
2016/09/16 13:39:50 Built with Go Version: go1.6.2
2016/09/16 13:39:50 Detected home directory from env var: /Users/steve
2016/09/16 13:39:50 Using internal plugin for digitalocean
2016/09/16 13:39:50 Using internal plugin for docker
2016/09/16 13:39:50 Using internal plugin for null
2016/09/16 13:39:50 Using internal plugin for amazon-chroot
2016/09/16 13:39:50 Using internal plugin for azure-arm
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Kotiri
+ NZ
require "fileutils"
Rake::Task["assets:precompile"].enhance do
Rake::Task["assets:precompile:partner"].invoke
end
Rake::Task["assets:clobber"].enhance ["assets:clobber:partner"]
namespace :assets do
# try to log like Sprockets even though their stuff is all private
1. stdlib or well maintained libraries for:
* UTF8
* I18n
* Decimals
* Dates, times (with or without dates), timezones, & ranges of
* UUID
* Background jobs
* PostgreSQL (incl. type mapping from UUID, GIS, Array, Range, etc)
* Redis
defmodule Coercer do
@date_format "{YYYY}-{0M}-{0D}"
def coerce({value, idx}) do
case idx do
1 -> Decimal.new(value)
2 -> Timex.parse(value, @date_format) |> elem(1)
_ -> value
end
end
#!/bin/bash
cd "/srv/www/$1/current" || exit
if [ -f bin/console ]; then
BIN="./bin/console"
elif [ -f Gemfile ] && grep -q rack-console Gemfile; then
BIN="rack-console"
else
BIN="irb"
fi
ubuntu@api01-a:~$ SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt ruby doctor.rb www.google.com:443
/usr/local/bin/ruby (2.2.3-p173)
OpenSSL 1.0.1f 6 Jan 2014: /usr/lib/ssl
SSL_CERT_DIR=""
SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
HEAD https://www.google.com:443
OK
class Connection
def self.combine(*args, &block)
# call open multiple times somehow?
end
def self.open(args = {}, &block)
puts "open #{args}"
instance = new(args)
block.call(instance)
puts "close #{args}"
- git: repo={{repo_url}}
version={{repo_version}}
dest=/srv/www/{{application}}/current
accept_hostkey=yes
update=yes
force=yes
sudo: yes
sudo_user: deploy
- template: src=config.local.php.j2 dest=/srv/www/{{application}}/current/app/config.local.php owner=deploy group=deploy mode=0644
- file: src=/srv/www/{{application}}/shared/logs