Skip to content

Instantly share code, notes, and snippets.


Stefan Thesing sthesing

View GitHub Profile
sthesing /
Created Nov 9, 2017
Argos script to restart networking with a click
#!/usr/bin/env python3
# License: WTFPL
import subprocess
status = subprocess.check_output(["nmcli", "networking", "connectivity"]).decode()
# replace "vollständig" with whatever nmcli outputs for "full" in your language setting
if status == "vollständig\n":
icon = "<span color='green'><tt>✓</tt></span>"
sthesing /
Created May 17, 2017
Zahlenraten Beispiel aus dem KBQ-Kurs "Programmieren für Anfänger"
import random
print("Willkommen beim Zahlenraten!")
untergrenze = input("Gib die Untergrenze ein: ")
obergrenze = input("Gib die Obergrenze ein: ")
# input liefert strings. Wir brauchen integers. Also umwandeln
untergrenze = int(untergrenze)
obergrenze = int(obergrenze)
sthesing /
Created May 17, 2017
Rechner Beispiel aus dem KBQ-Kurs Programmieren für Anfänger
def plus(zahl1, zahl2):
Addiert zwei Zahlen.
ergebnis = int(zahl1) + int(zahl2)
return ergebnis
def minus(zahl1, zahl2):
Substrahiert die zweite Zahl von der ersten Zahl.
sthesing / snippets.conf
Last active Jan 4, 2016
My snippets file for Geany, mostly convenience stuff for LaTex
View snippets.conf
# Geany's snippets configuration file
# use \n or %newline% for a new line (it will be replaced by the used EOL char(s) - LF, CR/LF, CR).
# use \t or %ws% for an indentation step, it will be replaced according to the current document's indent mode.
# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue').
# use %key% for all keys defined in the [Special] section.
# use %cursor% to define where the cursor should be placed after completion. You can define multiple
# %cursor% wildcards and use the "Move cursor in snippet" to jump to the next defined cursor
# position in the completed snippet.
# You can define a section for each supported filetype to overwrite default settings, the section
sthesing /
Last active Jan 4, 2016
Replace script for's @nhk using sed.
#Cut extension off
FILENAME=`echo $1 | cut -d'.' -f1`
#Put [$FILENAME][S. ] before everything in double quotes
sed -i 's|\(\".*\"\)|['$FILENAME'][S. ]\1|g' $1
View gist:5773222
function detect( fn, err){
var flag = true;
if(flag) err();
flag = false;
// example with error
sthesing / .gitignore
Last active Jan 5, 2016
Mr Q - Geschichte für den Writing Jam vom 24.-26.05.2013