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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
sci = lambda d: re.sub(r'e\+?(-?)?0?(\d+)', r" x 10^{\1\2}" ,"%.2e"%d) | |
""" | |
### Examples: | |
In [34]: sci(1) | |
Out[34]: '1.00 x 10^{0}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is a buffer-overflow-safe version of sprintf | |
// source: http://stackoverflow.com/a/69911 | |
// if you need something more mature, consider https://github.com/fmtlib/fmt | |
// the advantage of this snippet is that it can be really easily added to smallish | |
// codes/libraries. Usage is like C's vprintf et al. but with a C++ std::string as a result. | |
std::string vformat (const char *fmt, va_list ap) { | |
// Allocate a buffer on the stack that's big enough for us almost | |
// all the time. Be prepared to allocate dynamically if it doesn't fit. | |
size_t size = 1024; | |
char stackbuf[1024]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Das Gendersternchen funktioniert nicht gut zusammen mit Markdown. Folgender | |
Regexp liefert ein Preprocessing, was es ermöglicht, ohne einen anderen | |
Markdown-Dialekt zu wählen (Regulärer Ausdruck in Python): | |
> for x in ["Gender*nnen","foo *bar* baz", "foo *bar*baz", "Und *das* ist wirklich Mensch*nnen *und* toll."]: | |
> print(re.sub(r"(^|\s)(\w+)\*([^.\s]*\w+)($|\s)", r"\1\2\*\3\4", x)) | |
Gender\*nnen | |
foo *bar* baz | |
foo *bar*baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Allow for nicer print output *) | |
SetOptions[SelectedNotebook[], | |
PrintingStyleEnvironment -> "Printout", ShowSyntaxStyles -> True] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Scraping non-downloadable books/documents | |
# by downloading them as JPG files | |
# Public Domain. | |
import requests, json, sys | |
# Attention, token changes regularly... You should copy all ~10 minutes from Firebug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Enforce HTTPS | |
if($_SERVER["HTTPS"] != "on") { header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); exit(); } | |
?> | |
<!doctype html> | |
<html> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<body style="padding:5%; font-family: sans-serif"> | |
<h1>Some secret</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |