Skip to content

Instantly share code, notes, and snippets.

View paulmakepeace's full-sized avatar
😄

Paul Makepeace paulmakepeace

😄
View GitHub Profile
# frozen_string_literal: true
# DockerHelper provides methods to work with Docker containers.
module DockerHelper
extend self
def running_in_docker?
!!(File.read("/proc/1/cgroup") =~ %r[^\d+:\w+:/docker/]) # !! => true/false
rescue Errno::ENOENT
false
@paulmakepeace
paulmakepeace / keybase.md
Created July 16, 2015 00:01
keybase.io/paulmakepeace

Keybase proof

I hereby claim:

  • I am paulmakepeace on github.
  • I am paulmakepeace (https://keybase.io/paulmakepeace) on keybase.
  • I have a public key whose fingerprint is 9C72 A0C2 7681 3113 38A1 6C9F 670F 9FF3 4115 673C

To claim this, I am signing this object:

@paulmakepeace
paulmakepeace / console.log
Created April 9, 2012 20:05
rvm install 1.9.3 borked
$ rvm reinstall 1.9.3
Removing /home/deploy/.rvm/src/ruby-1.9.3-p125...
Removing /home/deploy/.rvm/rubies/ruby-1.9.3-p125...
Removing ruby-1.9.3-p125 aliases...
Removing ruby-1.9.3-p125 wrappers...
Removing ruby-1.9.3-p125 environments...
Removing ruby-1.9.3-p125 binaries...
Installing Ruby from source to: /home/deploy/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
@paulmakepeace
paulmakepeace / kv_to_tsv.rb
Created March 28, 2012 22:12
Convert key: value lines into a TSV
#!/usr/bin/ruby
# Take a series of key: value lines and output a TSV with a header row made
# up from the set of seen keys.
IN_FILE = 'phiri.txt'
RECORD_DELIMITER = 'Template-Type'
ENCODING = 'ISO-8859-1'
rows = []
@paulmakepeace
paulmakepeace / app.rb
Created March 2, 2012 20:14
vhost error_log ignored with passenger
require 'sinatra'
get '/' do
$stderr.puts "stderr"
$stdout.puts "stdout"
'got /'
end
@paulmakepeace
paulmakepeace / app.rb
Created March 2, 2012 01:35
nginx ignoring error_log?
require 'rubygems'
require 'bundler/setup'
require 'sinatra'
#require 'logger'
get '/' do
# log = File.open('/tmp/registry.log', 'a')
@paulmakepeace
paulmakepeace / README.txt
Created December 30, 2011 00:20
Which European country's phone calling code requires the longest search into π?
https://twitter.com/#!/paulmakepeace/status/152405728848650240
"I mulled over this: which European country's phone calling code requires the longest search into π?
E.g. Switzerland +41, 3 digits #math #pi"
A couple of folks asked about very small "countries" or territories that
had seemingly long calling codes but which are actually subsumed under
e.g. North American Numbering Plan (+1) which isn't in Europe anyway,
Vatican City (+379 & +39), Curaçao (+599-9) under Netherlands Caribbean,
etc.