Skip to content

Instantly share code, notes, and snippets.


Anton Friberg AntonFriberg

  • Lund University, Axis Communications
  • Malmö, Sweden
View GitHub Profile
AntonFriberg / fonts.conf
Created Jun 4, 2017
Debian better font rendering
View fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<match target="font">
<edit mode="assign" name="rgba">
<match target="font">
<edit mode="assign" name="hinting">
AntonFriberg / Dockerfile
Last active Apr 9, 2021
Simple docker cron sidecar container based on alpine image
View Dockerfile
FROM alpine:3.8
# Alpine comes with built in cron schedules
# min hour day month weekday command
# */15 * * * * run-parts /etc/periodic/15min
# 0 * * * * run-parts /etc/periodic/hourly
# 0 2 * * * run-parts /etc/periodic/daily
# 0 3 * * 6 run-parts /etc/periodic/weekly
# 0 5 1 * * run-parts /etc/periodic/monthly
AntonFriberg /
Last active Aug 1, 2018
Minikube install using kvm2 behind coorporate proxy on Debian stretch
set -e
echo "Installing kubectl $KUBECTL_VERSION and minikube $MINIKUBE_VERSION"
echo "Setting proxy settings including minikube ip range"
export no_proxy=localhost,,,
export NO_PROXY=$no_proxy
AntonFriberg /
Last active Mar 18, 2020
Asian Characters ArchLinux

In order to get Asian Characters to render properly on ArchLinux you need to install a font which supports them. Even if you cannot read any of the characters I find it useful to have them installed to get wikipedia articles on geographical locations to render properly.

In order to cover most of Asia I installed the following fonts:

  • adobe-source-han-serif-cn-fonts
  • adobe-source-han-serif-jp-fonts
  • adobe-source-han-serif-kr-fonts
AntonFriberg /
Created Sep 6, 2018
Connect to eduroam on Lund University with NetworkManager
nmcli con add \
type wifi \
con-name "eduroam"
ifname "wlp4s0" \ # Your wifi interface
ssid "eduroam" \
wifi-sec.key-mgmt "wpa-eap" \
802-1x.identity "<YOUR-STUDENT-ID>" \ # May also use another university identification
802-1x.password "<YOUR-PASSWORD" \
802-1x.system-ca-certs "yes" \
802-1x.domain-suffix-match "" \
AntonFriberg /
Last active Nov 13, 2018
Two Chrome Kiosk Screens Autodeployed on Debian Gnome
# Set correct display to launch the windows over ssh connection
export DISPLAY=:0
# Fixes autologin errors under gnome
AntonFriberg /
Created May 3, 2019
Polybar install on Debian Stretch

Polybar install on Debian Stretch

Install dependencies including libxcb-composite0-dev which is sometimes not mentioned.

$ sudo apt-get install cmake cmake-data libcairo2-dev libxcb1-dev libxcb-ewmh-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-randr0-dev libxcb-util0-dev libxcb-xkb-dev pkg-config python-xcbgen xcb-proto libxcb-xrm-dev i3-wm libasound2-dev libmpdclient-dev libiw-dev libcurl4-openssl-dev libpulse-dev libxcb-composite0-dev

Clone the official [Polybar repository].

AntonFriberg / about:config
Created May 10, 2019
Fix Firefox right-click menu with i3 Window Manager
View about:config
AntonFriberg /
Last active Dec 26, 2020
Extract key value pairs from string with quotes in Python 3
"""Extract key value pairs in Python 3 using shlex and regex."""
import re
import shlex
def regex_kv_pairs(text, item_sep=r"\s", value_sep="="):
Parse key-value pairs from a shell-like text with regex.
This approach is ~ 25 times faster than the shlex approach.
AntonFriberg /
Created Dec 4, 2019
S3 partition extraction in Python
import re
regex = r"(year|month|day|hour)=(\d+)"
test_str = "s3://bucket/datalake/year=2019/month=12/day=02/hour=06"
matches = re.finditer(regex, test_str)
partition = { int( for match in matches}
# {'year': 2019, 'month': 12, 'day': 2, 'hour': 6}