Skip to content

Instantly share code, notes, and snippets.

gem 'mechanize', '>=0.9.0'
require 'mechanize'
###
# Log in to itunes connect, get the list of applications.
#
# Example:
#
# ITunesConnect.new do |client|
# client.login 'user@example.com', 'password'
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)
# I cannot credit the original author
class Haversine
#EARTH_RADIUS = 3963.19 # miles
EARTH_RADIUS = 6371 # kilometers
RADIAN_PER_DEGREE = Math::PI / 180.0
def self.distance(lat1, lng1, lat2, lng2)
lat1_radians = lat1 * RADIAN_PER_DEGREE
lat2_radians = lat2 * RADIAN_PER_DEGREE
@melito
melito / gist:3153481
Created July 20, 2012 21:48 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt

This is a temporary workaround to have etcd listening on all interfaces so you can access it from docker containers.

Add a local etcd unit file

Create a file called /media/state/units/etcd-local.service that has the following contents:

[Unit]
Description=etcd local