Skip to content

Instantly share code, notes, and snippets.

View peterschwarz's full-sized avatar

Peter Schwarz peterschwarz

View GitHub Profile
@peterschwarz
peterschwarz / list_classpath.clj
Last active March 25, 2016 14:45
List current classpath in clojure
(defn current-classpath []
(->> (ClassLoader/getSystemClassLoader) (.getURLs) seq (map #(.getFile %))))
@peterschwarz
peterschwarz / keybase.md
Last active November 4, 2016 14:41
keybase verification

Keybase proof

I hereby claim:

  • I am peterschwarz on github.
  • I am pschwarz (https://keybase.io/pschwarz) on keybase.
  • I have a public key ASDDELxVW0VvTx5AZSS-J6bpiFOUQF3lV8wTgezhdkqcIQo

To claim this, I am signing this object:

@peterschwarz
peterschwarz / doAll.js
Created August 1, 2014 18:38
Do all underscore addition
_.doAll = function(fn) {
var fns = Array.prototype.slice.call(arguments);
return function() {
var self = this;
var target_args = Array.prototype.slice.call(arguments);
return _.map(fns, function(fn) {
return fn.apply(self, target_args)
});
@peterschwarz
peterschwarz / subl.sh
Last active August 29, 2015 14:00
subl command line util
#!/bin/sh
nohup ~/Applications/sublime-text-2/sublime_text $1 >/dev/null 2>&1 &
@peterschwarz
peterschwarz / mult_example.clj
Created April 16, 2014 23:32
Core.async `mult` example
(require '[clojure.core.async :refer [chan timeout >!! <!! alts!! mult tap]])
(defn td [ch]
(first (alts!! [ch (timeout 100)])))
(def c (chan 10))
(>!! c :foo) ; true
@peterschwarz
peterschwarz / handler.clj
Last active August 29, 2015 13:56
Hello Session World
(ns hello-world.handler
(:use compojure.core)
(:require [compojure.handler :as handler]
[compojure.route :as route]
[ring.util.response :as resp]
[clojure.data.json :as json]))
(defn generate-response [data & [status]]
{:status (or status 200)
:body (str "<div>Hello <strong>" (:hello data) "</strong></div><div>We seen you <em>" (inc (:count data)) "</em> time(s)</div>")
@peterschwarz
peterschwarz / backup_and_recover.md
Last active April 20, 2021 18:59
Backup and restore a raspberry pi

Mac Backup your Raspberry Pi

Given a Raspberry Pi with Rasbian, you'll need to backup your sdk every now and then.

(courtesy of @nickbauman)

Backup remotely

Requires public key exchange for pi account: