Skip to content

Instantly share code, notes, and snippets.

View mpenet's full-sized avatar
🪲
breeding bugs

Max Penet mpenet

🪲
breeding bugs
View GitHub Profile
@simonmichael
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@erluko
erluko / ReturningException.java
Created November 19, 2011 23:09
Example of potential performance benefit of early exit in reduce
/* don't use this, it's just for a timing demonstration */
public class ReturningException extends RuntimeException {
transient public final Object data;
transient public final Object context;
public ReturningException(Object o){
this(null, o);
}
public ReturningException(Object c, Object o){
super("Not really an exception");
@jlongster
jlongster / gist:1979842
Created March 5, 2012 17:50
Outlet meta-circular evaluator
;; Requires Outlet to run: https://github.com/jlongster/outlet
;;
;; Run with: `ol main.ol <input-file>`
;;
;; This is a meta-circular evaluator for a basic Lisp. It is
;; mostly taken from SICP 4.1*. I wanted to see if I could write a
;; debugger with it. Turns out if I want control over control flow I
;; need a register-based interpreter.
;;
;; * http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-26.html#%_sec_4.1
(defmacro let-pipeline [decls & body]
(let [pairs (partition 2 decls)
vars (map first pairs)
exprs (map second pairs)
predecessors (map #(take % vars) (range (count vars)))]
`(let [~@(mapcat
(fn [v preds expr]
`[~v
(run-pipeline (merge-results ~@preds)
(fn [[~@preds]] ~expr))])
@liquidz
liquidz / core.clj
Created April 16, 2012 14:54
Clojure1.4 Reader Literals Test
(ns myreader.core
"Reader Literals Test"
(:require [clojure.string :as str]))
(defn debug-print
"Gauche debug print"
[x]
`(let [res# ~x]
(println "?=" res#)
res#))
@mpenet
mpenet / org.css
Created April 24, 2012 21:05
org-mode html export blu'ish theme
body {
margin: 1em;
border-right: 5px solid #bbb;
border-bottom: 5px solid #bbb;
padding: 0;
background: #ddd none repeat scroll 0 0;
border: 1px solid #000;
margin: 0;
padding: 2em;
color: #333;
@rrnewton
rrnewton / meta-par-accelerate_blog_post.lhs
Created May 4, 2012 19:19
meta-par-accelerate blog post
> module Main where
How to write hybrid CPU/GPU programs with Haskell
-------------------------------------------------
What's better than programming a GPU with a high-level,
Haskell-embedded DSL (domain-specific-language)? Well, perhaps
writing portable CPU/GPU programs that utilize both pieces of
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
; Original problem here : http://www.4clojure.com/problem/144
; This first solution works but is incomplete as fs needs to be repeated.
(defn osci-incomplete [v & fs]
(reduce (fn [accu elt] (conj accu (elt (last accu))))
[v] fs))
; Problem is that cycling fs leads to timeout.
@zyegfryed
zyegfryed / install.sh
Created August 24, 2012 09:24
pystatsd installation script
apt-get install python-pip
pip install pystatsd
cat > /etc/default/statsd <<EOF
STATSD_PORT=8125 # port to run on (default: 8125)
PCT=90 # stats pct threshold (default: 90)
GRAPHITE_HOST=localhost # host to connect to graphite on (default: localhost)
GRAPHITE_PORT=2003 # port to connect to graphite on (default: 2003)
USER=nobody # user to run statsd as