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
View balls.clj
(require '[lanterna.screen :as s])
(def scr (s/get-screen))
(s/start scr)
(s/put-string scr 10 10 "Hello, world!")
(s/put-string scr 10 11 "Press any key to exit!")
(s/redraw scr)
(s/get-key-blocking scr)
View gist:32908d20d51f49f9d7d0
sjl at grendel in ~/Library/Application Support/Adobe/Lightroom/Develop Presets/VSCO Film 06 Push & Pull - Standard
><((°> ag 'Sharpness = 0' | grep lrtemplate
400H+1 +++.lrtemplate:66: Sharpness = 0,
400H+1 ++.lrtemplate:66: Sharpness = 0,
400H+1 -.lrtemplate:66: Sharpness = 0,
400H+1 +.lrtemplate:66: Sharpness = 0,
400H+1 Over +.lrtemplate:66: Sharpness = 0,
400H+1 Night.lrtemplate:66: Sharpness = 0,
400H+1 Over.lrtemplate:66: Sharpness = 0,
400H+1 Vibrant.lrtemplate:66: Sharpness = 0,
View kittens.js
//////////////////////////// Auto-observe stars
// Start
starClick = setInterval(function() { $("#gameLog").find("input").click(); }, 2 * 1000);
// Stop
clearInterval(starClick);
////////////////////////// Autoconvert 'nip
View how-to-camera.markdown

How to become a decent photographer in five years

You're not gonna become a master in your spare time, but you can get decently good at photography in five years of dedicated but non-full-time practice. It's taken me about twice that to get decent, but I fucked around a lot along the way.

You don't need a ton of fancy equipment, but photography does require some gear. I'll limit the gear-buying here to once a year (not counting books).

@sjl
sjl / which is best? .py
Created Nov 16, 2009 — forked from inky/which is best? .py
They're completely different.
View which is best? .py
>>> x = '0123456789'
>>> a, b = [{} for _ in x], [{}] * len(x)
>>> a[0]['test'], b[0]['test'] = 1, 1
>>> p(a)
[{'test': 1}, {}, {}, {}, {}, {}, {}, {}, {}, {}]
>>> p(b)
View git vs mercurial
# Discard local changes
git checkout -f (git co -f)
# This will change the current parent revision if you're not at a branch tip.
# The fact that it discards local changes is just a side effect.
hg update --clean (hg co -C)
# What you really want is the command *designed* to throw away changes: revert.
hg revert --all [--no-backup] (hg rev -a)
@sjl
sjl / .cdg.sh
Created Apr 29, 2010 — forked from bobthecow/cdg.bash
A function to cd to the root of the current Mercurial repository.
View .cdg.sh
#!/usr/bin/env bash
# cd to the root of the current Mercurial repo
#
# usage:
# Add the following function to your `.bashrc` or `.bash_profile` file,
# or save it somewhere (i.e. `~/.cdg.sh`) and source it in `.bashrc`
cdh () {
hg root >/dev/null && cd "`hg root`"
View install_rope.sh
#!/bin/bash
# Plant rope vim's plugin
# This is a script to install or update 'ropevim'
# Copyright Alexander Artemenko, 2008
# Contact me at svetlyak.40wt at gmail com
function create_dirs
{
mkdir -p src
@sjl
sjl / afacli.py
Created Nov 1, 2010
A command-line client for A Feed Apart
View afacli.py
import json, time, urllib
n = 0
while 1:
try:
resp = json.load(urllib.urlopen('http://afeedapart.com/u/%s' % n))
except ValueError:
time.sleep(1)
continue
View gist:792702
(defn usable-personalities
[personalities]
(filter #(> (:total %) 5) personalities))
(defn render-personality
[personality]
(str (:stddev personality)
","
(:score personality)
","
You can’t perform that action at this time.