Skip to content

Instantly share code, notes, and snippets.

@elisehuard
elisehuard / build.boot
Last active December 5, 2017 16:04
gorilla repl boot task
(def gorilla-version "0.4.0") ;; adapt this as needed
(set-env!
:resource-paths #{"src" "resources"}
:dependencies '[[gorilla-repl "0.4.0"]]) ;; version!
(task-options!
pom {:project 'restaurant
:version "0.1.0-SNAPSHOT"}
jar {:manifest {"Foo" "bar"}})
➜ ~ brew install freealut
==> Downloading http://connect.creativelabs.com/openal/Downloads/ALUT/freealut-1.1.0.tar.gz
curl: (6) Could not resolve host: connect.creativelabs.com
Trying a mirror...
==> Downloading http://ftp.de.debian.org/debian/pool/main/f/freealut/freealut_1.1.0.orig.tar.gz
######################################################################## 100.0%
==> Patching
patching file configure.ac
==> ./autogen.sh
#!/bin/zsh
# usage: wake_me <command>
echo $@
$@
notification='display notification "'$@'" with title "Finished"'
osascript -e "$notification"
say -v Deranged "it's finally, finally finished. at last."
# fixed version of http://altons.github.io/python/2012/12/01/converting-northing-and-easting-to-latitude-and-longitude/
# - filenames
# - data type (pyproj transform doesn't like pandas series)
import os
import pandas as pd
import pyproj
import re
listfiles = os.listdir("codepo/Data/CSV")
pieces = []
@elisehuard
elisehuard / sleeping_barber.erl
Created May 31, 2011 11:27
sleeping barber in erlang
% sleeping barber problem
-module(sleeping_barber).
-export([barber_scenario/0]).
start_shop() ->
spawn(fun() -> barber_shop() end)
.
barber_scenario() ->
ShopPid = start_shop(),
@elisehuard
elisehuard / sleeping_barber.exs
Created May 28, 2011 14:45
sleeping barber in elixir
module Barber
def loop(shop_pid)
shop_pid <- 'barbercheck
receive
match 'wakeup
IO.puts "wakeup"
loop(shop_pid)
match {'customer, customer}
cut_hair(shop_pid, customer)
loop(shop_pid)
@elisehuard
elisehuard / gist:819022
Created February 9, 2011 18:58
(minimal) mongrel2 handler in ruby
require 'zmq'
require 'json'
handler_ctx = ZMQ::Context.new(1)
# receive and response for mongrel2 handlers
# queue address corresponds to what's in the configuration
recv_queue = handler_ctx.socket(ZMQ::PULL)
recv_queue.connect("tcp://127.0.0.1:9999")
@elisehuard
elisehuard / gist:635097
Created October 19, 2010 20:55
parallel quicksort
package main
import (
"fmt"
"os"
)
type request struct {
data []int
replyChannel chan []int
}
@elisehuard
elisehuard / gist:630980
Created October 17, 2010 16:20
concurrent sieve of erathostenes - analogy with go example
-module(sieve).
-export([run/1]).
run(M) ->
Numbers = lists:seq(3, M),
Startpid = self(),
spawn_link(fun() -> prime_filter(Startpid, 2, Numbers) end),
gather().
gather() ->
require 'nokogiri'
module Nokogiri
module XML
class Node
BLANK = /^[ \n]*$/
# Comparing with other node
# - same name
# - same attributes