Skip to content

Instantly share code, notes, and snippets.

Mathias Panzenböck panzi

Block or report user

Report or block panzi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View YouTubeThumbs.js
(function() {
"use strict";
function padd(x) {
var x = String(x);
return x.length < 2 ? '0' + x : x;
var duration = +document.querySelector("video").duration;
var storyboard_spec = document.querySelector("ytd-watch-flexy").__data.playerData.storyboards.playerStoryboardSpecRenderer.spec.split('|');
panzi /
Created Oct 2, 2019
convert a video into a GIF with optimal palette
panzi / no_blocking_overlay.js
Created Apr 9, 2019
A bookmarklet that removes these nasty overlays from websites that would work perfectly fine without a login, but still want you to create one.
View no_blocking_overlay.js
javascript:Array.forEach(document.body.querySelectorAll("*"), e => { var s = getComputedStyle(e); if (s.position !== 'static' && s.position !== 'relative') { var r = e.getBoundingClientRect(); if (r.x <= 0 && r.y <= 0 && r.width >= window.innerWidth && r.height >= window.innerHeight) { e.remove(); } } });"auto";void(0)
panzi / show_hide_passwords.js
Created Jan 19, 2019
Bookmarklets to make passwords in password fields readable and to hide them again.
View show_hide_passwords.js
// Show Passwords:
// Hide Passwords again:
panzi /
Last active Nov 20, 2018
Merge files useing kdiff3. Using git mergetool merges files one by one, this opens all files in kdiff3 at once. TODO: somehow git add merged files after kdiff3 exists
set -e
. "`git --exec-path`/git-sh-setup"
panzi /
Last active Oct 24, 2018
Dumps whole MySQL database as CSV files.
#!/usr/bin/env python3
import mysql.connector
import argparse
import csv
import re
import sys
from contextlib import closing
from os import makedirs
from os.path import join as join_path
#!/usr/bin/env python3
import re
LEX = re.compile(
r'([_a-zA-Z]+[_a-zA-Z0-9]*)|' + # identifier
r'("(?:[^"\n\\]|\\["rnbvte\\0]|\\x[0-9a-fA-F]{2})*")|' + # string
r"('(?:[^'\n\\]|\\['rnbvte\\0]|\\x[0-9a-fA-F]{2})*')|" + # char (yes they can be more than on character in C)
r'(/\*(?:[^*]|\*[^/])*\*/)|' + # multiline comment
r'(//[^\n]*)|' + # single line comment
panzi / Results.txt
Last active Aug 3, 2018
Find maximum regular expression length. Note that I guess the maximum length could be different if other regular expression features are used.
View Results.txt
Google Chrome 68.0.3440.84 64 bit Linux: 41943040
NodeJS v8.11.1 64 bit Linux: 41943040
Mozilla Firefox 61.0.1 64 bit Linux: 268435455
panzi / invertColors.js
Last active Jun 26, 2018
Bookmarklet to invert colors on a page, but *not* of images and videos. Basically a quick dark-mode hack.
View invertColors.js
javascript:(function() {
function parseColor(str) {
var match = /^\s*(?:(?:#(?:([0-9a-f])([0-9a-f])([0-9a-f])|([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})))|rgb\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)|rgba\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+(?:\.[0-9]*)?|\.[0-9]+)\s*\))\s*$/i.exec(str);
if (!match) throw new SyntaxError(str);
if (match[1]) {
return {
r: parseInt(match[1], 16) * 17,
g: parseInt(match[2], 16) * 17,
b: parseInt(match[3], 16) * 17,
a: 1.0
panzi / truncateUtf8Bytes.js
Last active Apr 25, 2018
Truncate a string at a given length in UTF-8 encoded bytes with JavaScript. Many APIs have lengths limitations given in these kind of numbers.
View truncateUtf8Bytes.js
// Truncate a string at a given length in UTF-8 encoded bytes.
// Many APIs have lengths limitations given in these kind of numbers.
function truncateUtf8Bytes(string, byteLength) {
const charLength = string.length;
let curByteLength = 0;
for (let i = 0; i < charLength; ++ i) {
const start = i;
const w1 = string.charCodeAt(i);
let cp = w1;
You can’t perform that action at this time.