Skip to content

Instantly share code, notes, and snippets.

@timf
timf / gist:1191338
Created September 3, 2011 15:24
OpenShift Open Source
https://www.redhat.com/openshift/faq
When will OpenShift Open Source?
We are planning to open source but we don't have a timeframe just yet.
Part of the code came from an acquisition and we need to work through
some legal processes and create a development environment in order to
engage the community.
#!/bin/sh
CUSTOM_OSX="/Applications/Emacs.app/Contents/MacOS/Emacs"
EXE=`which emacs`
if [ `uname` == "Darwin" ]; then
if [ -f $CUSTOM_OSX ]; then
EXE=$CUSTOM_OSX
fi
elif [ -f /usr/bin/emacs-snapshot ]; then
scala> case class C(a: String, b: Option[String])
defined class C
scala> val constructors = C("",None).getClass.getConstructors
constructors: Array[java.lang.reflect.Constructor[_]] = Array(public C(java.lang.String,scala.Option))
scala> constructors.length
res13: Int = 1
scala> constructors(0).getParameterTypes
@timf
timf / gist:1718425
Created February 1, 2012 18:15
Throttling BW and latency on OSX
sudo ipfw pipe 1 config bw 150kbit/s delay 150ms
sudo ipfw add pipe 1 dst-ip 0.0.0.0/0
# do slow stuff
# done:
sudo ipfw flush
@timf
timf / tweet-json.py
Created June 9, 2012 13:01
Use the long ID number in a Tweet URL as script argument
#!/usr/bin/env python
import json
import urllib
import sys
if len(sys.argv) < 2:
sys.exit('Usage: %s [Tweet ID #]' % sys.argv[0])
url = "http://api.twitter.com/1/statuses/show/%s.json" % sys.argv[1]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! THIS SERVICE HAS NO HEALTHCHECKS. THIS MEANS YOU WILL NEVER KNOW IF IT !
! DIES IN PRODUCTION, WHICH MEANS YOU WILL NEVER KNOW IF YOU'RE LETTING !
! YOUR USERS DOWN. YOU SHOULD ADD A HEALTHCHECK FOR EACH DEPENDENCY OF !
! YOUR SERVICE WHICH FULLY (BUT LIGHTLY) TESTS YOUR SERVICE'S ABILITY TO !
! USE THAT SERVICE. THINK OF IT AS A CONTINUOUS INTEGRATION TEST. !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The EC2 and EBS APIs are implemented on multi-Availability Zone
replicated datastores. These datastores are used to store
metadata for resources such as instances, volumes, and
snapshots. To protect against datastore corruption, currently
when the primary copy loses power, the system automatically flips
to a read-only mode in the other Availability Zones until power
is restored to the affected Availability Zone or until we
determine it is safe to promote another copy to primary. We are
addressing the sources of blockage which forced manual assessment
and required hand-managed failover for the control plane, and
curl http://api.twitter.com/1/statuses/show/240219598270640128.json | python -m json.tool
"We know about as much about software quality problems as they knew about the Black Plague
in the 1600s. We've seen the victims' agonies and helped burn the corpses. We don't know
what causes it; we don't really know if there is only one disease. We just suffer -- and
keep pouring our sewage into our water supply."
Tom Van Vleck
@timf
timf / jargrep.sh
Created November 5, 2012 15:45
jargrep
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "enter name to grep"
exit 1
fi
files=`find . -name "*jar"`
for file in $files ; do echo "----------"; echo $file; jar tvf $file | grep $@ ; done