Skip to content

Instantly share code, notes, and snippets.


Simon Lundmark simlun

View GitHub Profile
simlun /
Created Dec 14, 2015
Collect inotify statistics for each root directory
sudo sysctl fs.inotify.max_user_watches=524288
sudo inotifywait -r -m --format "%e;%w%f" /bin /boot /etc /home /lib /lib64 /opt /root /sbin /srv /tmp /usr /var | ./

Keybase proof

I hereby claim:

  • I am simlun on github.
  • I am simlun ( on keybase.
  • I have a public key whose fingerprint is 3831 9AC1 51D6 ABD9 9D63 AA11 FC2C 138A 3B94 9A0F

To claim this, I am signing this object:

simlun / vnc-connection.command
Created Jul 30, 2014
Connect to an x11vnc server over an SSH tunnel from a Mac
View vnc-connection.command
# Tip: An executable script given a `.command` suffix will be double-clickable on Mac OS X
# This is the RealVNC Viewer, works with Chicken of the VNC too
simlun / raspi-monitor
Last active Mar 2, 2021
Script to enable and disable the HDMI signal of the Raspberry PI
View raspi-monitor
#!/bin/bash -e
# /usr/local/sbin/raspi-monitor
# Script to enable and disable the HDMI signal of the Raspberry PI
# Inspiration:
function on {
/opt/vc/bin/tvservice --preferred
simlun /
Last active Jan 3, 2016
Compare MD5 checksums for all files in a local Dropbox directory with a remote one. Use for example to reconcile your Dropbox directory between your laptop and workstation. You will be surprised over what you may find... Script was written for Mac OS X. You must of course have "Remote Login" enabled (System Preferences/Sharing).
#!/bin/bash -ex
# Example usage:
# $ ./
EXCLUDES="-name '*.DS_Store' -or -path './.dropbox.cache*' -or -name 'Icon*' -or -name .dropbox"
simlun / diff
Created Mar 16, 2013
socket recv's may raise EAGAIN, unlike any other platform Fix for recognizing gdbm 1.9.x databases; already upstream:
View diff
diff --git a/Lib/ b/Lib/
index bd364e7..fd432f6 100644
--- a/Lib/
+++ b/Lib/
@@ -92,6 +92,7 @@ except ImportError:
errno = None
EBADF = getattr(errno, 'EBADF', 9)
EINTR = getattr(errno, 'EINTR', 4)
+EAGAIN = getattr(errno, 'EAGAIN', 35)
simlun / gist:4405824
Created Dec 29, 2012
!cleancode Clojure solution to Project Euler problem number 74
View gist:4405824
(defn euler074 [up-to chain-len] (let [right-chain-len? #(= chain-len (count %))
start-nrs (range 1 (inc up-to))] (count (filter right-chain-len? (map (fn
[start-nr] (loop [chain #{start-nr} prev-trm start-nr] (let [next-trm (reduce +
(map (memoize (fn [n] (if (= n 0) 1 (reduce * (range 1 (inc n)))))) (map #(-
(int %) (int \0)) (str prev-trm))))] (if (contains? chain next-trm) chain (recur
(conj chain next-trm) next-trm))))) start-nrs)))))
(euler074 1000000 60)
simlun /
Created Nov 5, 2012
Download script for the SICP videos
set -e
#DOWNLOAD_COMMAND='curl -s -S -C - -L -O'
DOWNLOAD_COMMAND='wget --quiet --continue'
one-word-per-line() {
xargs -n 1 echo $@
View euler.clj
(ns euler002.euler)
(defn- fib-fast
[i a b limit]
(< i limit)
(fib-fast (inc i) b (+ a b) limit)
(defn fib
View euler.clj
(ns euler001.euler)
(defn- zerorem?
[numer denom]
(= 0 (rem numer denom)))
(defn divis?
(zerorem? a 3)