Skip to content

Instantly share code, notes, and snippets.

View cfstras's full-sized avatar

Claus F. Strasburger cfstras

  • Düsseldorf, Germany
  • 15:28 (UTC +02:00)
View GitHub Profile
@cfstras
cfstras / Windows Docker on Mac.md
Last active June 5, 2019 12:25
Installing a Windows based Docker host in a Vagrant VM

For mac and linux

  • install vagrant docker-machine with windows
# Mac:
brew cask install vagrant
# Linux (Debian):
apt-get install vagrant
@cfstras
cfstras / watch-output.sh
Last active March 26, 2019 17:39
Simple bash function to watch the output of a command and show it when the output changes
function watch_change() {
local stat
local oldstat
local lasttime
lasttime=$SECONDS
while true; do
stat="$(eval "$@")"
if [[ "$stat" != "$oldstat" ]]; then
oldstat="$stat"
diff=$((SECONDS-lasttime))
@cfstras
cfstras / Make nice documents using Pandoc.md
Last active March 14, 2019 19:47
Make nice documents using Pandoc

example generated commandline:

pandoc -t beamer -f markdown  -o "presentation.pdf" "document.md"

pandoc -s --katex -t html5 -f markdown --css ../pandoc.css \
 --pdf-engine-opt='--print-media-type' \
/**
* I used to have this code configured in Eclipse (and later IntelliJ) as a custom display function for ByteBuffers.
* It's fairly useful for debugging binary protocol decoders that make heavy use of ByteBuffers.
*/
ByteBuffer d = this;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < d.limit; i++) {
sb.append(String.format(" %02x", d.array()[i]));
}
sb.append("\n");
@cfstras
cfstras / 0_Mirror a repository using GitLab CI.md
Last active March 7, 2025 03:32
How to mirror a repository using GitLab CI

Mirroring a repository using GitLab CI

inspired by https://gitlab.com/freifunkks/mirror-scripts

This can be used, for example, to clone a repository living on github over to GitLab in order to run CI

Setup

  • Setup separate repository with mirror scripts. We'll call it "mirror-scripts"
  • push the two files below.
  • in the .gitlab-ci.yml replace MY_REPO with your repo name
@cfstras
cfstras / easy_extract.sh
Created July 17, 2018 13:47
for your zshrc/bashrc. the shortest extract command there ever was
x () {
while [ -f "$1" ]; do
case "$1" in
*.tar.bz2) ;&
*.tar.xz) ;&
*.tar.gz) ;&
*.tar) ;&
*.tbz2) ;&
*.tgz) ;&
*.txz)
Note:
I wrote this in 2018 as part of a Hackathon for https://github.com/anuejn/muzikilo.js.
Upon reviewing just now, there seems to be a bug in the Decay-logic which makes every note work only once.
It's up to the reader to find and fix this bug ;)
If you do, please e-mail me the fix!
@cfstras
cfstras / launchpad.py
Created June 3, 2018 21:43
Launchpad midi example with particles and Leap-motion integration
import threading
import time
import mido
callbacks = []
particles = []
particles_lock = threading.Lock()
def clamp(v, min, max):
@cfstras
cfstras / shepard.js
Last active January 30, 2024 17:22
Shepard tone with muzikilo.js
// https://github.com/anuejn/muzikilo.js
const {sin, PI, round, pow, abs, floor, exp} = Math
this.t += 1/44100
const sine = (name, f) => {
let phi = this[name] += 1/44100 * 2 * PI * f * saw(name+10000,f*0.5)
this[name] %= 2*PI
return sin(phi)
}
@cfstras
cfstras / .SRCINFO
Last active February 28, 2018 08:45
ncurses-6.0-9 stable PKGBUILD. Temporary downgrade to fix https://github.com/nsf/termbox-go/issues/185
pkgbase = ncurses
pkgdesc = System V Release 4.0 curses emulation library
pkgver = 6.0
pkgrel = 0
url = http://invisible-island.net/ncurses/ncurses.html
arch = i686
arch = x86_64
license = MIT
depends = glibc
depends = gcc-libs