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
#lang racket | |
;; loops using continuations | |
(define infinite-loop | |
(lambda (proc) | |
(letrec ((loop (lambda () | |
(proc) | |
(loop)))) | |
(loop)))) |
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
-- list of numbers of form 2k | |
twoK = 1:(map (2*) twoK) |
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
(define (random-choice-probs ns n-probs) | |
(let ((x (random)) | |
(cum-prob 0.0) | |
(res (first ns))) | |
(define (inner) | |
(for ((item ns) | |
(item-prob n-probs)) | |
(begin | |
(set! cum-prob (+ cum-prob item-prob)) | |
(when (< x cum-prob) |
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
#lang lazy | |
(require racket/promise) | |
(define (port->lines p) | |
(let ((r (read-line p))) | |
(if (eof-object? r) | |
'() | |
(cons r (port->lines p))))) |
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
#lang racket | |
(require net/url) | |
(require (planet dherman/json:4:0)) | |
; Blekko API implementation | |
(struct blekko (queries api-key)) |
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
#!/bin/sh | |
# Clojure wrapper script. | |
# With no arguments runs Clojure's REPL. | |
# Put the Clojure jar from the cellar and the current folder in the classpath. | |
CLOJURE=$CLASSPATH:/usr/local/Cellar/clojure/1.4.0/clojure-1.4.0.jar:${PWD} | |
if [ "$#" -eq 0 ]; then | |
java -cp "$CLOJURE" clojure.main --repl | |
else |
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
""" | |
Alternatives to working with scipy | |
""" | |
import argparse | |
import csv | |
import numpy | |
import scipy.io as sio | |
import sys |
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 boost.mpi as mpi | |
def test_mpi_init(): | |
if mpi.rank == 0: | |
req = mpi.world.isend(1, 1, 1) | |
print '0 is done' | |
if mpi.rank == 1: | |
req = mpi.world.irecv(0, 1) | |
r = None |
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
""" | |
Given a large list of files and the number of processes, | |
this script will divide up the work, generate a list of condor_submit files, | |
submit them to condor and exit | |
""" | |
import argparse | |
import errno | |
import math | |
import os |
OlderNewer