Skip to content

Instantly share code, notes, and snippets.

🐍
Taming Python

Philipp Klaus pklaus

🐍
Taming Python
Block or report user

Report or block pklaus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pklaus
pklaus / fix_exif_timestamps.py
Last active Sep 25, 2018
fix_exif_timestamps
View fix_exif_timestamps.py
#!/usr/bin/env python
"""Recursively scan a directory tree, fixing dates
on all jpg/png image files.
Modifications are done in-place.
Requires: gexiv2
Loosely based on: http://coreygoldberg.blogspot.de/2014/01/python-fixing-my-photo-library-dates.html
"""
@pklaus
pklaus / LTSpice_RawRead.md
Last active Sep 25, 2018
Modified LTSpice_RawRead.py
View LTSpice_RawRead.md

Modified LTSpice_RawRead.py

Modified LTSpice_RawRead.py found on https://github.com/nunobrum/PyLTSpice as of 2018-04-25.

Changed to support exports like this:

python3 LTSpice_RawRead.py danitest.raw "V(vin),V(vc2),V(n001)" outfile.csv
@pklaus
pklaus / pg_test_fsync
Created Feb 24, 2018
PostgreSQL Benchmarks with pgbench and pg_test_fsync on an Intel Optane P900 480GB PCIe SSD (where the PostgreSQL instance is running in a Docker container with the PGDATA volume and the Docker image store located on the Optane SSD)
View pg_test_fsync
$ uname -a
Linux 5fc03a999611 4.15.3-2-ARCH #1 SMP PREEMPT Thu Feb 15 00:13:49 UTC 2018 x86_64 Linux
$ cat /etc/issue
Welcome to Alpine Linux 3.6
Kernel \r on an \m (\l)
$ pg_config --version
PostgreSQL 10.1
$ cd /var/lib/postgresql/data/
$ pg_test_fsync
@pklaus
pklaus / pg_test_fsync
Created Feb 24, 2018
PostgreSQL Benchmarks with pgbench and pg_test_fsync on an Intel Optane P900 480GB PCIe SSD
View pg_test_fsync
$ uname -a
Linux owl 4.15.3-2-ARCH #1 SMP PREEMPT Thu Feb 15 00:13:49 UTC 2018 x86_64 GNU/Linux
$ cat /etc/issue
Arch Linux \r (\l)
$ pg_config --version
PostgreSQL 10.2
$ cd /var/lib/postgres/data/
$ pg_test_fsync
5 seconds per test
@pklaus
pklaus / pg_test_fsync
Last active Feb 24, 2018
PostgreSQL Benchmarks with pgbench and pg_test_fsync on a SanDisk Ultra II 240GB SSD
View pg_test_fsync
$ uname -a
Linux owl 4.15.3-2-ARCH #1 SMP PREEMPT Thu Feb 15 00:13:49 UTC 2018 x86_64 GNU/Linux
$ cat /etc/issue
Arch Linux \r (\l)
$ pg_config --version
PostgreSQL 10.2
$ cd /var/lib/postgres/data/
$ pg_test_fsync
5 seconds per test
@pklaus
pklaus / README.md
Last active Feb 13, 2018
FHEM Auto FileLogConvert - A Python utility to convert all your logfiles one-by-one automatically with 98_FileLogConvert.pm
View README.md

fhem_auto_import2DbLog

If you want to convert the logs of your FHEM installation from FileLog to DbLog, you may use the excellent 98_FileLogConvert.pm.

What's a bit inconvenient is that each logfile conversion needs to be started by hand. This is the issue, this Python tool solves: You provide it a list of logfiles and the conversion is done one by one automatically.

Why was this tool written in Python (not Perl as FHEM itself)? Because the

@pklaus
pklaus / install-arch-linux-rpi-zero-w.sh
Last active Sep 28, 2018 — 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).
View install-arch-linux-rpi-zero-w.sh
#!/bin/sh -exu
dev=$1
cd $(mktemp -d)
function umountboot {
umount boot || true
umount root || true
}
# RPi1/Zero (armv6h):
View README.md

LUFFT_OPUS20 - EPICS IOC

Installation / Requirements

For this to work, you need some requirements as mentioned here:

  • Python 2.6+ including 3.x
  • Python headers (package name "python-dev" or similar)
  • SWIG 1.3.29+ (package name "swig")
@pklaus
pklaus / simplenote_backup.py
Last active Apr 13, 2018
A Python script for backing up your simplenote notes.
View simplenote_backup.py
#!/usr/bin/env python
import simplenote
import os, json
from datetime import date, datetime as dt
def main():
import argparse, getpass
parser = argparse.ArgumentParser()
@pklaus
pklaus / rpi3-arch-linux-to-sdcard.sh
Last active May 16, 2019
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 .
View rpi3-arch-linux-to-sdcard.sh
#!/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
You can’t perform that action at this time.