Skip to content

Instantly share code, notes, and snippets.

@khinsen
khinsen / debug.clj
Created December 11, 2009 09:38 — forked from ato/debug.clj
;; Slightly enhanced version of Alex Osborne's debug-repl (http://gist.github.com/252421)
;; Typing () quits the debug REPL, making it possible to continue without terminating the
;; input stream by typing Ctrl-D.
;; Inspired by George Jahad's version: http://georgejahad.com/clojure/debug-repl.html
(ns debug
[:require clojure.main])
(defmacro local-bindings
(ns fn-pre-post
(:refer-clojure :exclude (defn fn defn-)))
(clojure.core/defn- insert-arg
"Insert arg in the second position of the form cond."
[arg cond]
(cons (first cond) (cons arg (rest cond))))
(clojure.core/defn- parse-params
"Parse a parameter vector, possibly containing nested vectors for
## Type aliases for standard C types, introduced for better readability
typealias C_int Int32
typealias C_unsigned Uint32
typealias C_char Uint8
typealias C_unsigned_long_long Uint64
typealias C_size_t Uint64
####################
## HDF5 interface ##
@khinsen
khinsen / gist:3349551
Created August 14, 2012 14:06
Output of brew install -v llvm --with-clang
==> Downloading http://llvm.org/releases/3.1/llvm-3.1.src.tar.gz
Already downloaded: /Library/Caches/Homebrew/llvm-3.1.tar.gz
/usr/bin/tar xf /Library/Caches/Homebrew/llvm-3.1.tar.gz
Error: can't convert nil into String
Please report this bug:
https://github.com/mxcl/homebrew/wiki/bug-fixing-checklist
/usr/local/Library/Homebrew/formula_support.rb:210:in `+'
/usr/local/Library/Homebrew/formula_support.rb:210:in `include?'
/usr/local/Library/Formula/llvm.rb:31:in `install'
/usr/local/Library/Homebrew/build.rb:102:in `install'
@khinsen
khinsen / gist:3810448
Created October 1, 2012 09:03
A challenge for typed Clojure
; A simple example for using the writer monad
(domonad (writer-m "")
[x (m-result 1)
_ (write "first step\n")
y (m-result 2)
_ (write "second step\n")]
(+ x y))
; where write (defined in algo.monads) is:
@khinsen
khinsen / vote_counting_parallel.py
Created November 16, 2012 09:12
Solution modèle pour la parallélisation du comptage des votes
from Scientific.DistributedComputing.MasterSlave \
import MasterProcess, SlaveProcess, runJob
votes = 20*['A'] + 25*['B'] + 22*['C']
chunk_size = 10
class Master(MasterProcess):
def run(self):
@khinsen
khinsen / contact with quote in name
Created March 19, 2013 20:59
Import this file into Google Contacts, then sync with BBDB. The resulting BBDB entry has a syntax error.
Name,Given Name,Additional Name,Family Name,Yomi Name,Given Name Yomi,Additional Name Yomi,Family Name Yomi,Name Prefix,Name Suffix,Initials,Nickname,Short Name,Maiden Name,Birthday,Gender,Location,Billing Information,Directory Server,Mileage,Occupation,Hobby,Sensitivity,Priority,Subject,Notes,Group Membership,E-mail 1 - Type,E-mail 1 - Value,Phone 1 - Type,Phone 1 - Value,Address 1 - Type,Address 1 - Formatted,Address 1 - Street,Address 1 - City,Address 1 - PO Box,Address 1 - Region,Address 1 - Postal Code,Address 1 - Country,Address 1 - Extended Address,Organization 1 - Type,Organization 1 - Name,Organization 1 - Yomi Name,Organization 1 - Title,Organization 1 - Department,Organization 1 - Symbol,Organization 1 - Location,Organization 1 - Job Description,Website 1 - Type,Website 1 - Value,Custom Field 1 - Type,Custom Field 1 - Value,Custom Field 2 - Type,Custom Field 2 - Value
"Hotel Alla Salute ""da Cici""",Hotel,"Alla Salute ""da","Cici""",,,,,,,,,,,,,,,,,,,,,,,* My Contacts ::: Hotels,* Work,info@hotelsa
N 3.236 10.179 10.421
C 2.383 10.507 9.245
C 2.368 12.012 9.049
O 2.360 12.771 10.026
C 0.961 10.028 9.504
C -0.075 10.525 8.529
C -1.438 10.097 9.018
C -2.558 10.727 8.225
N -2.527 10.331 6.797
N 2.444 12.442 7.796

Keybase proof

I hereby claim:

  • I am khinsen on github.
  • I am khinsen (https://keybase.io/khinsen) on keybase.
  • I have a public key ASCSrP4D-AfLbU4M8xcDQd53ZZMyxIjutYBftEExkUe9oAo

To claim this, I am signing this object:

@khinsen
khinsen / markdown-notes.org
Created November 6, 2018 14:26
An org-mode document containing markdown notes

Markdown notes inside org-mode

The command org-babel-tangle will produce a file notes.md containing only the Markdown blocks from this file.

This is the first Markdown block:

# A section