Skip to content

Instantly share code, notes, and snippets.

@marco79cgn
marco79cgn / spotify-now-playing.js
Last active October 29, 2024 11:18
A Scriptable iOS widget that shows what‘s playing on Spotify
let spotifyCredentials
let widget = await createWidget()
Script.setWidget(widget)
Script.complete()
async function createWidget() {
let widget = new ListWidget()
let spotifyIcon = await getImage("spotify-icon.png")
widget.backgroundColor = new Color("1e2040")
@marco79cgn
marco79cgn / youtube-cobalt-tools-safari.js
Created October 25, 2024 13:44
Tampermonkey script which adds a cobalt.tools button to each YouTube video page in Safari (macOS)
// ==UserScript==
// @name youtube-cobalt-tools
// @version 1.00
// @description A script that adds a button to YouTube which opens the video link in cobalt-tools (for downloading or extracting audio)
// @match *://*.youtube.com/*
// @exclude *://accounts.youtube.com/*
// @exclude *://www.youtube.com/live_chat_replay*
// @exclude *://www.youtube.com/persist_identity*
// @icon https://www.google.com/s2/favicons?sz=64&domain=YouTube.com
// @grant none
@marco79cgn
marco79cgn / yt-cobalt-button.js
Created October 25, 2024 13:09
Arc Boost which adds a cobalt.tools button to each YouTube video page
setTimeout(() => {
console.clear();
addCobaltButton();
}, 2000);
/**
* Force TrustedHTML due to Chrome restrictions
*/
escapeHTMLPolicy = trustedTypes.createPolicy("forceInner", {
createHTML: (to_escape) => to_escape
@marco79cgn
marco79cgn / ard-plus-dl.sh
Last active October 24, 2024 15:22
Das Skript lädt entweder einen einzelnen Film, Staffeln einer Serie oder alle Tatort Folgen einer Stadt von ARD Plus
#!/bin/bash
FILE=ard-plus-token
# parse input parameter
ardPlusUrl=$1
username=$2
password=$3
skip=$4
movieId=''
token=''
showPath=$(echo $ardPlusUrl | rev | cut -d "/" -f1 | rev)
@marco79cgn
marco79cgn / schnelltest-availability.js
Last active September 28, 2024 12:57
Shows the available amount of Covid Tests in your local drug store and online
let country = "de"; // replace with 'at' for shops in Austria
let storeId = 251;
let param = args.widgetParameter;
if (param != null && param.length > 0) {
if (param.indexOf(";") > 0) {
const paramSplit = param.split(";");
storeId = paramSplit[0];
country = paramSplit[1].toLowerCase();
} else {
storeId = param;
@marco79cgn
marco79cgn / apple-availability-check.sh
Last active September 28, 2024 12:28
Bash script that checks whether an Apple product is available for pickup at your nearest Apple Store and sends a push notification if it gets available again (via ntfy.sh)
#!/bin/bash
partNo=$1
storeId=$2
notifyUrl=https://ntfy.sh/$3
FILE=$4/${partNo/\//-}-$storeId
if [ ! -f "$FILE" ]; then
echo "$FILE does not exist."
echo -n "1" > $FILE
fi
@marco79cgn
marco79cgn / charging-points-capacity.js
Last active September 26, 2024 18:56
iOS widget, das die Anzahl sowie den Anteil der aktuell belegten Ladepunkte in Deutschland zeigt.
const canvSize = 200;
const canvTextSize = 80;
const canvas = new DrawContext();
canvas.opaque = false;
const battCircleRemainColor = new Color("#32CD33"); // Charge circle remaining color
const battCircleDepletedColor = new Color("#fff");
const battCircleBGColor = new Color('#fff'); // Widget background color
const battCircleTextColor = new Color('#000'); // Widget text color
const labelColor = new Color('#768178')
const textColor = new Color('#34443c')
@marco79cgn
marco79cgn / apple-product-availability.js
Last active September 26, 2024 17:30
Custom iOS widget that shows both the store and online availability of a given product (for Scriptable.app)
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: blue; icon-glyph: magic;
// default zip and partNo - will be overwritten by your widget parameters
let zip = '50670'
let partNo = "MU7A3ZD/A"
// insert your ntfy url
const notifyUrl = "https://ntfy.sh/******"
// force push notification - set to true in order to test that your setup is working correctly
const forcePushNotification = false
@marco79cgn
marco79cgn / dm-toilet-paper.js
Last active September 3, 2024 20:47
iOS Widget, das die Anzahl an Klopapier Packungen in deiner nächsten dm Drogerie anzeigt (für die scriptable.app)
// dm Klopapier Widget
//
// Copyright (C) 2020 by marco79 <marco79cgn@gmail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
@marco79cgn
marco79cgn / update-wg-easy.sh
Last active April 27, 2024 10:37
Updates Wireguard (wg-easy) docker container
#!/bin/bash
docker stop wg-easy
docker rm wg-easy
docker pull ghcr.io/wg-easy/wg-easy
/home/pi/wg-easy/wg-easy-start.sh