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:

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 / 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:

@jens-a-e
jens-a-e / README.md
Last active February 1, 2017 11:27
Run Gitlab with Docker Compose

Running Gitlab using Docker Compose

This example also works on a current Synology. For a basic instance without email do the following:

(Assuming your main HD is on /volume1)

SSH onto your Syn: ssh admin@<your-syno.local>

@jens-a-e
jens-a-e / controllers.application.js
Last active September 12, 2016 20:55
TickerService
import Ember from 'ember';
export default Ember.Controller.extend({
ticker: Ember.inject.service(),
appName: 'Ticker',
_autoStart: Ember.on('init', function() {
this.get('ticker').start();
console.log("Auto starting ticker");
}),
actions: {
// Download the sound library here: https://github.com/processing/processing-sound/releases
import processing.sound.*;
SoundFile file;
void setup() {
file = new SoundFile(this, "volkstheater.aiff");
file.loop();
}