Skip to content

Instantly share code, notes, and snippets.

@hutt
hutt / light-yt-request-proxy.worker.js
Last active January 5, 2025 00:31
This Cloudflare Worker proxies and caches requests for privacy-friendly light-yt.js YouTube video embeds.
// This Cloudflare Worker proxies and caches requests for privacy-friendly light-yt.js YouTube video embeds.
// https://gist.github.com/hutt/62e9355afb0d4ff0eeecd39bc51652de
// Base URLs for YouTube no-cookie and YouTube image CDN
const YT_NOCOOKIE_URL = 'https://www.youtube-nocookie.com';
const YTIMG_URL = 'https://i.ytimg.com';
// Path prefix for our proxy
const PROXY_PATH = '/yt-proxy';
@hutt
hutt / third-party-cdn-cloudflare-worker-proxy.worker.js
Last active January 17, 2025 14:16
This Cloudflare Worker proxies and caches requests to a CDN, making it easier to avoid third-party-requests
// This Cloudflare Worker proxies and caches requests to a CDN, making it easier to avoid third-party-requests
// https://gist.github.com/hutt/7b3c254a995849e6a06709a872840685/
// Base URL for JSDelivr CDN
const JSDELIVR_BASE_URL = 'https://cdn.jsdelivr.net';
// Path prefix for our proxy
const PROXY_PATH = '/cdn-jsdelivr';
// Default cache duration in seconds (6 hours)
@hutt
hutt / Scriptable Widget for Ghost CMS.md
Last active October 2, 2024 01:57
A custom iOS widget built using Scriptable that displays the total number of members from your @TryGhost blog. The widget supports small, medium, and large sizes, with graphs showing member growth over the last 30 days for medium and large sizes. More features to come.

Ghost CMS Widget for Scriptable

A custom iOS widget built using Scriptable that displays the total number of members from your Ghost blog. The widget supports small, medium, and large sizes, with graphs showing member growth over the last 30 days for medium and large sizes. More features to come.

Features

✨ Display total members count. ✨ Graph showing member growth over the last 30 days for medium and large widgets. ✨ Customizable with widget parameters: base URL, API key, and cache duration. ✨ Automatic light/dark mode support with appropriate Ghost logo.

@hutt
hutt / kimai-tracking-status.js
Last active September 20, 2024 21:23
Scriptable widget that fetches your current tracking status from Kimai and displays it on your iOS homescreen.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: stopwatch;
// Configuration
const kimaiUrl = "https://kimai.yourdomain.com";
const apiKey = "<your api key>";
// Create widget
const widget = await createWidget();
if (!config.runsInWidget) {
@hutt
hutt / bt-to.js
Last active May 18, 2024 16:31
Bundestags-Tagesordnung API: BT-TO als iCal, JSON & XML verfügbar machen. Alles mit einem Cloudflare-Worker. Web: https://api.hutt.io/bt-to/
/* *
* bt-to api
* hutt
* 2024-05-17
*
*/
import cheerio from "cheerio";
addEventListener("fetch", (event) => {
@hutt
hutt / plainnat.bst
Last active February 2, 2020 12:58
plainnat.bst LaTeX bibliography template for german publications in social sciences
%% File: `plainnat.bst'
%% A modification of `plainnat.bst' by Patrick W Daly for use with natbib package
%%
%% Modified in 2019 by Jannis Hutt
%% E-mail: [email protected]
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1 of the License, or any later version.
@hutt
hutt / vorlage_textzusammenfassung.tex
Last active February 2, 2020 13:02
Vorlage für Textzusammenfassungen (Harvard-Zitierstil)
\documentclass[a4paper, 11pt]{article}
\usepackage{comment}
\usepackage{blindtext}
\usepackage{fullpage}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
@hutt
hutt / bot.py
Last active September 11, 2016 23:21
Das Maß ist voll
#!/usr/bin/env python
#coding=UTF-8
#file: bot.py
#
#requirements:
#keys.py
#tweeps ("pip install tweeps")
#
import tweepy, time, sys, random
#from our keys module (keys.py), import the keys dictionary
@hutt
hutt / pushover.sh
Created April 5, 2016 16:07
get notified easily by using pushover on your server.
#!/bin/bash
# Pushover settings
api_key="YOUR_API_KEY"
user_key="YOUR_USER_KEY"
# Logic
if [ -t 0 ]; then
# check for parameters
@hutt
hutt / rsa.md
Last active February 2, 2020 13:04
Beispiel: Verschlüsselung mit RSA

Beispiel: Verschlüsselung mit RSA

Im Folgenden verschlüssle ich meinen Namen, die Zeichenkette jannis mittels RSA.

Funktionsweise

  1. Es werden zwei verschiedene, große Primzahlen p und q zufällig gewählt, wobei die Differenz nicht zu klein sein sollte, und das Produkt der beiden berechnet: n = p * q

  2. Dann wird ein zufälliger Wert e ermittelt, der teilerfremd (relativ prim) und kleiner als (p-1) * (q-1) ist. Zu diesem wird das modular Inverse d berechnet, so dass gilt: (e * d) mod ((p-1) * (q-1)) = 1

  3. Als öffentlicher Schlüssel gilt dann: e, n und der private Schlüssel ist: d und n. Die Primzahlen p und q können vergessen werden, aber sie sollten niemals bekannt werden.