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 ($) { | |
$.lens = {}; | |
$.lens.of = function (get, set) { | |
var lens = function (d) { return get(d); } | |
lens.set = set; | |
lens.modify = function (d, f) { return set(d, f(get(d))); } | |
lens.compose = function (other_lens) { | |
return $.lens.of( | |
function (d) { return other_lens(get(d)); }, |
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/sh | |
# Shell script to install your public key on a remote machine | |
# Takes the remote machine name as an argument. | |
# Obviously, the remote machine must accept password authentication, | |
# or one of the other keys in your ssh-agent, for this to work. | |
# | |
# http://www.devthought.com/2009/09/19/get-ssh-copy-id-in-mac-os-x/ | |
# |
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
var getter = function(obj, lens) { | |
return _(lens).foldl(function(focused, element) { | |
return focused[element]; | |
}, obj); | |
}; | |
var modifier = function(obj, lens, mod) { | |
if (lens.length === 0) { | |
return mod(obj); | |
} else { |
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 alephtest.core | |
(:require [lamina.core :as l]) | |
(:require [aleph.http :as a]) | |
(:require [ring.adapter.jetty :as jetty])) | |
;; https://github.com/ztellman/aleph | |
(def counter (atom 0)) | |
(defn say-hello [] | |
(let [n (swap! counter inc)] |
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
{ :+ | |
{ :editor | |
{ "pmeta-/" [:toggle-comment-selection] | |
"ctrl-shift-up" [:editor.sublime.selectLinesUpward] | |
"ctrl-shift-down" [:editor.sublime.selectLinesDownward] | |
"pmeta-d" [:editor.sublime.selectNextOccurrence] | |
"ctrl-m" [:editor.sublime.goToBracket] | |
"ctrl-shift-m" [:editor.sublime.selectBetweenBrackets] | |
"shift-pmeta-space" [:editor.sublime.selectScope] | |
"ctrl-pmeta-up" [:editor.sublime.swapLineUp] |
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
var http = require('http') | |
, formidable = require('formidable') | |
, fs = require('fs') | |
, qs = require('querystring') | |
, util = require('util') | |
, uploads = {}; | |
http.createServer(function(req, res){ | |
if(req.method == 'GET') { | |
if(req.url != '/favicon.ico') { |
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
class SimpleLinearRegression | |
def initialize(xs, ys) | |
@xs, @ys = xs, ys | |
if @xs.length != @ys.length | |
raise "Unbalanced data. xs need to be same length as ys" | |
end | |
end | |
def y_intercept | |
mean(@ys) - (slope * mean(@xs)) |
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
FROM ubuntu | |
RUN dpkg-divert --local --rename --add /sbin/initctl | |
RUN ln -s /bin/true /sbin/initctl | |
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get upgrade -y | |
RUN apt-get -y install mysql-client mysql-server |
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/sh -xe | |
API_KEY="YOUR_API_KEY_GOES_HERE" | |
FPS="10" | |
VLC_PATH="/Applications/VLC.app/Contents/MacOS/VLC" | |
# I don't know how this'll behave on multimon, so you might want to hard-code. | |
# INRES='1440x900' | |
INRES=$(osascript -e 'tell application "Finder" to get bounds of window of desktop'|sed 's/, /x/g'|cut -f3- -dx) | |
OUTRES='1280x800' | |
# You can change this to record microphone or something else, from man soxformat (under coreaudio): |
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
~/$ lein new ring-on-heroku | |
Created new project in: /home/jim/Development/ring-on-heroku | |
~/$ cd ring-on-heroku | |
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile | |
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj | |
(ns ring-on-heroku.core | |
(:use ring.util.response | |
ring.adapter.jetty)) | |
(defn app [req] |
OlderNewer