Skip to content

Instantly share code, notes, and snippets.

samueljohn /
Created Mar 24, 2015
Uberspace initial setup (zsh)
git clone
rm ~/.zshrc
rm ~/.bashrc
cd ~/__settings__
chsh -s /package/host/localhost/zsh/bin/zsh
# Logout and login again. Done.
samueljohn /
Last active Jan 3, 2020
For my own reference. Brewed Python3, numpy, scipy and the rest goes in a pyvenv.

Samuel's Python3 setup for Mac:

This document describes in which way, what packages, and from where are installed on my Macs to get a decent Python 3.x, scipy/numpy & Co setup.

Note, I switched to Python's 3.x pyvenv from virtualenv in order to handle my pip-installable packages. Also thanks to Anaconda, the whole setup is so simple now that I use this document just to remember which additional packages I like.

#!/usr/bin/env python
#-*- coding:utf-8 -*-
import BaseHTTPServer
import sys
import time
import urlparse
import json
samueljohn /
Created Apr 29, 2014
Print a nice text tree of nested python objects.
def print_tree(tree, prefix=[], last_prefix="", print_item=str):
Return a string where each line represents one item of tree.
prefix and last_prefix are used internally.
The function applied to items in the tree.
Default `str`.
samueljohn / config
Last active Dec 21, 2015
This is how I use two remotes "origin" and "samuel" and have the master branch use origin so `brew update` works as usual. When I want to contribute, I use: `git checkout -b my_new_feature` and then `git push --set-upstream samuel my_new_feature` to push it to my own fork ("samuel") of homebrew.
View config
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
autocrlf = false
branch = auto
status = auto
samueljohn / gist:5280700
Last active Dec 15, 2015
Moving homebrew formulae from one repo (mxcl/master) into another one... Based on @jacknagel's instructions.
View gist:5280700
diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://1048576`
cd $(brew --repository)
git checkout -b moveit
git filter-branch --prune-empty --index-filter 'git ls-files --full-name --cached | grep -F --invert-match --file=/tmp/list --color=never | xargs git rm --quiet --cached --ignore−unmatch' --subdirectory-filter 'Library/Formula' -d /Volumes/ramdisk -f moveit
cd the-target-repro
samueljohn /
Last active Mar 4, 2017
Hacking a FIFOPlayer into Pyo. Yay. Pumping numpy arrays to the soundcard (or do some post-processing or mixing first)! Pyo is a fantastic sound processing library. To test this, copy these files into a freshly checked out pyo repository into pyo/externals. Then build pyo from source. In the long(er) run, I'd love to provide this to upstream. Cr…

We (Samuel John and Thomas Hermann) added a FIFOPlayer to Pyo, allowing you to directly (and almost copy-free) play numpy Arrays. See help(pyo.FIFOPlayer)! Output should be scaled [-1.0,1.0] (roughly).

See how to use a thread to generate audio and fill the queue.

samueljohn /
Created Jul 11, 2012 — forked from fmorency/gist:2596951
VTK Qt/PySide Python example
A simple example that uses the QVTKRenderWindowInteractor
from PySide import QtCore, QtGui
except ImportError:
from PyQt4 import QtCore, QtGui