Skip to content

Instantly share code, notes, and snippets.

View klingtnet's full-sized avatar
a damn fine cup of coffee

Andreas Linz klingtnet

a damn fine cup of coffee
View GitHub Profile
### Keybase proof
I hereby claim:
* I am klingtnet on github.
* I am klingtnet (https://keybase.io/klingtnet) on keybase.
* I have a public key whose fingerprint is F1E8 B1CC E0B7 FBF0 8E7E 33A2 A57E A370 7387 1146
To claim this, I am signing this object:
@klingtnet
klingtnet / cm13-wifi-fix.md
Last active October 8, 2016 10:58
How to update CM nighly builds

These instrctions may only work the phone I used, a Samsung N7105 aka t0lte but should be applicable to other models with minor modifications. Make sure that you have adb available, e.g. by installing the android-tools package in Arch linux.

Now, download the latest nighly release (image and recovery): $ wget 'https://download.cyanogenmod.org/get/t0lte-latest.zip' && wget 'https://download.cyanogenmod.org/get/t0lte-latest-recovery.img'

Extract the boot image from the release archive; If you forgot to do this, then you will encounter random errors like that you can't enable wifi anymore, and trust me I've lost some hours of my life fixing this issue :( $ unzip t0lte-latest.zip boot.img

Reboot you phone into recovery:

@klingtnet
klingtnet / vim-overview.md
Created November 7, 2016 11:05
An overview of vim and a list of important commands with examples

vim notes

  • the following notes are derived from this awesome presentation
  • a modal text editor
  • modes:
    • normal (default on start)
    • insert
    • visual
    • command mode
  • don't use the arrow keys
@klingtnet
klingtnet / enable-hibernate-arch-linux.md
Created November 22, 2016 17:23
Enable hiberate in Arch Linux usind kernel 4+, grub2 and a swapfile

This guide is based on the hibernate article from the Arch wiki.

  • edit /etc/default/grub and add resume as well as resume_offset kernel parameters
    • resume=UUID=abcd-efgh contains the UUID of the partition on which the swapfile resides. In most cases the swapfile resides in root, to identify the root parition's UUID run blkid or lsblk -O.
    • resume_offset=1234 is the offset of the swapfile from the partition start. The offset is the first entry in the physical_offset column of the output of filefrag -v /swapfile.
    • update grub: grub-mkconfig -o /boot/grub/grub.cfg
    • example: GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=75972c96-f909-4419-aba4-80c1b74bd605 resume_offset=1492992"
  • add the resume module hook to /etc/mkinitcpio.conf:
    • HOOKS="base udev resume autodetect ...
  • rebuild the initramfs mkinitcpio -p linux
@klingtnet
klingtnet / gnumake-environment-variable-conditional.md
Last active January 12, 2017 11:38
GNU Make: Branch if an environment variable is set
.PHONY: all

ifdef IFSETUSEMYVALUE
FOO:=$(IFSETUSEMYVALUE)
else
FOO:="another value"
endif

all:
@klingtnet
klingtnet / single-vs-double-brackets.md
Last active February 24, 2017 20:42
Evaluation differences between `[[` and `[` in bash

I have two scripts, the first has some conditional expression using the single bracket (POSIX) notation [, the second is using bash style double brackets. Both scripts look functionally equivalent but the first returns exit code 0 and the second exit code 1.

$ cat single-square-bracket.sh
#!/bin/bash

value=0

if [ $value -ne 0 ]; then
@klingtnet
klingtnet / firewire-audio-interface-jack2-linux.md
Last active November 16, 2023 09:38
Use firewire audio interface with JACK2 in Arch Linux
  • Blacklist firewire sound kernel modules to prevent ALSA and PulseAudio from managing them by creating a file like /etc/modprobe.d/blacklist-snd-firewire.conf:
# This fixes the usage of firewire soundcards with Jack by
# preventing ALSA from handling the device.
# Only modules used for the Edirol FA-66 are blacklisted.
#
# For details refer to:
# https://wiki.archlinux.org/index.php/JACK_Audio_Connection_Kit
# https://github.com/takaswie/snd-firewire-improve/blob/315dcdc4e430d44a6e109a015beecb8515fbe634/sound/firewire/Kconfig
# ~/.config/systemd/user/jupyter.service
[Unit]
Description=An interactive python notebook server
After=network.target

[Service]
ExecStart=/usr/bin/jupyter notebook\
    --no-browser\
 --port=58080\
@klingtnet
klingtnet / journalctl.log
Last active March 15, 2017 19:20
hibernation-freeze.log
Mar 15 00:17:40 kn-elitebook systemd[1]: Reached target Sleep.
Mar 15 00:17:40 kn-elitebook systemd[1]: Starting Hibernate...
Mar 15 00:17:40 kn-elitebook systemd-sleep[4892]: Suspending system...
Mar 15 00:17:40 kn-elitebook kernel: PM: Hibernation mode set to 'platform'
Mar 15 18:27:32 kn-elitebook kernel: PM: Syncing filesystems ...
Mar 15 18:27:32 kn-elitebook kernel: done.
Mar 15 18:27:32 kn-elitebook kernel: Freezing user space processes ... (elapsed 0.001 seconds) done.
Mar 15 18:27:32 kn-elitebook kernel: PM: Marking nosave pages: [mem 0x00000000-0x00000fff]
Mar 15 18:27:32 kn-elitebook kernel: PM: Marking nosave pages: [mem 0x0009d000-0x000fffff]
Mar 15 18:27:32 kn-elitebook kernel: PM: Marking nosave pages: [mem 0xdfde0000-0xffffffff]
@klingtnet
klingtnet / signal-handler.py
Created May 9, 2017 10:54
Python signal handling
#!/usr/bin/env python3
import signal
import sys
import time
def handler(signr, stackframe):
print("Killed with {}".format(signr))
sys.exit(1)