Skip to content

Instantly share code, notes, and snippets.

View pklaus's full-sized avatar

Philipp Klaus pklaus

  • Frankfurt, Germany
View GitHub Profile
@KartikTalwar
KartikTalwar / Documentation.md
Last active June 11, 2025 03:14
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@pklaus
pklaus / brother_ql - Related and Unrelated Software.md
Last active June 8, 2025 11:59
brother_ql - Related and Unrelated Software
@pklaus
pklaus / README.md
Last active May 31, 2025 14:15
Generating Random MAC Addresses with Python

The mini-tool has a CLI-Interface with the following options:

  • Unicast or Multicast? Default: Unicast
  • Locally Administered or Globally Unique? Default: Locally Administered
  • Prescribe specific OUI (overwrites the above two)

TODO

  • Add an option to generate a number of MACs without collisions.
@pklaus
pklaus / wikibackup.sh
Created December 11, 2010 19:06
wikibackup – A Basic Backup Script for MediaWiki
#!/bin/sh
####################################################################
# #
# Basic Backup Script for MediaWiki. #
# Created by Daniel Kinzler, brightbyte.de, 2008 #
# #
# This script may be freely used, copied, modified and distributed #
# under the sole condition that credits to the original author #
# remain intact. #
@cboettig
cboettig / docker-compose.yml
Last active May 5, 2025 08:32
debugging NGINX configuration for Jupyter
jupyter:
image: jupyter/datascience-notebook
environment:
- PASSWORD=${PASSWORD}
nginx:
image: nginx
links:
- jupyter
@pklaus
pklaus / enumerate_interfaces.py
Last active April 8, 2025 12:04
Python: List all Network Interfaces On Computer
"""
Determine IPv4 addresses on a Linux machine via the socket interface.
Thanks @bubthegreat the changes to make it Py2/3 compatible and the helpful
code comments: https://gist.github.com/pklaus/289646#gistcomment-2396272
This version has all comments removed for brevity.
"""
import socket
import array
import struct
@pklaus
pklaus / ddnsserver.py
Last active March 24, 2025 19:48 — forked from andreif/Simple DNS server (UDP and TCP) in Python using dnslib.py
Simple DNS server (UDP and TCP) in Python using dnslib.py
#!/usr/bin/env python
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import argparse
import datetime
import sys
import time
import threading
@pklaus
pklaus / ping.py
Created March 5, 2011 09:50
A pure python ping implementation using raw socket.
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping
@pklaus
pklaus / keyring.py
Created February 21, 2010 10:51
Use the Gnome Keyring in a Python program
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Gnome Keyring in Python
# Shows how to store credentials of type NETWORK_PASSWORD using python.
# Found on <http://www.rittau.org/blog/20070726-01>
# More on the GNOME Keyring: <http://live.gnome.org/GnomeKeyring>
# alternatively have a look at the new universal and actively developed Python Keyring:
# on <http://pypi.python.org/pypi/keyring> and <http://home.python-keyring.org/>
@pklaus
pklaus / rec_unlimited.py
Last active February 16, 2025 12:00
Audio recording with python-sounddevice
#!/usr/bin/env python3
"""Create a recording with arbitrary duration.
PySoundFile (https://github.com/bastibe/PySoundFile/) has to be installed!
WARNING: This works only in Python 3.x!
"""
import argparse
import tempfile