Skip to content

Instantly share code, notes, and snippets.


Patrick Meyer HerrSpace

View GitHub Profile
View gist:58bace2634ab972b7ed8bd76c6143ddf
- prepare a new puppet branch with the updated version in the postgresql globals
- add the new pkgs to your repo and install them on the server
- systemctl stop postgresql@<old-version>
- systemctl stop postgresql@<new-version>
- pg_dropcluster <new version> main --stop
- try pg_upgradecluster <old version> main -j <cores> --link --method=upgrade
- if that fails try pg_upgradecluster <old version> main
- pg_dropcluster <old version> main
- run puppet with your new branch
- uninstall the old pg version
In [7]: zz={1:2, '1':'2'}
In [8]: zz
Out[8]: {1: 2, '1': '2'}
In [9]: json.dumps(zz)
Out[9]: '{"1": 2, "1": "2"}'
In [11]: qq=json.loads(json.dumps(zz))
HerrSpace /
Last active Apr 3, 2019
Using paramiko to use and abuse ssh keys for signing and verifying. Load keys from agent or disk.
#!/usr/bin/env python3
# Example 1: Load priv and pub from file
from paramiko import RSAKey
# Load key from file, not from agent.
key = RSAKey.from_private_key_file('/Users/space/.ssh/tuer')
msg = key.sign_ssh_data(b"somestuff")
# This derives the public key.. Obviously.
pub = RSAKey(data=key.asbytes())
def git_version(path):
# Like v1.0.0 or v1.0.0-1-g963fc39.dirty
git_describe = check_output([
'git', '-C', path, 'describe', '--tags', '--dirty=.dirty']
# Like v1.0.0
last_tag = check_output([
'git', '-C', path, 'describe', '--tags', '--abbrev=0']
View python3-abfuck
╭─space@FeTAp ~
╰─$ python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> b'\x00'.join(b'\x11\x11\x11')
>>> ^D
╭─space@FeTAp ~
╰─$ python3
View postgresql.service
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.
Description=PostgreSQL RDBMS
HerrSpace /
Created Jun 30, 2017
Find orphant stubnitz media archive dirs not linked to any event in the db.
#!/usr/bin/env python
import os, re
from mysql.connector import MySQLConnection, Error
__author__ = 'Patrick <space> Meyer'
ARCHIVE_MOUNT = '/var/www/'
EVENT_DIR_RE = ARCHIVE_MOUNT + r'current-archive\/(audio|video|bilder)\/[0-9]+\/[0-9]+\/[0-9]+\/[0-9]+'

Lasercutter Mods

Wasser Temperatur Ueberwachung

Problem: Der Lasercutter wird Wassergekuehlt. Das Wasser darf nicht > 25 Grad werden, sonst stirbt die Laserroehre (noch) schneller. Loesung: Das Wasser muss Temperatur ueberwacht werden. Benoetigte Komponenten:

  • Arduino + Netzteil. (Nicht interne 5V benutzen!)
HerrSpace / opensmtpd.service
Created May 24, 2017
A systemd service file for opensmtpd.
View opensmtpd.service
Description=Opensmtpd Mailserver
ExecStartPre=/usr/sbin/smtpd -n
ExecStart=/usr/sbin/smtpd -d
ExecStop=/usr/sbin/smtpctl stop
HerrSpace /
Created Jun 27, 2016
Curl number26 transactions.
curl '' -H 'Authorization: Basic bXktdHJ1c3RlZC13ZHBDbGllbnQ6c2VjcmV0' --data-urlencode 'username=' --data-urlencode 'password=' --data 'grant_type=password' | jq -r '.["access_token"]' | (read token; curl '' -H "Authorization: bearer $token") | jq
You can’t perform that action at this time.