Skip to content

Instantly share code, notes, and snippets.

@pejobo
pejobo / backup-image.sh
Created February 19, 2017 13:42
make a backup of my running raspberry pi (filesystem is f2fs)
#!/bin/sh
target=/media/stuff/raspberry/backup.img
size_of_image=6G
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
// ==UserScript==
// @name Jira Color Checkbox
// @namespace http://<domain>
// @version 0.1
// @description Ensures the color checkbox to be checked.
// @author DRe
// @match https://<sub-domain>/secure/RapidBoard.jspa?rapidView=175&*
// @grant none
// ==/UserScript==
@pejobo
pejobo / init_fritzbox_call.py
Created October 2, 2017 16:48
Init a phone call via fritzbox by scripting the webinterface
import re
import requests
import hashlib
password = 'xxxx'
phone_number = '12345'
def get_challenge(text):
m = re.search('g_challenge = "([^"]+)"', text)
if not m:
@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>
@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 / 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 / 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 / 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 / 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 / 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();