Skip to content

Instantly share code, notes, and snippets.

Avatar

Anton Friberg AntonFriberg

  • Lund University, Axis Communications
  • Malmö, Sweden
View GitHub Profile
@AntonFriberg
AntonFriberg / install-swerty-altgr-working.md
Last active Jan 19, 2021
Swerty Keyboard Layout with working Alt-Gr on Linux Debian 10
View install-swerty-altgr-working.md

Background

The Swerty keyboard layout is created by Johan E. Gustafsson and hosted on http://johanegustafsson.net/projects/swerty/

Swerty is released under the MIT Licence.

Since I spend a lot of time getting the right alt-gr key to work I decided to share back my fixes.

Installation

@AntonFriberg
AntonFriberg / install.md
Last active Oct 25, 2020
Samsung ML-2160 printer install on Arch Linux
View install.md

How to install Samsung ML-2160 in Arch Linux

In order to use a USB connected Sasmung ML-2160 printer in Arch Linux you will need to first install the correct drivers. For this perticular printer the drivers are included in the samsung-unified-printer AUR package.

If you know what you are doing I recommend installing it using a AUR helper such as yay.

@AntonFriberg
AntonFriberg / fonts.conf
Created May 28, 2020
Fix ugly Calibri, Cambria font rendering on Linux
View fonts.conf
<!-- Add this to your font configuration e.g ~/.config/fontconfig/fonts.conf -->
<!-- Note that this will disable all embedded bitmaps in fonts that use them -->
<!-- disable embedded bitmaps in fonts to fix Calibri, Cambria, etc. -->
<match target="font">
<edit mode="assign" name="embeddedbitmap"><bool>false</bool></edit>
</match>
@AntonFriberg
AntonFriberg / emoji.md
Last active May 22, 2020
Emoji Test String
View emoji.md

😀 😃 😄 😁 😆 😅 🤣 😂 🙂 🙃

@AntonFriberg
AntonFriberg / arch-linux-install.md
Last active May 13, 2020 — forked from kylemanna/arch-linux-install.md
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
View arch-linux-install.md
@AntonFriberg
AntonFriberg / pyproject.after.toml
Last active Apr 7, 2020
bug report pyproject.toml
View pyproject.after.toml
[tool.poetry]
name = "application"
version = "1.0"
description = "An application."
authors = ["Anton Friberg <anton.friberg@example.com>"]
readme = "README.md"
[tool.poetry.scripts]
# Allow default command line entrypoint https://stackoverflow.com/a/55065934
etl = "etl.__main__:cli"
@AntonFriberg
AntonFriberg / respect_xorg_conf.md
Created Mar 11, 2020 — forked from JonasAlfredsson/respect_xorg_conf.md
Make Cinnamon/Gnome respect the /etc/X11/xorg.conf file instead of ~/.config/displays.xml
View respect_xorg_conf.md

Make Cinnamon/Gnome/Mate Respect xorg.conf

By default the Cinnamon/Gnome/Mate desktop environment loads its own display configuration from the file ~/.config/monitors.xml instead of using the settings defined in /etc/X11/xorg.conf. This can be a little bit annoying if you are using the nvidia-settings program to configure your displays (which will use xorg.conf), since anything entered there will be overridden by monitors.xml every reboot.

By doing the following changes we will disable the "Display Manager" in

@AntonFriberg
AntonFriberg / test_partition_extract.py
Created Dec 4, 2019
S3 partition extraction in Python
View test_partition_extract.py
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 = {match.group(1): int(match.group(2)) for match in matches}
print(partition)
# {'year': 2019, 'month': 12, 'day': 2, 'hour': 6}
@AntonFriberg
AntonFriberg / parse_key_value_pairs.py
Last active Dec 26, 2020
Extract key value pairs from string with quotes in Python 3
View parse_key_value_pairs.py
"""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
AntonFriberg / about:config
Created May 10, 2019
Fix Firefox right-click menu with i3 Window Manager
View about:config
ui.context_menus.after_mouseup=true