Skip to content

Instantly share code, notes, and snippets.

View masterflitzer's full-sized avatar

masterflitzer

  • 12:20 (UTC +02:00)
View GitHub Profile
@masterflitzer
masterflitzer / convert2m4a.ps1
Last active April 14, 2024 18:33
Simple script to convert any audio/video to M4A using drag'n'drop on shortcut after first run
#Requires -Version 5.1
Set-StrictMode -Version Latest
if ($args.Length -eq 0) {
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut($PSCommandPath.Replace(".ps1", "") + " (Drag'n'Drop).lnk")
$pwsh = "pwsh"
if (!$(Get-Command pwsh -ErrorAction SilentlyContinue)) {
Write-Output "PowerShell (pwsh) not found, falling back to Windows PowerShell (powershell)"
$pwsh = "powershell"
@masterflitzer
masterflitzer / proxy.ps1
Created January 3, 2024 17:29
Simple script to toggle HTTP proxy on Windows
#Requires -PSEdition Core
[CmdletBinding()]
param (
[Parameter(ParameterSetName = "enable")]
[switch]
$On,
[Parameter(ParameterSetName = "disable")]
[switch]
$Off,
@masterflitzer
masterflitzer / prime-video-library.js
Created January 2, 2024 18:07
Convert your Prime Video Library to JSON!
// https://amazon.de/gp/video/mystuff/library/all
// adjust based on connection speed
let counter = 3;
if (document.readyState === "complete") await mainPrimeVideoLibrary(counter);
else alert("Please run this script after the webpage finished loading!");
async function mainPrimeVideoLibrary(counter) {
const sleep = async (ms) =>
@masterflitzer
masterflitzer / compile-kotlin-native-freebsd.sh
Created December 14, 2023 19:09
Compile Kotlin/Native on FreeBSD
#!/usr/bin/env bash
DIR_KOTLIN="${HOME}/kotlin"
GIT_KOTLIN="jetbrains/kotlin"
PORT_CA_ROOT="security/ca_root_nss"
PORT_GIT="devel/git"
PORT_JDK="java/openjdk17"
PORT_JQ="textproc/jq"
for PORT in "${PORT_CA_ROOT}" "${PORT_GIT}" "${PORT_JDK}" "${PORT_JQ}"
@masterflitzer
masterflitzer / email-multiplexer.py
Last active November 26, 2023 20:13
Send E-Mail from IMAP to multiple recipients over SMTP
#!/usr/bin/env python3
import os
import toml
from email import message_from_bytes, policy
from email.message import EmailMessage
from enum import Enum
from html import escape
from imaplib import IMAP4, IMAP4_SSL
from smtplib import SMTP, SMTP_SSL
@masterflitzer
masterflitzer / README.md
Last active November 29, 2023 15:41
Make ChatGPT window wider

ChatGPT Wide

  • Open a chat on ChatGPT
  • Create a bookmark in your browser and paste javascript: followed by the minified code into the URL input field (Bookmarklet)
  • Alternatively: Open the browser DevTools (F12) and paste the code into the console

Minify

terser --compress --mangle --output chatgpt-wide.min.js chatgpt-wide.js
@masterflitzer
masterflitzer / compile-ffmpeg-debian.sh
Last active April 15, 2024 04:01
Compile ffmpeg on Debian
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
shopt -s inherit_errexit
if test -z "${FFMPEG_VERSION:-}"
then
echo "You need to set the FFMPEG_VERSION environment variable (see https://git.ffmpeg.org/gitweb/ffmpeg.git/tags)"
@masterflitzer
masterflitzer / ffmpeg.sh
Last active June 22, 2024 06:38
Convert any movie to WebM (AV1/Opus/WebVTT)
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
shopt -s inherit_errexit
# e.g. "Movie name (Year)" or "Series name (Year) - S01E01 - Episode title"
TITLE="${TITLE:-}"
DESCRIPTION="${DESCRIPTION:-}"
@masterflitzer
masterflitzer / battery-log.ps1
Created March 13, 2023 19:32
Log current battery charge on Windows
while ($true) {
$charge = Get-CimInstance -ClassName Win32_Battery | Select-Object -ExpandProperty EstimatedChargeRemaining
Write-Output "Current Charge: ${charge}%" | Tee-Object -Append "$([System.Environment]::GetFolderPath("Desktop"))/battery.log"
Start-Sleep -Seconds 30
}
@masterflitzer
masterflitzer / github-unverified-commits.js
Last active March 2, 2023 08:22
Find unverified commits in your GitHub repositories
import { writeFile } from "fs/promises";
import { Octokit } from "octokit";
import ProxyAgent from "proxy-agent";
const apiToken = process.env.API_TOKEN;
const output = process.argv[2] ?? "-";
if (apiToken == null) {
console.error("API_TOKEN was empty!");
console.info("Please set the API_TOKEN environment variable:");