This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#_( | |
Let's say you have a threadpool doing work that requires access to some shared resource. | |
And this resource needs to be refreshed at times. E.g. an OAuth bearer token that can expire or be revoked. | |
If this resource were expensive to refresh, or subject to rate limiting (OAuth tokens are often both) | |
then it's desirable to refresh as little as possible. | |
It's undesirable, however, to mix complicated synchronization code for updating the resource in | |
with the business logic consuming it. | |
Enter the lock less monster, a lock free method for coordinating updates to a shared reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function curry(f) { | |
return function(x) { | |
var g = f.bind(this, x); | |
if(g.length == 0) return g(); | |
if(arguments.length > 1) return curry(g).apply(this, [].slice.call(arguments, 1)); | |
return curry(g); | |
}; | |
} | |
var sum = curry(function(x, y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence | |
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns distblast-cluster.vagrant | |
(:require [pallet.compute :as compute] | |
[pallet.phase :as phase] | |
[pallet.core :as core] | |
[pallet.utils :as utils] | |
[pallet.compute.node-list :as node-list] | |
[pallet.action.exec-script :as exec-script])) | |
(defn test-script [session] | |
(-> session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" folding for Markdown headers, both styles (atx- and setext-) | |
" http://daringfireball.net/projects/markdown/syntax#header | |
" | |
" this code can be placed in file | |
" $HOME/.vim/after/ftplugin/markdown.vim | |
" In Markdown, setext-style overrides atx-style, so we first check for an | |
" underline. Empty lines should be ignored when underlined. | |
func! Foldexpr_markdown(lnum) | |
let l1 = getline(a:lnum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// that is, navigate to the direct URL for an image hosted on the world wide web, then >>>INVOKE<<< | |
// i wanted the bookmarklet to redirect to the new direct image URL but that was out of scope! | |
javascript:void(window.location="http://api.imgur.com/2/upload.json?url="+encodeURIComponent(window.location.href)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF | |
Multi-Firefox Fixer - v0.2 - 4/26/2011 | |
http://benalman.com/ | |
Usage: `basename "$0"` | |
Run this shell script from beside (in the same parent directory as) one or more | |
Firefox*.app or Aurora*.app applications and it will "fix" those Firefoxes to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# install t first: http://github.com/sjl/t | |
todo = !python ~/path/to/t.py --task-dir "$(git rev-parse --show-toplevel)" --list TODO | |
bug = !python ~/path/to/t.py --task-dir "$(git rev-parse --show-toplevel)" --list BUGS |
NewerOlder