Skip to content

Instantly share code, notes, and snippets.

View lygaret's full-sized avatar

Jonathan Raphaelson lygaret

View GitHub Profile
@lygaret
lygaret / diffrecurse.py
Created March 3, 2010 20:17 — forked from dakrone/diffrecurse.py
recursive diff
#!/usr/bin/env python
import os
import sys
from os.path import join
expectedFiles = []
actualFiles = []
returnValue = 0
expectedFolder = sys.argv[1]
@lygaret
lygaret / rpcmacro.clj
Created July 8, 2010 04:52
quick macro for creating and running xmlrpc clients
(ns rpcmacro
(:import [java.net URL])
(:import [org.apache.xmlrpc XmlRpcException])
(:import [org.apache.xmlrpc.client XmlRpcClient XmlRpcClientConfigImpl XmlRpcCommonsTransportFactory XmlRpcSunHttpTransport XmlRpcSunHttpTransportFactory])
(:import [org.apache.commons.httpclient HttpClient HttpState])
(:use [clojure.contrib.pprint]))
(defn mk-client [url]
(let [config (XmlRpcClientConfigImpl.)
client (XmlRpcClient.)
@lygaret
lygaret / graphix.clj
Created July 8, 2010 04:54
attempt at easy swing graphics in cloj
(ns typoet.graphix
(:import [javax.swing JFrame])
(:import [java.awt Dimension Canvas])
(:import [java.awt.event WindowAdapter KeyAdapter MouseAdapter MouseMotionAdapter])
(:use [clojure.contrib.seq-utils]))
(defstruct window :height :width :title :frame :canvas :handlers)
(defn- get-handlers
[window key]
@lygaret
lygaret / VideoCapture.java
Created July 8, 2010 04:57
get webcam frames from quicktime, process and display in clojure
package video;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.WritableRaster;
import quicktime.QTRuntimeException;
import quicktime.QTRuntimeHandler;
import quicktime.QTSession;
import quicktime.qd.PixMap;
@lygaret
lygaret / vimproject.vim
Created July 8, 2010 05:08
vimplugin which looks for a .project.vim file up the dir tree for peoject specific vim settings
" Name: vimproject.vim
" Version: 0.1
" Author: Jon Raphaelson
" Summary: Loads a project specific vimrc when starting vim inside that
" project's directory tree.
" Licence: This program is free software; you can redistribute it and/or
" modify it under the terms of the GNU General Public License.
" See http://www.gnu.org/copyleft/gpl.txt
" Section: Documentation {{{1
" Description:
@lygaret
lygaret / tweetmeme.py
Created July 8, 2010 05:13
watch and rank links coming from twitters public timeline
#!/usr/bin/env python
# Watch and rank links coming from twitter's public timeline.
# Currently this doesn't really work all that well, as we can only get 20
# tweets a minute, but it's an idea.
# Requires the following non-standard python libs: (install with easy_install)
# * simplejson
# * functional
# * sqlalchemy
@lygaret
lygaret / tutticolori.vim
Created July 8, 2010 05:18
port of the espresso color theme to vim
We couldn’t find that file to show.
@lygaret
lygaret / index.js
Last active January 18, 2023 17:26
ES6 Quasi-Literal for JSX
define(function(require) {
var React = require('react');
var paramRegex = /__(\d)+/;
var parser = new DOMParser();
var errorDoc = parser.parseFromString('INVALID', 'text/xml');
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI;
// turns the array of string parts into a DOM
// throws if the result is an invalid XML document.
@lygaret
lygaret / env.clj
Last active August 29, 2015 14:26
not really useful config loader
(ns my.env
(:require [clojure.edn :as edn]))
(defn- get-resource [path]
(let [classloader (java.lang.ClassLoader/getSystemClassLoader)]
(.getResource classloader path)))
(defn- read-config-file []
(let [url (get-resource "config.edn")]
(slurp url)))
;; https://soundcloud.com/jonathan-raphaelson/overtone-experiment-1
(ns overtonetute.core
[:use [overtone.live]])
(use 'overtone.inst.drum)
(definst swave [freq 440 attack 0.001 sustain 0.4 release 0.1 vol 0.005]
(lpf (* (env-gen (env-lin attack sustain release) 1 1 0 1)
(sin-osc freq)