Skip to content

Instantly share code, notes, and snippets.

# 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 / 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"}})
@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
# helpers for local :javascripts and :stylesheets
# add
# yield :javascripts
# yield :stylesheets
# in your header
def load_javascripts(*scripts)
load_content(:javascripts,*scripts) do |script|
javascript_include_tag script
end
@elisehuard
elisehuard / gist:333827
Created March 16, 2010 10:30
awesome wm and rubymine
# add in .zshrc or .bashrc
# or in rubymine's startup script :)
export AWT_TOOLKIT='MToolkit java -jar weka.jar'