ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
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
#!/bin/bash | |
size_in_mib=32 | |
bytes=$((2 ** 20 * $size_in_mib)) | |
sectors=$(($bytes / 512)) | |
heads=16 | |
cylinders=$(($sectors / $heads / 63)) | |
dd if=/dev/zero of=baremetal.img bs=512 count=$sectors | |
dd if=fat16mbr.bin of=baremetal.img conv=notrunc |
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
(ns async-test.timeout.core | |
(:require [cljs.core.async :refer [chan close!]]) | |
(:require-macros | |
[cljs.core.async.macros :as m :refer [go]])) | |
(defn timeout [ms] | |
(let [c (chan)] | |
(js/setTimeout (fn [] (close! c)) ms) | |
c)) | |
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
// ==UserScript== | |
// @name URL Observer Addon | |
// @namespace anon | |
// @match http://*/* | |
// @match https://*/* | |
// @exclude http://localhost/* | |
// @version 2 | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @grant GM_info | |
// @grant metadata |
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
; http://www.algolist.com/Dijkstra's_algorithm | |
(defn dijkstra [g src] | |
(loop [dsts (assoc (zipmap (keys g) (repeat nil)) src 0) | |
curr src | |
unvi (apply hash-set (keys g))] | |
(if (empty? unvi) | |
dsts | |
(let [unvi (disj unvi curr) | |
nextn (first (sort-by #(% dsts) unvi)) |
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
;;Using the Cassowary constraint solver from ClojureScript | |
;;This demo shows using multimethods for readable constraint syntax using +, -, and =. | |
;;Output is a row of circles with random radii spaced so that the space between their boundaries is uniform. | |
(ns c2.main | |
;;refer-clojure :exclude is currently broken in ClojureScript master | |
;;Ticket open: http://dev.clojure.org/jira/browse/CLJS-114 | |
;;Fix applied here: https://github.com/lynaghk/clojurescript/tree/114-refer-clojure-exclude | |
(:refer-clojure :exclude [+ - =]) | |
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
(ns pigeonhole-sort) | |
(defn int-sort [s] | |
(let [listmap (reduce #(update-in | |
(update-in %1 [%2] (fnil inc 0)) | |
[:max] max %2) {:max 0} s)] | |
(mapcat #(repeat (get listmap % 0) %) | |
(range (inc (:max listmap)))))) |
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
;variants of the code from point #2 of: | |
; http://www.tbray.org/ongoing/When/200x/2009/12/01/Clojure-Theses | |
;original | |
(apply merge-with + | |
(pmap count-lines | |
(partition-all *batch-size* | |
(line-seq (reader filename))))) |
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
;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix. | |
;; | |
;; * :use makes functions available without a namespace prefix | |
;; (i.e., refers functions to the current namespace). | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; |
NewerOlder