Skip to content

Instantly share code, notes, and snippets.

Samuel John samueljohn

Block or report user

Report or block samueljohn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@samueljohn
samueljohn / initial-setup.sh
Created Mar 24, 2015
Uberspace initial setup (zsh)
View initial-setup.sh
cd
git clone https://github.com/samueljohn/__settings__.git
rm ~/.zshrc
rm ~/.bashrc
cd ~/__settings__
source setup_symlinks.sh
chsh -s /package/host/localhost/zsh/bin/zsh
# Logout and login again. Done.
@samueljohn
samueljohn / samuels_python3_setup.md
Last active Jan 3, 2020
For my own reference. Brewed Python3, numpy, scipy and the rest goes in a pyvenv.
View samuels_python3_setup.md

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.


View HookHandler.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import BaseHTTPServer
import sys
import time
import urlparse
import json
@samueljohn
samueljohn / print_tree.py
Created Apr 29, 2014
Print a nice text tree of nested python objects.
View print_tree.py
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.
print_item:
The function applied to items in the tree.
Default `str`.
@samueljohn
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
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
autocrlf = false
[color]
branch = auto
status = auto
@samueljohn
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
samueljohn / README.md
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…
View README.md

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 fifo_demo.py how to use a thread to generate audio and fill the queue.

@samueljohn
samueljohn / vtk-qt-demo.py
Created Jul 11, 2012 — forked from fmorency/gist:2596951
VTK Qt/PySide Python example
View vtk-qt-demo.py
"""
A simple example that uses the QVTKRenderWindowInteractor
class.
"""
try:
from PySide import QtCore, QtGui
except ImportError:
try:
from PyQt4 import QtCore, QtGui
You can’t perform that action at this time.