This file contains 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
;; required jars: swank-clojure clj-stacktrace | |
;; to start from command line: | |
;; java -cp ~/.clojure/clojure-1.3.0.jar:~/.clojure/swank-clojure-1.4.0.jar:~/.clojure/clj-stacktrace/0.2.4/clj-stacktrace-0.2.4.jar clojure.main swank.clj | |
;; automatically import repl and javadoc in swank when running 1.3.0 | |
(if (>= (.compareTo (clojure-version) "1.3.0") 0) | |
(do (use 'clojure.repl) | |
(use 'clojure.java.javadoc) | |
(use 'clojure.reflect))) |
This file contains 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
-- regular merge sort | |
mergesort :: (a -> a-> Bool) -> [a] -> [a] | |
mergesort pred [] = [] | |
mergesort pred [x] = [x] | |
mergesort pred xs = merge pred (mergesort pred left) (mergesort pred right) where | |
(left, right) = splitAt (length xs `div` 2) xs | |
-- write better split | |
merge :: (a -> a-> Bool) -> [a] -> [a] -> [a] | |
merge pred left [] = left |
This file contains 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
Eclipse 4.2(juno) is using CSS to decorate/render widgets. Default tab font size is quite large wasting screen space. To change it edit eclipse42//plugins/org.eclipse.platform_4.2.0.v201206081400/css/e4_default_mac.css (or pick css file that corresponds to your specific os) and change following section: | |
.MPartStack { | |
font-size: 12; | |
swt-simple: false; | |
swt-mru-visible: false; | |
} | |
to something like: | |
.MPartStack { |
This file contains 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
import sys | |
import logging | |
global log | |
log = logging.getLogger('qs') | |
log.addHandler(logging.StreamHandler()) | |
def readFromFile(fname): | |
print "reading " + fname | |
txt = open(fname) |
This file contains 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
# this goes into Pomodoro.app/Contents/Resources/getToDoListFromOmniFocus.applescript | |
on sort(_list) | |
set text item delimiters to {ASCII character 10} | |
set _list to _list as string | |
set _list to paragraphs of (do shell script "echo " & quoted form of (_list) & " | sort -f") | |
set text item delimiters to "" | |
return _list | |
end sort |
This file contains 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
# ***** BEGIN LICENSE BLOCK ***** | |
# | |
# For copyright and licensing please refer to COPYING. | |
# | |
# ***** END LICENSE BLOCK ***** | |
""" | |
Example of simple consumer using SSL. Acks each message as it arrives. | |
""" | |
from ssl import CERT_REQUIRED, PROTOCOL_SSLv3 |
This file contains 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
DEBUG 2012-10-19 14:29:51,873 pika.connection _send_frame 1309: Added 21 bytes to the outbound buffer | |
DEBUG 2012-10-19 14:29:51,873 pika.adapters.select_connection poll 349 : Calling <bound method SelectConnection._handle_events of <pika.adapters.select_connection.SelectConnection object at 0x101045d50>>(1) | |
DEBUG 2012-10-19 14:29:51,873 pika.callback wrapper 49 : Args: (<pika.callback.CallbackManager object at 0x101045e10>, 1, <Basic.Deliver(['consumer_tag=ctag1.0', 'redelivered=False', 'routing_key=test100', 'delivery_tag=17853', 'exchange='])>), kwargs: {} | |
DEBUG 2012-10-19 14:29:51,873 pika.channel _on_basic_deliver 789 : Called with <METHOD(['frame_type=1', 'channel_number=1', "method=<Basic.Deliver(['consumer_tag=ctag1.0', 'redelivered=False', 'routing_key=test100', 'delivery_tag=17853', 'exchange='])>"])>, <Header(['frame_type=2', ' |
This file contains 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
fun toStr (xs:int list) = List.foldl (fn (i,s) => Int.toString(i) ^ " " ^ s) "" xs; | |
(* returns true if all test cases were successful, false otherwise *) | |
fun test name (results:bool list) : bool = | |
let fun checkT (t, (failed, total)) = | |
if t then (failed, total + 1) else ([total+1] @ failed, total + 1) | |
val (failed, total) = List.foldl checkT ([], 0) results | |
in case (failed, total) of | |
(x::xs, t) => (print ("> Failed " ^ name ^ " [" ^ toStr(failed) ^ "] (total " ^ Int.toString(t) ^")\n") ; false) | |
| (nil, t) => (print ("> Success " ^ name ^ " (total " ^ Int.toString(t) ^")\n"); true) |
This file contains 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
(deftheme mono-light | |
"Light monochrome theme") | |
(let ((class '((class color) (min-colors 10))) | |
(black "#080808") ; black | |
(white "#fafafa") ; "white" | |
(lgray "#b3b3b3") | |
(dgray "#303030") | |
(sgray "#606060") | |
(sgray+1 "#707070") |
This file contains 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
#include <map> | |
#include <iostream> | |
using namespace std; | |
int main(int argc, char *argv[]) { | |
// map of int -> string | |
// note that string is not included | |
map<int, std::string> m; | |
// assigning integer instead of string | |
// compiles just fine, sigh... |
OlderNewer