Skip to content

Instantly share code, notes, and snippets.

View pklaus's full-sized avatar

Philipp Klaus pklaus

  • Frankfurt, Germany
View GitHub Profile
@pklaus
pklaus / README.md
Last active July 6, 2023 13:50
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 / tunnelbroker-net.linux.etc-network-interfaces.sh
Created May 9, 2011 12:05
tunnelbroker.net : tunnel setup on Linux using "ip" from the iproute suite (iproute2)
#!/bin/bash
# IPv6 Tunnel setup of an tunnelbroker.net tunnel on Linux using the configuration file `/etc/network/interfaces`
# (needs the `ip` tool from the iproute suite, Ubuntu package: <http://packages.ubuntu.com/iproute>)
#
# Run like this:
# ./tunnelbroker-net.linux.etc-network-interfaces.sh
#
# 2011 by Philipp Klaus
# Published on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-tunnel-setup-on-ubuntu-11-04/>
@pklaus
pklaus / remove-orphaned-raw-images.py
Last active May 8, 2023 20:43
Do you own a DSLR? If so, do you transfer your images to your computer, then look at the JPEGs and delete the crappy ones? If you do, your RAW images may be leftover. This Python script helps you cleaning up your image folders after deleting unwanted JPEGs. See http://blog.philippklaus.de/2012/12/cleaning-leftover-raw-images-after-selecting-imag…
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
This script was moved to
https://github.com/pklaus/pklaus/blob/master/pklaus/images/orphans/remove.py
Here's the original content left for you as a reference:
Do you own a DSLR? If so, do you transfer your images to your computer,
then look at the JPEGs and delete the crappy ones? If you do, your RAW
@pklaus
pklaus / About.md
Last active April 23, 2023 14:10
Plugable USB-BT4LE Bluetooth 4.0 USB Adapter

This is how the bluetooth stick shows up on my computer(s):

dmesg on Mac OS X 10.8.5:

[IOBluetoothHostControllerUSBTransport][ClearFeatureInterruptEndpointHalt] -- ClearPipeStall returned e000404f (kIOUSBPipeStalled)
[IOBluetoothHCIController::setConfigState] calling registerService
**** [BroadcomBluetoothHostControllerUSBTransport][start] -- Completed -- this = 0xffffff8060d6cc00 ****
[IOBluetoothHCIController][staticBluetoothHCIControllerTransportShowsUp] -- Received Bluetooth Controller register service notification -- controller = 0xffffff8060d6cc00
Using bluetooth controller switch policy "default"

[IOBluetoothHCIController::setConfigState] calling registerService

@pklaus
pklaus / ING-DiBa_cleanupCSV.py
Created December 11, 2011 02:45
Extrahieren der Transaktionen von der ING-DiBa Online-Banking Website mit __ALLEN__ Details (Kontonummern, BLZs). Dies ist ein Firefox-Makro geschrieben mit der Firefox-Erweiterung iMacros. Genaue Beschreibung unter http://goo.gl/nYdGO
#!/usr/bin/env python
# -*- encoding: UTF8 -*-
import sys
import re
def main(*args):
if len(args)<2:
usage_and_exit(args)
@pklaus
pklaus / addtomaildir.py
Created May 9, 2011 09:00
mb2md: convert mailbox to Maildir. See <http://www.gerg.ca/hacks/mb2md/>
#!/usr/bin/env python
"""addtomaildir
Reads an RFC 822 message (possibly with leading "From " line) on stdin
and adds it to a Maildir. The exact details of where it lands and what
it's called in the Maildir depend on various header values in the input
message:
* if no "Status" header, the message goes in "new", otherwise in "cur"
@pklaus
pklaus / embedding_in_qt5.py
Last active March 24, 2023 07:56
Embedding Matplotlib Plots in PyQt5
#!/usr/bin/env python
# embedding_in_qt5.py --- Simple Qt4 application embedding matplotlib canvases
#
# Copyright (C) 2005 Florent Rougon
# 2006 Darren Dale
# with Updates from @boxcontrol
# <http://www.boxcontrol.net/embedding-matplotlib-plot-on-pyqt5-gui.html>
# <https://github.com/boxcontrol/matplotlibPyQt5>
#
@pklaus
pklaus / NMEA Output.md
Created March 10, 2015 16:00
u-blox 7 GPS/Glonass Receiver G-7020 / VK-172

output of the command

screen /dev/ttyACM0 38400

without any prior special settings:

$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50
$GPTXT,01,01,02,HW  UBX-G70xx   00070000 *77
$GPTXT,01,01,02,ROM CORE 1.00 (59842) Jun 27 2012 17:43:52*59

$GPTXT,01,01,02,PROTVER 14.00*1E

@pklaus
pklaus / scpi-server.py
Last active February 21, 2023 06:03
Run an SCPI Server implemented in Python
#!/usr/bin/env python
"""
Run a multi-threaded single-client SCPI Server implemented in Python.
Using a single-client server is sensible for many SCPI servers
where state would need to be shared between the multiple clients
and thus access to it would need to be made thread-safe.
In most cases, this doesn't make sense. Everything is
simply much easier when allowing only one client at a time.
@pklaus
pklaus / rpi3-arch-linux-to-sdcard.sh
Last active February 3, 2023 01:58
Raspberry Pi 3: Arch Linux ARM 64bit to SDcard Script. This is for the Rapsberry Pi 3. For the RPi 2 (or the 3 32bit), see https://gist.github.com/pklaus/9dd4a7bf040788cda501 . For the RPi 1, see https://gist.github.com/pklaus/b92dfc72136d1509c2ed .
#!/bin/bash
# <https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3>
echo -e "\n\nArch Linux ARM to SD Card"
echo -e "For the Raspberry Pi 3, if you want to use the unofficial arm64 variant."
echo -e "(Otherwise use the Raspberry Pi 2 version of this script!)\n\n"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2