Skip to content

Instantly share code, notes, and snippets.

@mschwld
mschwld / dewpoint.py
Created August 20, 2022 10:09
Python Dewpoint from Temperature and Humidty, Celcius
#!/usr/bin/env python
import math
def dewpoint(r,T):
if(T<=0):
raise ValueError('Algorithm not suitable for the given temperature')
return (b * (math.log( (r/100)*6.1078*(10**((a*T)/(b+T))) /6.1078,10) ) /
(a - (math.log( (r/100)*6.1078*(10**((a*T)/(b+T))) /6.1078,10) )))
@mschwld
mschwld / gist:0cc004a61c98493e203ae2adc563f75b
Created June 16, 2022 20:21
Create an HTML table of pdf files from a dir alongside an image of each first page
#!/usr/bin/env bash
BASEPATH="$1"
BASEPATH_ABS=${BASEPATH:0:1}
# config
TITLE="My Library"
[ ! "$BASEPATH_ABS" = "/" ] && echo "Not an absolute path: $BASEPATH" && exit 1
[ ! -d "$BASEPATH" ] && echo "Not a folder: $BASEPATH" && exit 1
@mschwld
mschwld / gist:b47bfc37f73329a7a10f51377998e84f
Last active November 21, 2023 06:06
Simple mpd bookmarks
#!/usr/bin/env bash
function DEPENDENCY_CHECKS {
for dep in $@; do
if ! hash "$dep" 2>/dev/null 1>&2; then echo "$dep not found in \$PATH. Abort." && exit 1; fi
done
}
DEPENDENCY_CHECKS mpc
MPC_OPTS="--port 6601"
from keybow_hardware.pim56x import PIM56X as Hardware
from keybow2040 import Keybow2040
import supervisor
import time
import usb_cdc
keybow = Keybow2040(Hardware())
keys = keybow.keys
uart = usb_cdc.serials[1]
@mschwld
mschwld / README.md
Last active October 22, 2021 19:30
Use an Akai LPD8 to launch executables

About

You can use this Rust program to make any interaction with your MIDI controller (like an Akai LPD8) trigger various actions on your system, like controlling the audio volume or start a mail sync. You will need midir (https://crates.io/crates/midir) for this to work. This approach is tested on a Linux based OS only.