Skip to content

Instantly share code, notes, and snippets.

View jens-a-e's full-sized avatar

jens alexander ewald jens-a-e

View GitHub Profile
// A one liner to convert a decimal MIDI note pitch to human readable notation
const midiNote2Name = (i, offset=-2) => `${["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][i%12]}${Math.floor(i / 12) + offset}`
@jens-a-e
jens-a-e / zettelfix.sh
Created November 8, 2022 16:25
This script prefixes every Markdown file in the current directory with the timestamp of its birth.
#!/bin/sh
# This script prefixes every Markdown file in the current directory with the timestamp of its birth.
# Such a prefix is common in file based note taking systems such as digital Zettelkasten.
# Future improvements could check if the timestamp exists to avoid duplication.
for file in *.md; do mv $file $(stat -f %SB-%N -t '%Y%m%d%H%M%S' $file); done
# Recursively remove the 'Icon?' file from an orphaned GoogleDrive folder
find . -name 'Icon?' -type f -print -exec rm -rf '{}' \;

Raspberry Pi Notes

# Final Version to launch on second screen. The spaces in the options with ":" are important!
vlc v4l2:///dev/video0:input=0 :v4l2-standard=PAL :input-slave=pulse://alsa_input.usb-Hauppauge_Hauppauge_Device_0014080666-01.stereo-fallback :live-caching=300 --demux rawvideo --qt-fullscreen-screennumber=1 --aspect-ratio=16:9 --autoscale --fullscreen

There is some more from the VLC gui:

# Meditating on Steve
# -------------------
# Modified Piano Phase from Steve Reich, based on an Example of Sonic Pi
# Written by Jens, listened to by all
# Muthesius Academy of Fine Arts & Design
# Seminar 'Poetische Apparate', Summer Term 2016
#
# To run: paste this code into Sonic Pi - http://sonic-pi.net
use_synth :fm
@jens-a-e
jens-a-e / Bars.ino
Created March 27, 2013 15:54
Attaching multiple instances of class to an interrupt in Arduino
/*
An approach on using attachInterrupt with multiple instances of a class
jens@lea.io, march 2013
*/
// *** The following classes should be put into external files...
#define MAX_IRQ_CLASSES 8
boolean withinPosition(float lat, float lon, float tolarance) {
float gpsLat, gpsLong;
// read gps...
tolarance = tolarance / 1000.0; // 10 => 0.0010
// Check position within tolarance
boolean isLat = lat >= gpsLat - tolarance && lat <= gpsLat+tolarance;
boolean isLon = lon >= gpsLon - tolarance && lon <= gpsLong+tolarance;
return isLat && isLon;
}
@jens-a-e
jens-a-e / js-cheatsheet.md
Created November 10, 2017 08:57
Javascript Cheatsheet

JS Cheatsheet

Coding Basics

Bevor es losgeht, ein paar hilfreiche Tips, die das Schreiben von Javascript Code erleichtern können:

//

Zwie / leiten einen Kommentar ein, nutze es Zeilen auszuschalten oder Kommentare einzufügen.

@jens-a-e
jens-a-e / install_nokogiri.sh
Created December 6, 2013 16:28
Install nokogiri 1.5.10 on a synology DSM 4.3
# Make sure you have installed libxml2 via IPKG before like this:
# ipkg update && ipkg install libxml2
gem install nokogiri --version 1.5.10 -- --with-xml2-include=/opt/include/libxml2 --with-xml2-lib=/opt/lib
@jens-a-e
jens-a-e / keybase.md
Created February 10, 2017 10:40
keybase.md

Keybase proof

I hereby claim:

  • I am jens-a-e on github.
  • I am notaus (https://keybase.io/notaus) on keybase.
  • I have a public key ASAne364bc_84s8Yu9IWX6AjSvmw2cW_0Sv1LVhYZJoKZQo

To claim this, I am signing this object: