Skip to content

Instantly share code, notes, and snippets.

View sepastian's full-sized avatar
💭
\_ . |‾‾‾| o-`o

Sebastian Gassner sepastian

💭
\_ . |‾‾‾| o-`o
View GitHub Profile
@sepastian
sepastian / nmcli_eduroam_uni_passau.sh
Last active December 13, 2024 12:11
Add nmcli connection for eduroam at university of Passau
# 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 April 27, 2025 08:05
QEMU: Win10 guest on Debian host
@sepastian
sepastian / generate_user_credentials.py
Created December 10, 2020 15:01
Generate user credentials for Solr BasicAuthentication
#!/usr/bin/env python3
# Copyright 2020 Sebastian Gassner <[email protected]>
# 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 December 10, 2020 11:20
Query XML attribute value by xpath using xmllint and ignoring namespace
#!/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 December 9, 2020 15:07
rsync certain files by extension
# 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 January 24, 2025 13:21
Nikon D7000 full screen HDMI output

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 October 7, 2020 09:34
Remove exited docker containers.
#!/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 September 18, 2020 08:25
Unzip with correct encoding in filenames
#!/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.
#
@sepastian
sepastian / downgrade_debian.md
Last active March 26, 2025 17:38
Downgrade Debian
@sepastian
sepastian / mongo_dump_all_collections_to_json.sh
Last active June 18, 2020 09:36
Dump all Mongo collections to JSON files
#!/bin/bash
set -euo pipefail
docker_container=sipts-mongo
db=si-pts
target=$(mktemp -d "${db}_mongoexport_XXX")
echo "Dumping into ${target}."
docker exec "$docker_container" mongo --quiet \