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 March 25, 2024 17:40
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 / enumerate_interfaces.py
Last active March 15, 2024 15:32
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 / install-arch-linux-rpi-zero-w.sh
Last active March 13, 2024 23:23 — forked from larsch/install-arch-linux-rpi-zero-w.sh
Install Arch Linux ARM for Raspberry Pi Zero W on SD Card (with commands to configure WiFi before first boot).
#!/bin/sh -exu
dev=$1
cd $(mktemp -d)
function umountboot {
umount boot || true
umount root || true
}
# RPi1/Zero (armv6h):
@pklaus
pklaus / plotSmart.py
Last active February 28, 2024 01:46
S.M.A.R.T. to DB – A Python tool to store your HDD's SMART values in an SQLite database.
#!/usr/bin/env python
# -*- encoding: UTF8 -*-
""" read out S.M.A.R.T. values out of the database and plot them using matplotlib
<http://matplotlib.sourceforge.net/examples/pylab_examples/anscombe.html>
"""
from pylab import *
from os import geteuid
@pklaus
pklaus / ddnsserver.py
Last active February 27, 2024 11:41 — 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 / StatusIcon.py
Created February 15, 2010 20:36
StatusIcon – A Simple Tray Icon Application Using PyGTK
#!/usr/bin/env python
# found on <http://files.majorsilence.com/rubbish/pygtk-book/pygtk-notebook-html/pygtk-notebook-latest.html#SECTION00430000000000000000>
# simple example of a tray icon application using PyGTK
import gtk
def message(data=None):
"Function to display messages to the user."
@pklaus
pklaus / rigol-plot.py
Last active February 12, 2024 08:46 — forked from shirriff/rigol-plot.py
Example of controlling a Rigol oscilloscope via Python. Fetch a 1 MB "Long Memory" trace from the oscilloscope and graph it using matplotlib.
#!/usr/bin/env python
"""
Download data from a Rigol DS1052E oscilloscope and graph with matplotlib.
By Ken Shirriff, http://righto.com/rigol
Based on http://www.cibomahto.com/2010/04/controlling-a-rigol-oscilloscope-using-linux-and-python/
by Cibo Mahto.
"""
@pklaus
pklaus / sunplot.py
Last active February 8, 2024 19:24
This tool can draw the path of the sun for a given position on earth. It will draw two lines: One for June 21 and another for December 21. You need to have PyEphem and gnuplot installed for this script to work properly.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This tool can draw the path of the sun for a given
position on earth. It will draw two lines:
One for June 21 and another for December 21.
You need to have PyEphem and gnuplot installed
for this script to work properly.
@pklaus
pklaus / allsatsabovehorizon.py
Last active February 8, 2024 19:24
plot of every tle.info satellite above your horizon once a second for 3 minutes (30x time lapse) (found on Reddit: https://www.reddit.com/r/dataisbeautiful/comments/3gxp87/i_just_plotted_every_tleinfo_satellite_above_my/)
#!/usr/bin/env python
import math
import time
from datetime import datetime
import ephem
import numpy as np
import matplotlib.pyplot as plt
import sys
import os.path
@pklaus
pklaus / get_name.py
Last active January 26, 2024 18:20 — forked from starrhorne/gist:1637310
Extracting font names from TTF/OTF files using Python and fontTools
#!/usr/bin/env python
"""
From
https://github.com/gddc/ttfquery/blob/master/ttfquery/describe.py
and
http://www.starrhorne.com/2012/01/18/how-to-extract-font-names-from-ttf-files-using-python-and-our-old-friend-the-command-line.html
ported to Python 3
"""