This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Annotate images with respective filename. | |
# Note: quotes must be escaped, or parallel will 'swallow' them... | |
find height_1000 -type f -name '*png' \ | |
| parallel convert \ | |
-verbose \ | |
-background \'#0009\' \ | |
-gravity center \ | |
-fill white \ | |
caption:\"{/}\" \ | |
{} \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Customize colors in Emacs with M-x customize-face. | |
# | |
# From: https://stackoverflow.com/a/41840175/92049 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use a DSLR camera as a webcam, in Zoom and other applications. | |
# Inputs from https://gist.github.com/ianmackinnon/cf8a4d6cdb08852a818fc34bd4e1882f | |
# See # https://gstreamer.freedesktop.org/documentation/video4linux2/v4l2sink.html?gi-language=c#v4l2sink | |
# Install dependencies. | |
sudo apt install v4l2loopback-dkms gphoto2 gstreamer1.0-tools | |
# Load and verify module. | |
sudo modprobe v4l2loopback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
unzip file.zip | |
# Show what would be renamed. | |
convmv -f cp-1521 -t urf-8 * | |
# Do the renaming. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
# Record the screen into an h264 encoded MP4. | |
# Determing video resolution from the screen being recorded. | |
# | |
# Required gst-launch and xrandr. | |
# | |
# Based on https://stackoverflow.com/a/33822024/92049 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Record audio that is currently output. | |
# From https://askubuntu.com/questions/229352/how-to-record-output-to-speakers | |
sudo apt-get install pulseaudio-utils lame mpg123 | |
pacmd list-sinks | grep -e 'name:' -e 'index' -e 'Speakers' | |
parec -d alsa_output.pci-0000_00_1f.3.analog-stereo.monitor | lame -r -V0 - out.mp3 | |
# ctrl + c to stop recording | |
mpg123 out.mp3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSH into remote host "R", startup Jupyter on port XXXX. | |
ssh [email protected] | |
jupyer notebook --no-browser --port=XXXX | |
# On the localhost "L", accessing jupyter via the browser: | |
# create a reverse tunnel, forwarding YYYY (L) to XXXX (R). | |
ssh -N -L YYYY:localhost:XXXX [email protected] | |
---- --------- ---- | |
| | | | |
| | ` port on remote where Jupyer is listening |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Current directory contains a folder named 'img', | |
# which contains images nested in subfolders, e.g. | |
# | |
# img | |
# folder1 | |
# img1.jpg | |
# img2.jpg | |
# folder2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using go get can be confusing, here's what I learned. | |
# | |
# When go get ./... failed in a Dockerfile on Dockerhub, I listed and installed dependencies manually. | |
# Inspired by https://dave.cheney.net/2014/09/14/go-list-your-swiss-army-knife | |
# | |
# Recursively search for dependencies in $GOPATH/src; install dependencies using go get. | |
find "${GOPATH}/src" -type d \ | |
-exec go list -f '{{ join .Imports "\n" }}' -e {} + \ | |
| sort -u \ | |
| xargs go get -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, install certificate with https://www.zim.uni-passau.de/dienstleistungen/netzwerk-und-server/netzwerkzugang/eduroam/fuer-uniangehoerige/linux/ | |
# This will created ~/.cat_installer/user.p12 and ~/.cat_installer/ca.pem, which are the certificates required to connect. | |
# Create eduroam config for wpa_supplicant. | |
# ZIMID is your ZIM identifier, e.g. abcdef99 | |
cat > /tmp/eduroam.conf <<EOF | |
network={ | |
ssid="eduroam" | |
key_mgmt=WPA-EAP | |
pairwise=CCMP |