Skip to content

Instantly share code, notes, and snippets.

View vnznznz's full-sized avatar
🚀

Vinzenz Sinapius vnznznz

🚀
View GitHub Profile
@vnznznz
vnznznz / sendmail
Last active February 7, 2024 09:52
Sendmail dummy for logging cron mails to syslog. Save it to `/usr/sbin/sendmail`, apply `chmod +x` and then see cron mails in `journalctl -f`
#!/bin/bash
/usr/bin/logger -t "sendmail" "'$*'"
/usr/bin/logger -t sendmail <&0
@vnznznz
vnznznz / ProcessPassthroughLogger.py
Created June 29, 2023 07:09
Sometimes you need to debug how a tool interacts with another command. This script runs the command, passing through stderr and stdout while also logging it to seperate files.
import sys
import subprocess
import threading
import codecs
import selectors
from typing import BinaryIO, TextIO
UTF8Reader = codecs.getreader("utf-8")
@vnznznz
vnznznz / archnews.py
Last active November 16, 2017 10:25
Quick and dirty snippet to get the latest ArchLinux - News
#!/usr/bin/python
"""
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2017 Vinzenz Johann Sinapius <vinzenz.sinapius@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@vnznznz
vnznznz / pack.py
Last active April 27, 2017 06:22
Pack images in the current dir and subfolders for printing
#!usr/bin/python3
import os
from PIL import Image
from rectpack import newPacker
IMAGES = []
# to lazy to handle rotation right now
PACKER = newPacker(rotation=False)
@vnznznz
vnznznz / jobtitle.py
Last active August 29, 2015 14:17
Generate a funny job title from your name
adjectives = {
'A': 'International',
'B': 'Coporate',
'C': 'National',
'D': 'Lead',
'E': 'Executive',
'F': 'Acting',
'G': 'District',
'H': 'Internal',
'I': 'Central',
@vnznznz
vnznznz / netzplan.py
Created March 24, 2015 16:14
Practice: Precedence diagram in python
class Process(object):
def __init__(self, name, duration, next_processes=[]):
self.name = name
self.duration = duration
self.previous_processes = []
self.next_processes = next_processes
for process in next_processes:
process.previous_processes.append(self)
def earliest_starting_point(self):