Skip to content

Instantly share code, notes, and snippets.

@pejobo
pejobo / gen_password.py
Created August 6, 2023 13:19
Random Password Generator
import random
import string
alphabet = string.ascii_lowercase + string.digits + string.ascii_uppercase + '%$&?@§/.-+~*#()='
print(''.join(random.choice(alphabet) for i in range(32)))
@pejobo
pejobo / kaenguru.html
Last active August 6, 2023 21:58
kaengrur
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<head>
</head>
<body>
<div id="output"><img id="image" width="100%" src="https://via.placeholder.com/800x250.png?text=:("/></div>
</body>
<script>
const MILLIS_PER_DAY = 24*60*60*1000;
@pejobo
pejobo / load-chromium-widevine.py
Last active June 27, 2020 14:37
Get widevine for raspberry pi 3
# adpated fom https://github.com/emilsvennesson/script.module.inputstreamhelper and https://archlinuxarm.org/forum/viewtopic.php?f=60&t=13189#
import sys
import os
import subprocess
from distutils.version import LooseVersion
WIDEVINE_DOWNLOAD_URL = 'https://dl.google.com/widevine-cdm/{version}-{os}-{arch}.zip'
CHROMEOS_RECOVERY_URL = 'https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf'
@pejobo
pejobo / concurrent.js
Created March 17, 2019 17:26
node / java script: perform a list of tasks with limit parallelism
async function doConcurrent(parallelity, tasks) {
const promises = [];
const chain = async (f1, f2) => {
await f1();
await f2();
};
const next = () => {
if (tasks.length) {
// console.log('start next, task count is ' + tasks.length);
var task = tasks.shift();
@pejobo
pejobo / pawned.sh
Last active December 1, 2019 12:36
Have I been pawned?
#!/usr/bin/env bash
# Links:
# https://haveibeenpwned.com/Passwords
# https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange
if [ "$1" == "--gui" ]; then
gui=true
shift
fi
@pejobo
pejobo / dl-m3u8.sh
Created January 12, 2019 10:30
Download m3u8 hls video with ffmpeg
# provide the .m3u8 url as first, the output file as second parameter
#
# The m3u8 link must be the 'chunk' file and not the playlist file.
# This file is usually large and contains many "#EXT-X-BYTERANGE:<num>" lines
# (technically this are media segments, see https://tools.ietf.org/html/draft-pantos-http-live-streaming-13#page-6).
# A playlist file contains links to different chunk files, choose there the one you want to download from.
# The #EXT-X-STREAM-INF above each link contains some meta data of the content.
#
url=$1
file=$2
@pejobo
pejobo / lupo.sh
Created November 18, 2018 20:51
LUPO (Laufbahnberatungs- und Planungstool Oberstufe) unter Linux mit wine
# source: https://www.svws.nrw.de/cgi-bin/yabb2/YaBB.pl?num=1421236234/5#5
# prerequisite:
# * wine (tested with v3.0)
# * winetricks (newer is always better)
export WINEPREFIX=~/lupo
export WINEARCH=win32
if [ ! -d "~/lupo" ]; then
mkdir ~/lupo
winetricks -q mdac28
winetricks -q jet40
@pejobo
pejobo / gedit_save_tabs.plugin
Last active June 10, 2018 21:08
gedit plugin to save tabs between editor restarts - copy files to ~/.local/share/gedit/plugins
[Plugin]
Loader=python3
Module=gedit_save_tabs
IAge=3
Name=Gedit Save Tabs
Description=Save and restore tabs in gedit
Authors=pejobo70@gmail.com
Copyright=Copyright © 2018 pejobo70@gmail.com
Website=https://github.com/pejobo
@pejobo
pejobo / pre-push
Created May 31, 2018 10:57
git pre-push hook preventing a push to master when a line with NEXT_STABLE has been added
#!/bin/sh
# A hook script to prevent pushing changes to master branch where a line
# with NEXT_STABLE has been added.
#
# Called by "git push" after it has checked the remote status, but before
# anything has been pushed. If this script exits with a non-zero status
# nothing will be pushed.
#
# This hook is called with the following parameters:
@pejobo
pejobo / phone-x-tel.xml
Last active June 17, 2020 12:03
start phone call from browser on linux, either with scriptlet or by simply clicking on href="tel:<number>" links embedded in websites
<?xml version="1.0" encoding="UTF-8"?>
<!-- place in ~/.local/share/mime/packages/ -->
<!-- and update the mime database with `update-mime-database .local/share/mime/` -->
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="x-scheme-handler/tel">
<comment>telephone mime type</comment>
</mime-type>
</mime-info>