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 / 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 / ddnsserver.py
Last active January 14, 2025 18:46 — 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 / 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 / Hardware of Mac Mini 2018 as seen by Linux.md
Last active January 11, 2025 16:54
Hardware of Mac Mini 2018 as seen by Linux

Hardware of Mac Mini 2018 as seen by Linux

The operating system used is Arch Linux w/ Kernel 5.2.2-arch1-1-ARCH.

Issues:

  • Fan control isn't working (s the system gets hot) as the applesmc module doesn't load, see this gist.
  • As the internal SSD is hidden behind the encryption done by the T2 chip, the Linux system has to be on some external storage. For now, I'm using my M.2 SSD on a IB-1817M-C31 USB-C Case. This connection resets sometimes (~ 3x per hour resulting in system stall of ~1 min). See this gist
@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. #
@pklaus
pklaus / PfeifferVacuum.py
Created November 19, 2011 10:23
Python Code to communicate with the 6 channel Pfeiffer Vacuum TPG256A MaxiGauge pressure gauge controller via a serial connection
#!/usr/bin/env python
# -*- encoding: UTF8 -*-
# Author: Philipp Klaus, philipp.l.klaus AT web.de
# This file is part of PfeifferVacuum.py.
#
# PfeifferVacuum.py is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@pklaus
pklaus / bird6.conf
Created December 17, 2012 01:38
A configuration file for the bird routing daemon being set up to work with OSPFv3 (the IPv6 variant).
log syslog all;
router id 0.0.0.159;
# Turn on global debugging of all protocols
debug protocols all;
# Define a route filter...
# filter test_filter {
# if net ~ 10.0.0.0/16 then accept;
@pklaus
pklaus / ddns.py
Last active November 10, 2024 02:57
A script to update the A and AAAA RRs of HOSTNAME on a DNS server according to your current external IP address using nsupdate / TSIG. This script is tested to run on Mac OS X (10.8-10.9) but you should be able to get it up and running in almost no time on any Unix or Linux system that ships nsupdate. I use this script to update my own DDNS serv…
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Written on 2013-02-04 by Philipp Klaus <philipp.l.klaus →AT→ web.de>.
Check <https://gist.github.com/4707775> for newer versions.
Uses dnspython: install with `pip install dnspython3`
"""
@pklaus
pklaus / create_keys_for_client.sh
Created May 2, 2011 22:06
Automation for client files creation on OpenVPN setup
#!/bin/bash
# <http://blog.philippklaus.de/2010/09/openvpn/>
set -x
#SERVERNAME=$(hostname)
SERVERNAME=$(ifconfig | grep -A 5 eth0 | grep -w 'inet addr' | tr '\t' ' ' | cut -d ':' -f 2 | cut -d ' ' -f 1)
read -e -p "Please enter the server you want your clients to connect to [default: $SERVERNAME]: " input
SERVERNAME="${input:-$SERVERNAME}"
@pklaus
pklaus / enumerate_interfaces.py
Last active October 1, 2024 19:51
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