Skip to content

Instantly share code, notes, and snippets.

View dnnsmnstrr's full-sized avatar
:shipit:

Dennis Muensterer dnnsmnstrr

:shipit:
View GitHub Profile
@dnnsmnstrr
dnnsmnstrr / btt.sh
Created August 1, 2021 18:58
Launch BetterTouchTool's named triggers from the command line. Requires the BTT webserver interface to be active.
#!/bin/bash
if [ -z "$1" ]
then
echo "No trigger supplied"
exit
fi
curl "http://127.0.0.1:12345/trigger_named/?trigger_name=$*"
@dnnsmnstrr
dnnsmnstrr / camera.py
Created March 13, 2021 15:39
Takes a picture using the raspberry pi camera and saves the resulting image with datetime filename
from picamera import PiCamera
import time
import os
camera = PiCamera()
camera.start_preview()
time.sleep(3)
currentTime = time.strftime("%Y-%m-%d-%T")
@dnnsmnstrr
dnnsmnstrr / datetime.py
Last active March 11, 2021 18:03
Displays the full date and time on a waveshare e-paper display (2.13in V2)
#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
import os
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic')
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib')
if os.path.exists(libdir):
sys.path.append(libdir)
import logging
@dnnsmnstrr
dnnsmnstrr / response.json
Last active February 3, 2023 11:08
My playlists on Spotify available via a custom personal API. (the response.json is the data source)
{
"current": "https://open.spotify.com/playlist/3YKHRGx3OoWO2tRe3Duorm?si=24f725b6776a41fa",
"chill": "https://open.spotify.com/playlist/0x0ZQcmLsamIx5bF5px2Tc?si=JRKDeoYdS02T66Lhlo7V_w",
"spring": "https://open.spotify.com/playlist/68z163CKUImi0QB6ZpSigr?si=H-rEE3kMQ8WcEfgg-c6iQw",
"summer": "https://open.spotify.com/playlist/5wpb3PdQOzFb3jurTcVfZO?si=vMQ-JzRIRNqgCeGFTIZrXQ",
"autumn": "https://open.spotify.com/playlist/22XncHS02W5RWJ1yM4lV6l?si=2yW8i1WbSp6kk5gjEHXMIQ",
"winter": "https://open.spotify.com/playlist/67SvJfEofXhdIXwsuUJbCJ?si=DWOzFjMqQkqokKPueAGZaA",
"sleep": "https://open.spotify.com/playlist/13RQxSzWqVg3fHlalxlyhC?si=x8ppL0ZuSjKv8if8dQM39g",
"coding": "https://open.spotify.com/playlist/0camicGxGNwB9YS66nAwtb?si=ZpBdqb-7RWiDIiRt0g-asw",
"sports": "https://open.spotify.com/playlist/4X1uZRUIccnwcofS8QjBku?si=MK9RWVXWQaShcaiuyfJx6A",
# Say a random curseword
function cuss () {
CUSS_WORDS=("fuck" "shit" "bitch" "asshole" "motherfucker" "cunt")
VOICES=("Albert" "Zarvox" "Alex" "Bad News" "Deranged" "Trinoids" "Hysterical")
RANDOM_VOICE=${VOICES[$( jot -r 1 0 $((${#VOICES[@]} - 1)) )]}
CUSS=${CUSS_WORDS[$( jot -r 1 0 $((${#CUSS_WORDS[@]} - 1)) )]}
echo $CUSS
say ${1:-$CUSS} -v ${2:-$RANDOM_VOICE}
}
@dnnsmnstrr
dnnsmnstrr / snippets.md
Last active September 28, 2020 06:07
Shell Snippets

Shell Snippets

Most of these should work in bash and/or zsh

macOS

Get network location

CURRENT_LOCATION=$(scselect | tail -n +2 | egrep '^\ +\*' | cut -d \( -f 2- | sed 's/)$//')
@dnnsmnstrr
dnnsmnstrr / index.html
Last active September 14, 2020 19:26 — forked from labnol/index.html
Website in iFrame
<iframe src="https://muensterer.xyz" width="1920" height="1080" frameborder="0" style="border:0"></iframe>
@dnnsmnstrr
dnnsmnstrr / projects.md
Last active July 3, 2023 20:05
Projects
@dnnsmnstrr
dnnsmnstrr / gist-as-api.md
Last active January 1, 2021 12:07
Use Gist as a data source for your API

This snippet allows you to extract json content from a gist file to be served via an api. Replace id with the id from your gist's url and modify the filename if you don't want to use the default response.json.

export default async (id = 'a36fa8e855b19e9ebddb8a2878103b04', filename = 'response.json') => {
  const gistUrl = 'https://api.github.com/gists/' + id
  const response = await fetch(gistUrl)
  const { files } = await response.json()
  return JSON.parse(files[filename].content)
}
[
"fuck",
"shit",
"bitch",
"motherfucker",
"fuckface",
"dick",
"twat",
"dickhead"
]