Skip to content

Instantly share code, notes, and snippets.

View wuputah's full-sized avatar
🐘

Jonathan Dance (JD) wuputah

🐘
View GitHub Profile
@wuputah
wuputah / later.rb
Created September 17, 2012 05:51
Later: a simple thread proxy
# +Later+ is a typical object proxy built around a Thread. You pass it a block
# and it will start performing that task in a Thread. Later, you can call any
# method on the object and it will proxy the call to the return value from
# +Thread#value+ (which joins the thread).
#
# Example:
#
# data = [
# Later { open("http://google.com") },
# Later { open("http://duckduckgo.com") },
#!/bin/bash
# ./clone-db COLOR from-app to-app plan
#
# example:
# ./clone-db COBALT my-production-app my-staging-app crane
#
# The COLOR is used for a grep on your config var output, so make sure it's unique.
color=$1
src=$2
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2856 jd 20 0 1874m 1.3g 61m S 2.0 16.3 184:50.28 firefox
<%
require 'cgi'
require 'uri'
begin
uri = URI.parse(ENV["DATABASE_URL"])
rescue URI::InvalidURIError
raise "Invalid DATABASE_URL"
end
#!/usr/bin/env ruby
$task_to_check = ARGV[0]
begin
require 'rake'
rescue LoadError => e
exit(4)
end
% openssl s_client -connect asdfasdf.s3.amazonaws.com:443 -showcerts
CONNECTED(00000003)
depth=3 /C=US/O=Entrust.net/OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority
verify error:num=19:self signed certificate in certificate chain
verify return:0
---
Certificate chain
0 s:/C=US/ST=Washington/L=Seattle/O=Amazon.com Inc./CN=*.s3.amazonaws.com
i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3
-----BEGIN CERTIFICATE-----
web: bin/run
% curl -D - http://dailygourmet.com/
HTTP/1.1 200 OK
Date: Thu, 17 May 2012 18:56:51 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 470
#!/usr/bin/perl -wT
# multiversion/cluster aware pg_ctl wrapper; this also supplies the correct
# configuration parameters to 'start', and makes sure that a postmaster really
# stops on 'stop'.
#
# (C) 2005-2009 Martin Pitt <mpitt@debian.org>
# (C) 2009 Cyril Bouthors <cyril@bouthors.org>
#
# This program is free software; you can redistribute it and/or modify
puts "I am #{$$}"
trap('TERM') { puts "[#{Time.now}] #{$$}: Got TERM!" }
pid1 = fork
# child
if !pid1
puts "Child is #{$$}"
# create a sub-child