Skip to content

Instantly share code, notes, and snippets.

View dettmering's full-sized avatar

Till Dettmering dettmering

View GitHub Profile
@dettmering
dettmering / ping.1m.py
Created January 30, 2019 08:12
BitBar plugin for showing host availability
#!/usr/local/bin/python3
import os
hosts = [
'google.com',
'microsoft.com'
]
header = []
@dettmering
dettmering / rpi-log.sh
Last active February 2, 2019 14:40
Log the RaspberryPi temperature to InfluxDB
#!/bin/bash
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
serial=$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2)
host="localhost:8086"
@dettmering
dettmering / docx2pdf.scpt
Created April 17, 2019 14:18
Apple Script to convert DOCX into PDF
on run {input, parameters}
tell application id "com.microsoft.Word"
activate
repeat with aFile in input
open aFile
set theOutputPath to ((aFile as text) & ".pdf")
tell active document
save as it file name theOutputPath file format format PDF
close saving no
end tell
@dettmering
dettmering / drawio-export-pdf.sh
Created July 11, 2019 09:56
draw.io: Export all .drawio files in folder to PDF and PNG while preserving history. Very useful as a post-commit hook.
#!/bin/bash
rm -f *.pdf
rm -f *.png
COMMIT=$(git rev-parse HEAD)
for f in *.drawio
do
/Applications/draw.io.app/Contents/MacOS/draw.io --export --all-pages --output $f.pdf $f
@dettmering
dettmering / cf-todoist.js
Created November 9, 2024 23:31
Cloudflare E-Mail Worker pushing to Todoist
export default {
async email(message, env, ctx) {
switch (message.to) {
case "[email protected]":
const taskContent = message.headers.get('subject'); // Use email subject as the task content
const requestBody = JSON.stringify({
content: taskContent,
due_string: "today",
due_lang: "en",
export default {
async email(message, env, ctx) {
switch (message.to) {
case "[email protected]":
let subject = message.headers.get('subject');
const todoist_project = 1234;
// Get the email body text
const emailText = await new Response(message.raw).text();