Skip to content

Instantly share code, notes, and snippets.

View codahale's full-sized avatar
🦆
Look at all these chickens

Coda Hale codahale

🦆
Look at all these chickens
View GitHub Profile
@PharkMillups
PharkMillups / gist:5630223
Last active December 17, 2015 15:18
Crispy Tailors in San Francisco
@holman
holman / SAFE-RUBY.rb
Created February 16, 2011 05:38
This shows some of my favorite ways to ensure robust, high-security Ruby Applications.
require 'net/https'
module SecurityModule
class HighSecurity
class ReallyHighSecurity
def self.turn_on_safe_connections
OpenSSL::SSL::VERIFY_NONE
end
end
end
#!/bin/sh
# simple script for turning a jar with a Main-Class
# into a stand alone executable
# cat [your jar file] >> [this file]
# then chmod +x [this file]
# you can now exec [this file]
commandToRun="$(printf "%q " "$@")"
if test "$commandToRun" = "'' "; then
eval "exec java -Xmx1G -jar $0"
else
anonymous
anonymous / gist:615570
Created October 7, 2010 18:11
diff -u -r varnish-2.1.3/bin/varnishd/cache_dir_random.c varnish-quorum/bin/varnishd/cache_dir_random.c
--- varnish-2.1.3/bin/varnishd/cache_dir_random.c 2010-03-24 09:44:13.000000000 +0000
+++ varnish-quorum/bin/varnishd/cache_dir_random.c 2010-10-07 18:22:42.506413284 +0000
@@ -75,6 +75,7 @@
enum crit_e criteria;
unsigned retries;
+ double quorum_weight;
double tot_weight;
struct vdi_random_host *hosts;
#!/usr/bin/env ruby
# Command line util for acquiring a one-off Twitter OAuth access token
# Based on http://blog.beefyapps.com/2010/01/simple-ruby-oauth-with-twitter/
require 'rubygems'
require 'oauth'
puts <<EOS
Set up your application at https://twitter.com/apps/ (as a 'Client' app),
def increment(key: String):Int = {
var rv:Int = -1
if (client.applyUpdate(new UpdateAction[String,String] {
def update(storeClient: StoreClient[String,String]) {
val value:Versioned[String] = storeClient.get(key)
if (value == null) {
storeClient.put(key, new Versioned[String]("1"))
}
else {
value.setObject((value.getValue.toInt + 1).toString)
@retronym
retronym / type-bounds.scala
Created December 16, 2009 11:17
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x