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 script analyzes the dependencies between top level types in a .NET Assembly. | |
It is then used to compare the dependency relationships in some F# projects with those in some C# projects. | |
Note that no attempt has been made to optimize the code yet! | |
REQUIRES: | |
* Mono.Cecil for code analysis | |
From http://www.mono-project.com/Cecil#Download |
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 | |
;; A solver for the following puzzle: | |
;; Given 5 integers a, b, c, d, and e, | |
;; find an expression that combines a, b, c, and d with arithmetic operations (+, -, *, and /) to get e. | |
(require srfi/1) | |
(define ops '(+ - * /)) |
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
(ns ^{:doc "Evaluator from ch1 of lisp in small pieces. Warning: | |
NON-IDIOMATIC clojure!"} | |
lisp.chapter1.eval | |
(:refer-clojure :exclude [extend])) | |
(defn wrong [& msgs] | |
(throw (RuntimeException. (apply str msgs)))) | |
;; -- runtime support, environments are represented as a seq of pairs, | |
;; -- stored in an atom. Non-idiomatic but faithful to the book. |
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
(defun remote-shell-fav-hosts-get () | |
"My hook to the remote-shell processes in order to connect to | |
my OpenStack controller, and create a hashtable of host names as | |
the keys, and IP addresses as the values." | |
(interactive) | |
;; Run nova list command remotely on this host system, and put the | |
;; results in a temp buffer: | |
(let* ((undercloud-controller "10.98.1.145") | |
(default-directory (format "/ssh:%s:" undercloud-controller)) |
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
Lazy, infinite recursive sequences in Bash (like in Haskell, if you squint). | |
I was inspired by the beautiful Haskell zipWith implementation of the Fibonacci sequence `fibs = 0 : 1 : zipWith (+) fibs (tail fibs)` | |
to find an equivalent in bash using 'coroutines' and recursive pipes. | |
My original experiments were https://twitter.com/tavisrudd/status/367164339716751360 | |
"fun w/ recursive pipes: e=echo;mkfifo fib;{ $e 0 1 1 >fib &};{ while read i j k; do $e $i >&2; $e $j $k $(($j+$k));sleep .4; done;}<fib>fib" | |
and https://twitter.com/tavisrudd/status/367142071489937408 | |
"o=ouro;b=boros;mkfifo $o$b;e=echo; { $e $o > $o$b & }; { while read s;do $e $s>&2;case $s in $o)$e $b;;*)$e $o; esac; done; }<$o$b >$o$b" |
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
From welch@thor.oar.net Thu Oct 20 16:53:41 EDT 1994 | |
Article: 15160 of comp.lang.lisp | |
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!usenet.eel.ufl.edu!usenet.cis.ufl.edu!caen!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ns.mcs.kent.edu!kira.cc.uakron.edu!malgudi.oar.net!malgudi.oar.net!welch | |
From: welch@thor.oar.net (Arun Welch) | |
Newsgroups: comp.lang.lisp | |
Subject: CL History (was Re: Why do people like C?) | |
Date: 20 Oct 94 15:34:10 | |
Organization: OARnet | |
Lines: 3244 | |
Message-ID: <WELCH.94Oct20153410@thor.oar.net> |
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 (cc k) (call-with-current-continuation k)) | |
(display (format ">>> ~s\n" (- 10 (cc (lambda (k) (+ 1 (+ 2 (k 10)))))))) | |
(let ((k (cc (lambda (bind) (lambda (x) (+ 1 (cc (lambda (k) (bind k))))))))) (k 10)) | |
(let ((k (cc (lambda (bind) | |
(lambda (x) | |
(+ 1 (cc (lambda (k) | |
(bind k))))))))) | |
(k 10)) |
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 numpy as np | |
# The Fibonacii matrix | |
M = np.array([[0, 1], [1, 1]], dtype=np.float32) | |
# Compute the eigendecomposition of the matrix | |
w, v = np.linalg.eig(M) | |
inv_v = np.linalg.inv(v) | |
base_case = np.array([0, 1]).T # base case as a column vector |
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
// Works as expected... if one gets it to compile | |
#include <libzfs.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int zp_iter(zpool_handle_t *z, void *a) { | |
printf("name:\t%s\n", zpool_get_name(z)); | |
return 0; | |
} |
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
extern mod std; | |
fn lt<T: Ord>(a: Option<T>, b: Option<T>) -> bool { | |
match (a, b) { | |
(None, None) => false, | |
(None, Some(_)) => true, | |
(Some(_), None) => false, | |
(Some(a), Some(b)) => a < b | |
} | |
} |