Skip to content

Instantly share code, notes, and snippets.

View sjl's full-sized avatar

Steve Losh sjl

View GitHub Profile
@sjl
sjl / gist:1870613
Created February 20, 2012 18:40
Overtone Playing
(ns dp20120220d
(:use [clojure.string :only (lower-case)])
(:use [overtone.live :only (definst saw stop line:kr FREE kill)]))
(definst tone [freq 440 length 1]
(* (line:kr 0.9 1 length FREE)
(saw freq)))
(def pitches {:a 440.00
:a♯ 466.16 :b♭ 466.16

Context: I've never used Overtone before, but I've heard of it. I came across this today and decided to do it during my lunch break.

Here's a brain dump of thoughts I had during my first hour or so of playing with Overtone.

Installation was really awesome. One line in project.clj, lein deps and it just worked. Definitely a great start.

@sjl
sjl / vim.svg
Created February 23, 2012 17:05
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sjl
sjl / gist:1994414
Created March 7, 2012 17:05
Attempting to get FocusLost working with terminal Vim through tmux. Halp.
if exists('$TMUX')
let &t_ti = "\<Esc>Ptmux;\<Esc>" . &t_ti . "\e[?1004h" . "\<Esc>\\"
let &t_te = "\<Esc>Ptmux;\<Esc>" . "\e[?1004l" . &t_te . "\<Esc>\\"
noremap <ESC>[O :echom "TEST"<cr>
else
if &term =~ "xterm.*"
let &t_ti = &t_ti . "\e[?1004h"
let &t_te = "\e[?1004l" . &t_te
noremap <ESC>[O :echom "TEST"<cr>
@sjl
sjl / gist:2013603
Created March 10, 2012 22:20
Lobos DB definition for SQLite3
(def db
{:classname "org.sqlite.JDBC"
:subprotocol "sqlite"
:subname "./db.sqlite3"})
@sjl
sjl / ebooks.clj
Created March 27, 2012 23:06
@anything_ebooks in about a hundred lines of Clojure
#_(defdeps [[twitter-api "0.6.4"]])
(ns ebooks
(:use [twitter.api.restful]
[clojure.string :only (join)]))
(def markov-map
"A ref to a mapping of words to a mapping of words to frequencies.
For example, this corpus:
@sjl
sjl / realforce.markdown
Created April 4, 2012 20:59
Realforce 103UB initial impressions

After typing on my new Realforce 103UB for a few hours, here are my first impressions.

(other good keyboards I've used: Das Silent, Das Ultimate, HHKB Pro 2)

My initial thought on taking it out of the box was that it felt really sleek. Thin almost. It feels way slimmer than the Dases do in my hands. It think it's a consequence of the rounded edge compared to the Das' sharp, square edges, much like Macbooks have the rounded edges to feel thinner.

Once you put it on the table though, it turns into a beast. It's very wide and flat. Here it is compared to the HHKB I was using before:

Let's say I make a piece of Clojure code that does something other than serve a website.

Example: a loop that checks twitter every 10 minutes for mentions of some product and emails them to me. You'd start it with lein run and it would run until killed, (Thread/sleep 1000)ing when it doesn't need to work.

Can I host this kind of thing, standalone, on Heroku? With the free plan?

So far it seems like the answer is yes. I just name it something other than 'web' in the procfile (so Heroku doesn't expect it to bind to a port) and then scale it to one process. So the procfile looks like:

scraper: lein run
year population
-10000 1000000
-8000 5000000
-6500 5000000
-5000 5000000
-4000 7000000
-3000 14000000
-2000 27000000
-1000 50000000
-500 100000000