This file contains hidden or 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
| # 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 = [] |
This file contains hidden or 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
| (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"}}) |
This file contains hidden or 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
| % sleeping barber problem | |
| -module(sleeping_barber). | |
| -export([barber_scenario/0]). | |
| start_shop() -> | |
| spawn(fun() -> barber_shop() end) | |
| . | |
| barber_scenario() -> | |
| ShopPid = start_shop(), |
This file contains hidden or 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
| 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) |
This file contains hidden or 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
| 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") |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| ) | |
| type request struct { | |
| data []int | |
| replyChannel chan []int | |
| } |
This file contains hidden or 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
| -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() -> |
This file contains hidden or 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
| require 'nokogiri' | |
| module Nokogiri | |
| module XML | |
| class Node | |
| BLANK = /^[ \n]*$/ | |
| # Comparing with other node | |
| # - same name | |
| # - same attributes |
This file contains hidden or 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
| # 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 |
This file contains hidden or 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
| # add in .zshrc or .bashrc | |
| # or in rubymine's startup script :) | |
| export AWT_TOOLKIT='MToolkit java -jar weka.jar' |
NewerOlder