Skip to content

Instantly share code, notes, and snippets.

@svenk
svenk / ilo-reset.sh
Created August 28, 2023 08:14
HP ILo reset factory default from live linux
#!/bin/bash
# This script can run on GRML and allows the installation of the HP Integrated Lights Out (ILo)
# managament utility to reset the tools password.
wget http://downloads.linux.hpe.com/SDR/repo/mcp/pool/non-free/hponcfg-5.6.0-0_amd64.deb
apt-get update
apt-get install xsltproc
apt-get install ./hponcfg-5.6.0-0_amd64.deb
@svenk
svenk / resolve-refs.py
Created July 12, 2023 20:44
Recursive Ref Resolver for OpenAPI
#!/usr/bin/env python3
# somewhat related to https://github.com/openapi-generators/openapi-python-client/issues/466
from openapi3 import OpenAPI
import yaml
import posixpath, re
import requests
from pathlib import Path
@svenk
svenk / README.md
Created September 16, 2021 10:38
Mediawiki backup to Git Repository

Automatic backup to some SECURE git space for a MediaWiki

This is carried out with two shell scripts: One responsible for gathering the wiki contents in various formats as single files, and one responsible for uploading to a git repository.

Directory structures

@svenk
svenk / shell.sh
Created May 15, 2023 06:48
Fancy Demo Video Background for anabrid
# First, open https://anabrid.com/background/
# second, run this in terminal
# change sleep 10 to sleep 1 for more movement or the other way around.
while sleep 10; do xdotool mousemove $(shuf -i 1-3000 -n1) $(shuf -i 1-3000 -n1); done
@svenk
svenk / Wie groß ist SIETE (Hemmes Mathematisches Rätsel).ipynb
Created May 12, 2022 12:16
Wie groß ist SIETE (Hemmes Mathematisches Rätsel)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svenk
svenk / mbox-to-csv.py
Last active September 2, 2021 04:08
Email inboxes (mbox) to CSV
#!/usr/bin/env python3
# A python3 script to read an mbox file (extension to Maildir is trivial thanks to
# mailbox module) and writes out certain headers as CSV file.
# On large mbox files (say 5GB) it is slow because... it's Python.
# The script deals with some cornercases (encoding, newlines, ...) which I found in
# 100K emails. Otherwise, the builtin python mail libraries provide robustness.
#
# It processes roughly 110K (5GB mbox) mails in 2:35mins on my laptop and produces
# a 19MB CSV file.
@svenk
svenk / extract.c
Created February 6, 2017 20:55
Convert a GIMP exported Header file back to a PNM Image which can be viewed with any program
#include "The-GIMP-exported-file.h"
#include <stdio.h>
/* This code converts a GIMP C export back to a readable PNM Image. Such
header file looks like
static const struct {
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel; // 2:RGB16, 3:RGB, 4:RGBA
@svenk
svenk / generate_blankpdf.sh
Last active March 25, 2021 20:48
Insert blank (white) pages between each page in a PDF file from shell
#!/bin/bash
base64 -d <<BASE | gunzip > blank.pdf
H4sICAEz+lIAA2JsYW5rLnBkZgCNVE1P20AQpa16WXEk970goCXsh712XCGkxB8RIgiU5ECbcjDO
AqHBRs66Cr32RvsTKvXSX1CpVZF6Kn+g6qWnnntHcO9snJCUILWW7PW+ed55b2bk+W0vKLIVE81f
fLj4evH54j3imOJk7witrpKajA/UITYAqZOg01UyJUE3VNKTUdKWa2uop1IZHqP+O+O70Vz8/ahJ
t+nMx1px8/rt3HJt9np57qx+/u3T3OWX+wVUuNr99Xqz8ONN4co9q809vyzcP58JH87+RDJuD0+C
N50cGUMVlnEDmWNhzdMTSXa29o5kpBBpZHtKA0GSHiNSqST9Fi462OQUW9TU6wrDu4hU0yQ7ga8b
pJmGce8kTGUcnRK3QTz5shPJerVCNrBKM+1sZL6E7nCOJq0/mIHr3h0exFiwW8Z0RSCMMYnCwSuc
MOLZN7xJtDT+OkhihTWrjkaudRFS8KZBrdbvq2pDgUAI+NWGwGIU2U6TqCFVi0CrSVP2FVk/Dg+k
@svenk
svenk / pomodoro-report.py
Created January 13, 2021 20:33
Simple logging
#!/usr/bin/env python
import os, re, sys
from os import path
from pathlib import Path
from datetime import datetime, timedelta
from prompt_toolkit import prompt # bundled with iPython
from prompt_toolkit.completion import WordCompleter
@svenk
svenk / spin-the-bottle.php
Last active December 31, 2020 15:40
"Spin the bottle" with Zoom using the Zoom Webhook API
<html>
<meta charset="utf-8">
<title>Genie in a Bottle</title>
<meta author="SvenK">
<meta date="31.12.2020">
<?php
# First of all, this is supposed only to work for a specific
# room. Fix the room id here: