Skip to content

Instantly share code, notes, and snippets.

View stahlnow's full-sized avatar
👽
I killed the flame to enable dark mode

stahl stahlnow

👽
I killed the flame to enable dark mode
View GitHub Profile
@stahlnow
stahlnow / README.md
Created January 13, 2024 12:36 — forked from jonathantneal/README.md
Nearest Normal Ratio Calculator

Nearest Normal Aspect Ratio

This function returns the nearest aspect ratio of a width and height within a limited range of possible aspect ratios.

In other words, while 649x360 technically has an aspect ratio of 649:360, it’s often useful to know that the nearest normal aspect ratio is actually 9:5 (648x360).

nearestNormalAspectRatio(width, height, [side], [maxWidth], [maxHeight])
@stahlnow
stahlnow / DBus-spotify
Created January 30, 2020 18:41 — forked from notdodo/DBus-spotify
Python script to interact with DBus MediaPlayer2 interface, used by Spotify, VLC, mpd, MPlayer, etc (Info, Play/Pause, Next, Prev, Stop)
#!/usr/bin/env python3
# Author: edoz90
import sys
try:
# http://click.pocoo.org/5/why/
import click
import dbus
from colored import fg, stylize
except:
print("Need to install click, dbus-python and colored")

Keybase proof

I hereby claim:

  • I am stahlnow on github.
  • I am stahl303 (https://keybase.io/stahl303) on keybase.
  • I have a public key ASCF7w7T3o1evq-tPxDeUrNNnQFkYwjOZ18Zwm-hOmDPngo

To claim this, I am signing this object:

@stahlnow
stahlnow / main.c
Created March 19, 2013 09:18 — forked from funkfinger/main.c
// based largely on Atmel's AVR136: Low-Jitter Multi-Channel Software PWM Application Note:
// http://www.atmel.com/dyn/resources/prod_documents/doc8020.pdf
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define CHMAX 3 // maximum number of PWM channels
#define PWMDEFAULT 0x00 // default PWM value at start up for all channels