Skip to content

Instantly share code, notes, and snippets.

View wjlroe's full-sized avatar
📷

William Roe wjlroe

📷
View GitHub Profile
@bradwright
bradwright / darwin-keychain.el
Created February 12, 2012 11:39
How to get an OS X KeyChain entry in Emacs (useful for ERC etc.)
(defun chomp (str)
"Chomp leading and tailing whitespace from STR."
(while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'" str)
(setq str (replace-match "" t t str))) str)
(defun get-keychain-password (account-name)
"Gets `account` keychain password from OS X Keychain"
(chomp
(shell-command-to-string
(concatenate
@mbbx6spp
mbbx6spp / README.md
Created February 7, 2012 17:58
Websockets with Netty (Scala translation) - WORK IN PROGRESS! Currently it expects an integer and will respond with its square. It isn't very interesting but it serves as a boilerplate/skeleton.

Experimentation with Netty and Scala's Types

Status

  • Only first pass complete: raw translation from Java example to Scala.
  • Second pass [incomplete]: abstracting to make server and client specific code composable.

TODO:

  • Create declarative and composable Pipeline definition
require 'riak/cluster'
cluster = Riak::Cluster.new(:count => 4, :source => "/usr/local/Cellar/riak/1.0.3/libexec/bin", :root => "~/mycluster")
cluster.create
cluster.start
cluster.join
@panicsteve
panicsteve / gist:1641705
Created January 19, 2012 18:26
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
@zed
zed / .gitignore
Created November 20, 2011 14:20
WebSocket Echo :python:twisted:txws:jquery:
/twistd.pid
/_trial_temp/
@mbbx6spp
mbbx6spp / ExitCodeTestsExample.hs
Created November 6, 2011 20:30
Cabal file with test-suite block and explanation in a USAGE.md file.
module Main where
import Test.QuickCheck (quickCheck)
import Your.Module (encrypt, decrypt)
prop_reverseReverse :: [Char] -> Bool
prop_reverseReverse s = (reverse . reverse) s == s
prop_encryptDecrypt :: [Char] -> Bool
prop_encryptDecrypt s = (encrypt . decrypt) s == s
@jasoncodes
jasoncodes / gist:1223731
Created September 17, 2011 07:45
Installing Ruby 1.9.3 with rbenv on OS X
# The latest version of this script is now available at
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh
VERSION=1.9.3-p286
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
else
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
@yevgenko
yevgenko / .Xdefaults
Created August 24, 2011 02:58
URxvt settings with solarized theme
!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: false
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
@thommay
thommay / gist:1131973
Created August 8, 2011 15:37 — forked from baldowl/gist:796353
Interactive fog session: how to get a bunch of signed URLs for European buckets with fog 0.4.1
require 'active_support/time'
bucket = Fog::Storage.new(:provider => 'AWS').directories.select {|d| d.key == 'my_bucket'}
files = bucket.files.select {|f| f.content_length > 0 &&
f.key =~ %r{client-name.*\.zip}}
expiration = Time.now.next_month.end_of_month
signed_urls = files.map {|f| f.url(expiration)}
fixed_signed_url = signed_urls.map do |su|
su.sub(%r{s3\.(.*)/my_bucket}, "my_bucket.s3.#{$1}")
end
(defn watch
"Returns (running) thread which observes the value of f every delay
milliseconds, and calls the callback fn if the value changes. callback
will be called with the old and new values from f"
([f callback delay]
(let [proc (fn []
(loop [x1 ::watch-init]
(let [x2 (f)]
(when (not= x1 x2)
(callback x1 x2))