Skip to content

Instantly share code, notes, and snippets.

Markus Linnala maage

  • Cybercom Finland Oy
  • Finland
View GitHub Profile
@maage
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:
http://wiki.seeedstudio.com/High_Accuracy_Pi_RTC-DS3231/
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
maage / bash-bin-zero.sh
Last active Nov 18, 2018
How to handle \0 in bash
View bash-bin-zero.sh
#!/bin/bash
set -x
declare -a str
read_w_null() {
local a
while [ 1 = 1 ]; do
if IFS= read -r -d '' a; then
str+=("${a}x")
@maage
maage / rpm-config-noreplace.md
Last active Nov 16, 2018
Fix %config(noreplace) files without reinstalling package
View rpm-config-noreplace.md

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
f=<file-wo-first-slash>
@maage
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
% HISTFILESIZE=0
% HISTSIZE=0
# 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
maage / gist:c2c99571a17323466f02
Created Mar 6, 2016
Unstuck chrome after screenlock
View gist:c2c99571a17323466f02
# [13691:13691:0306/220606:ERROR:sync_control_vsync_provider.cc(63)] glXGetSyncValuesOML should not return TRUE with a media stream counter of 0.
pkill -HUP -f '/chrome --type=gpu-process'
You can’t perform that action at this time.