Skip to content

Instantly share code, notes, and snippets.

Steve Losh sjl

Block or report user

Report or block sjl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
samn / lock_less_monster.clj
Last active Dec 18, 2015
The Lock Less Monster
View lock_less_monster.clj
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.
puffnfresh / currying.js
Created Sep 7, 2012
Support for both curried and uncurried application in functional JavaScript
View currying.js
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, [], 1));
return curry(g);
var sum = curry(function(x, y) {
panicsteve / gist:1641705
Created Jan 19, 2012
Form letter template for acquired startups
View gist:1641705
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
andyfowler / .vimrc
Created Sep 5, 2011
Swap iTerm2 cursors in vim insert mode when using tmux
View .vimrc
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence
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>\\"
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
chapmanb / vagrant_pallet.clj
Created Jun 20, 2011
Running pallet with manual specification of a server; example with vagrant virtualbox
View vagrant_pallet.clj
(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
vim-voom / markdown.vim
Created Jun 20, 2011
Markdown folding for Vim
View markdown.vim
" folding for Markdown headers, both styles (atx- and setext-)
" 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)
sjl / gist:1006307
Created Jun 3, 2011
Stop apps from spamming the system logs (both files are in /etc/, use `killall syslogd` to restart it after editing).
We couldn’t find that file to show.
johnholdun / imgur-bookmarklet.js
Created Apr 9, 2011
Bookmarklet for uploading the image currently loaded in your browser to imgur
View imgur-bookmarklet.js
// 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!
cowboy /
Created Mar 14, 2011
Multi-Firefox Fixer: Run multiple versions of Firefox simultaneously! (note: doesn't work on Windows)
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
Multi-Firefox Fixer - v0.2 - 4/26/2011
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
bobthecow / .gitconfig
Created Jul 6, 2010
`git todo` alias is the hotness.
View .gitconfig
# install t first:
todo = !python ~/path/to/ --task-dir "$(git rev-parse --show-toplevel)" --list TODO
bug = !python ~/path/to/ --task-dir "$(git rev-parse --show-toplevel)" --list BUGS
You can’t perform that action at this time.