Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
\_ . |‾‾‾| o-`o

Sebastian Gassner sepastian

💭
\_ . |‾‾‾| o-`o
View GitHub Profile
View extract_pdf_images_in_parallel.sh
# For each page in input.pdf,
# generate image(s) in PNG format
# named output_<PAGE>.png
# where PAGE is a 4-digit zero-padded number.
pdfinfo input.pdf \
| grep Pages \
| awk -F'[: ]*' '{print $2}' \
| xargs seq \
| parallel \
'\
View konica_bizhub_364e_under_cups.txt
1. Download and install the official PPD files
See https://www.konicaminolta.de/de-de/support/download-center
Latest version at time of writting is `BH554ePPDLinux_300000000MU.zip`
2. Find out printer's IP address
On the printer, press
@sepastian
sepastian / nmcli_eduroam_uni_passau.sh
Created Dec 8, 2021
Add nmcli connection for eduroam at university of Passau
View nmcli_eduroam_uni_passau.sh
# Setup eduroam connection using personal certificate (802-1.x WPA EAP)
# at the University of Passau.
#
# PREREQUISITES
#
# Instructions based on "Manuelle Einrichtung" [1] and Stackoverflow [2].
#
# 0) mkdir ~/.eduroam # create dir holding certificate files
# 1) download private key in PKCS#12 format [3], save as ~/.eduroam/eduroam.p12
# 2) download radius root certificate [4], save as ~/.eduroam/radius_rootcert.pem
@sepastian
sepastian / qemu_win10_guest.md
Last active Feb 3, 2021
QEMU: Win10 guest on Debian host
View qemu_win10_guest.md
@sepastian
sepastian / generate_user_credentials.py
Created Dec 10, 2020
Generate user credentials for Solr BasicAuthentication
View generate_user_credentials.py
#!/usr/bin/env python3
# Copyright 2020 Sebastian Gassner <sebastian.gassner@gmail.com>
# License: MIT
# Based on java.org.apache.solr.security.Sha256AuthenticationProvider
#
# Usage: generate_user_credentials.py USER PASS
#
# Then add the output into security.json under 'credentials'.
@sepastian
sepastian / xml_attribute_ignoring_namespace.sh
Created Dec 10, 2020
Query XML attribute value by xpath using xmllint and ignoring namespace
View xml_attribute_ignoring_namespace.sh
#!/bin/bash
# See https://stackoverflow.com/questions/40796231/how-does-xpath-deal-with-xml-namespaces.
# To ignore namespaces use local-name(), for example:
#
# xmllint --xpath '//*[local-name()="structMap" and @TYPE="LOGICAL"]/*[local-name()="div"]/@TYPE' meta.xml
# Working example.
cat <<EOXML | xmllint --xpath '//*[local-name()="structMap" and @TYPE="LOGICAL"]/*[local-name()="div"]/@TYPE' -
<?xml version="1.0" encoding="UTF-8"?>
@sepastian
sepastian / rsync_by_ext.sh
Created Dec 9, 2020
rsync certain files by extension
View rsync_by_ext.sh
# From: https://stackoverflow.com/questions/11111562/rsync-copy-over-only-certain-types-of-files-using-include-option?answertab=active#tab-top
#
# -m avoids creating empty directories
#
# --include must be specified before --exclude
sudo rsync -avzm --include="*/" --include='meta.xml' --exclude="*" source/ target/
@sepastian
sepastian / nikon_d7000_hdmi.md
Last active Apr 18, 2022
Nikon D7000 full screen HDMI output
View nikon_d7000_hdmi.md

Purpose

Stream HDMI video from a Nikon D7000, for usage in online meetings, video recording, etc.

Based on this video on Youtube.

Steps

1) Download firmware

@sepastian
sepastian / docker_rm_exited_containers.sh
Created Oct 7, 2020
Remove exited docker containers.
View docker_rm_exited_containers.sh
#!/bin/bash
set -euo pipefail
IFS=$'\t\n'
docker rm \
$(docker ps -a | grep Exited | awk -F ' ' '{print $NF}')
@sepastian
sepastian / unzip_fix_encoding.sh
Created Sep 18, 2020
Unzip with correct encoding in filenames
View unzip_fix_encoding.sh
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Unzip a zipfile, then fix encoding in filenames.
#
# Assume filenames have been encoded with CP1250 (Win);
# convert encoding in filenames to UTF-8.
#