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 / print-png-label-to-networked-brother-label-printer.sh
Created December 23, 2016 00:45 — forked from StefanHamminga/print-png-label-to-networked-brother-label-printer.sh
Bash function to print black and white PNG (and JPEG, GIF, BMP) files to a networked Brother label printer (such as the QL-720NW)
# Print a black and white PNG file on the first available Brother label printer
# Requires https://github.com/pklaus/brother_ql
# Source (.) this file to set bash completion and add the print function.
function print-png-label() {
if [ -f "$1" ]; then
# Change these to match your printer:
local LBLPMODEL="QL-720NW"
local LBLPSIZE="62"
@pklaus
pklaus / pic_serve.py
Last active December 26, 2020 16:17
pic_serve - A very minimal image web server written in Python using bottle.py. Start by providing on the command line a folder containing albums (subfolders) of images to view. Use left right arrow to navigate pictures, up arrow key to go to a different album (randomly).
#!/usr/bin/env python
import sys, random, glob, os
from bottle import get, run, static_file, redirect, response
PAGE = """
<!doctype html>
<html lang=en>
<head>
@pklaus
pklaus / dmesg.4.7.6-1-ARCH.txt
Created November 2, 2016 17:16
USB Problems with Udoo Quad on Kernel 4.8.x
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.7.6-1-ARCH (builduser@leming) (gcc version 6.2.1 20160830 (GCC) ) #1 SMP Sat Oct 1 22:55:29 MDT 2016
[ 0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Udoo i.MX6 Quad Board
[ 0.000000] cma: Reserved 24 MiB at 0x4e800000
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node 0 totalpages: 262144
[ 0.000000] free_area_init_node: node 0, pgdat c11dd000, node_mem_map ef6f8000
[ 0.000000] Normal zone: 1728 pages used for memmap
@pklaus
pklaus / rec_unlimited.py
Last active January 16, 2021 14:36
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
#!/bin/bash
ttfinfo() {
ttf2pt1 -pft -Gf -Ouost "$1" - 2>/dev/null | \
gawk '/\/FullName/ {
print gensub(".*/FullName.*\\(([^)]*)\\)([[:space:]]readonly)?[[:space:]]+def[[:space:]]*.*", "\\1", 1, $0);
}'
}
type1info() {
@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
"""
@pklaus
pklaus / list_otf_font_names.py
Created January 4, 2016 12:40
List the names of OpenType (.otf) fonts in a directory (and optionally rename them accordingly).
#!/usr/bin/env python
""" Taken from http://stackoverflow.com/a/23703564/183995 """
import os, sys, argparse
from bitstring import BitStream
parser = argparse.ArgumentParser()
parser.add_argument('folder')

Open Ports on the Network

  • 80
  • 631
  • 9100

By default, the mDNS name is Brother QL-710W.

Protocols:

@cboettig
cboettig / docker-compose.yml
Last active December 31, 2023 15:23
debugging NGINX configuration for Jupyter
jupyter:
image: jupyter/datascience-notebook
environment:
- PASSWORD=${PASSWORD}
nginx:
image: nginx
links:
- jupyter
@pklaus
pklaus / README.md
Last active June 2, 2020 22:36
Easterntimes Tech Wired Gaming Mouse T1

Easterntimes Tech - Wired Gaming Mouse T1

A script to change settings of the Wired Gaming Mouse T1 when running Linux.