Skip to content

Instantly share code, notes, and snippets.

@xnumad
xnumad / rquickshare-nixos.md
Last active August 6, 2024 07:20
Build RQuickShare on NixOS
@xnumad
xnumad / android-restore-backup.md
Created January 25, 2022 01:50
Restore Android backup on an already set up phone

Before you read

Everything is covered here https://android.stackexchange.com/a/213374

Only addition is the "Restore process" chapter.

Problem

Google Support makes it sound like you can only restore the backup on setup.

At setup, to restore your data, follow the on-screen steps.

@xnumad
xnumad / dyndns-ipv6.sh
Last active July 18, 2022 18:55
IPv6 Dynamic DNS shell script for nsupdate.info derived from https://www.krausmueller.de/en/2017/07/04/dynamic-dns-client-for-ipv6/
#!/bin/bash
#Source: https://www.krausmueller.de/en/2017/07/04/dynamic-dns-client-for-ipv6/
HOSTNAME=""
PASSWORD="token"
USER=HOSTNAME
CACHE_FILE="/tmp/update_ipv6_cache"
while getopts ":d" opt; do
case $opt in
@xnumad
xnumad / Linux vpn same subnet route.md
Created March 31, 2021 08:52
Route configuration to access the same subnet as your normal one over a VPN (prefer VPN routes/subnet)
Address Netmask Gateway Comment
192.168.1.1 255.255.255.255 192.168.1.1 Adds the router/gateway only
192.168.1.0 255.255.255.0 192.168.1.1 Adds the subnet
@xnumad
xnumad / ChromeOS-Desks-limitations
Last active April 10, 2022 19:39
ChromeOS Desks feature and its limitations
Desks are not being synced across Chromebooks
Shelf (taskbar) can't be set/customized to only display open application icons from the same desk
Fixed in ChromeOS 89:
On Chrome session restore (e.g. after crash), restored windows are all being placed on the first desk (i.e. all other desks are empty)
"When you reboot, your windows will restore to their previous desks so your workflow isn’t interrupted." - https://www.google.com/chromebook/whatsnew/
Maximum amount of desks you can have is 4 (limit is hindering for categorizing)
Was increased to 8 (I still sometimes reach this limit)
@xnumad
xnumad / partition-table.md
Last active October 25, 2020 18:40
Restoring a deleted partition table

This is about a drive with MBR/DOS partition table and a NTFS partition on which I accidentally overwrote the partition table with fdisk /dev/sdb and then pressing g (new GPT partition table) and w (write changes to disk).

Luckily, I still had a terminal open, where I had the partition table (from fdisk -l) printed before I created a new one that overwrote it:

Disk /dev/sdb: 931,51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: 2115            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
@xnumad
xnumad / homematic-action.bash
Last active February 19, 2021 14:15
Bash shell script to run a desired action on a HomeMatic CCU
#!/bin/bash
ccuip="192.168.178.XX" # private/LAN (this way, the action can't be executed outside the home network, except if you happen to be connected to it via a VPN) IP address of your HomeMatic CCU
action="<prototypejs><![CDATA[<YOUR ACTION>]]></prototypejs>" # Copy the action request data from browser dev tools
# Fetch session id
sid=$(curl -sD - "http://${ccuip}/pages/index.htm&client=3" | sed -n "s/^.*\(sid.*\)$/\1/p"); # Only if automatic login is activated on your CCU, this request will receive a response with a session id (sid) which can be found by sed # If you run this script too often (multiple times within a short period), the CCU will not respond with new sids due to "too many connections" for a few minutes.
sid="${sid//[$'\t\r\n ']}"; # sanitize: filter out \t,\r,\n,space chars
# Request desired action, e.g. "open door" on a KeyMatic lock
#!/bin/bash
_fileloc=$HOME/lqxcheck #Where to keep the pkgs
_CHROOT=$HOME/chroot #Where do you want the chroot
_nproc=$(nproc) #How many threads to compile on
if [[ $EUID -ne 0 ]]; then
echo "Give me the root password:"
sudo echo "Thanks"
fi
@xnumad
xnumad / whatsapp-backup.md
Created October 22, 2019 22:45
WhatsApp message backup and restore process

If you activate WhatsApp (verifying your phone number) while having a /sdcard/WhatsApp/Databases/msgstore.db.crypt12 file present AND have a WhatsApp backup on Google Drive, WhatsApp will claim to restore your Google Drive backup (with your consent), but it only restores the media files from Google Drive but at no occassion the msgstore.db.crypt12. It won't merge your local backup and the cloud backup databases!

With local WhatsApp media files it will only offer to restore the local backup at activation but not the one from Google Drive, hence the need for an empty /sdcard/WhatsApp/Media/ folder. But with a local chat backup, the Google Drive backup restore process just imports media only anyways.

Ways to get to the key file to decrypt the *.crypt12 DBs:

  • either access /data/data/com.whatsapp/files/key with root permissions
  • OR adb backup com.whatsapp and extract the key from the .ab file

I have extracted the key and found out that it's the same for all my devices (*I always tested wi

@xnumad
xnumad / plasmashell-autostart.md
Created August 4, 2019 01:40
KDE Plasma login doesn't automatically start plasmashell

Problem

  • Plasmashell doesn't start automatically after log-in
  • [optional] Windows of applications of previous sessions are restored which indicates that kwin loads/starts and is working automatically.
  • Condition: Manually executing kstart5 plasmashell works as intended. If this is not the case, the solution will very likely not help you!

Solution

Open "System Settings -> Startup and Shutdown -> Autostart -> Add Program" and add plasmashell (manually write it into the text field in the dialog window). (File saved in ~/.config/autostart)

Cause

The old autostart file only had the content