Skip to content

Instantly share code, notes, and snippets.


Markus Linnala maage

  • Cybercom Finland Oy
  • Finland
View GitHub Profile
maage / rtc-ds3231-ubuntu-19.10-rpi4.txt
Created Jan 19, 2020
High Accuracy Pi RTC (DS3231) installation in Ubuntu 19.10 in Raspberry Pi 4 Model B Rev 1.1
View rtc-ds3231-ubuntu-19.10-rpi4.txt
Base instructions are here:
But I've diverted my setup procedure somewhat because Ubuntu boot setup is different than Raspbian and setup does some things not needed.
To use RTC early in the boot add "fixrtc" to kernel boot command line. Correct file is "/boot/firmware/nobtcmd.txt".
This is implemented in "/usr/share/initramfs-tools/scripts/local-premount/fixrtc".
maage /
Last active Nov 18, 2018
How to handle \0 in bash
set -x
declare -a str
read_w_null() {
local a
while [ 1 = 1 ]; do
if IFS= read -r -d '' a; then
maage /
Last active Nov 16, 2018
Fix %config(noreplace) files without reinstalling package

You can fix %config(noreplace) files without deleting and reinstalling. If package is not essential, it is easiest way. But for every essentia package/config file it is not recommended to remove them.

Run this as root to preserve users and other stuff. Download package. Unpack it. Move files to fix over old ones. You need also to copy selinux context and maybe capabilities. Cpio does not know about them. You need to set them by hand before moving file in place.

You also need to copy file attributes, extended attributes and ACL entries if there is some.

sudo -i
maage / wpa_cli-raspbian9-example.txt
Last active Apr 27, 2018
wpa_cli with raspberrypi 3 raspbian 9 / stretch
View wpa_cli-raspbian9-example.txt
# You can use tab and partial match if unique
# show encoded passphrases
% wpa_passphrase 'SSID1' 'pass1'
% wpa_passphrase 'SSID2' 'pass2'
# Without these this data is saved into history file
# Need to define interface as /run/wpa_supplicant/ has p2p-dev-wlan0 to mess things up
% sudo wpa_cli -i wlan0
# If status is DISCONNECT, then you have device wrong or something wrong with the device.
maage / gist:c2c99571a17323466f02
Created Mar 6, 2016
Unstuck chrome after screenlock
View gist:c2c99571a17323466f02
# [13691:13691:0306/] glXGetSyncValuesOML should not return TRUE with a media stream counter of 0.
pkill -HUP -f '/chrome --type=gpu-process'