Skip to content

Instantly share code, notes, and snippets.

@ruario
ruario / symlinks-7z.md
Last active December 4, 2025 18:04
A simple shell‑based workaround for archiving projects with symlinks in formats that don’t preserve them (e.g. .7z or certain .zip files). It generates a script that records all symlinks and could then be used later to recreate them after extraction.
@ruario
ruario / tar_gzip_commands.txt
Last active December 3, 2025 08:27
A sub selection of commands that would make a tar.gz archive from the contents of folder using GNU tar and gzip (there are more ways than this… there are ALWAYS more 🤣)
tar -a -c -f archive.tar.gz folder
tar -a -c -farchive.tar.gz folder
tar -a -cf archive.tar.gz folder
tar -a -cfarchive.tar.gz folder
tar -ac -f archive.tar.gz folder
tar -ac -farchive.tar.gz folder
tar -acf archive.tar.gz folder
tar -acfarchive.tar.gz folder
tar a -c -f archive.tar.gz folder
tar a -c -farchive.tar.gz folder
@ruario
ruario / mac_keyboard_tweaks.md
Last active October 9, 2025 09:10
Norwegian Macbook Keyboard Tweaks (Ubuntu 24.04)

Norwegian Macbook Keyboard Tweaks (Ubuntu 24.04)

This patch modifies the Norwegian Macintosh keyboard layout on Ubuntu Linux to better match that of a modern Macbook's physical labels and expectations:

  • Replaces | (pipe) with ' (apostrophe) as the primary symbol for the key below esc
  • Promotes $ to Shift+4
  • Introduces as AltGr+4
  • Demotes ¤ (currency) to Shift+AltGr+4 (since this is hardly used these days)
  • Swaps the order of the dead keys of the ´ (acute) and ​`​ (grave) acents on the key to left of backspace
  • Enables access to higher level symbols by setting the right-most Alt ⌥ (Option) key as AltGr
@ruario
ruario / cnvtlag.sh
Last active December 24, 2024 11:12
A script fetch and convert a Lagrange AppImage to a system installable package
#!/bin/sh -eu
# A script convert a Lagrange AppImage to a system installable package
# Determine if a local package should be used or if one should be fetched
if [ -n "${1:-}" ]; then
APPIMAGE="$1"
else
case "$(uname -m)" in
arm*) APPIMAGE_ARCH=armhf ;;
*) APPIMAGE_ARCH="$(uname -m)" ;;
@ruario
ruario / terminal-beats.md
Last active March 24, 2024 13:32
Swatch .beats to centibeat level from the terminal

To print the time in Swatch .beats from the terminal, issue the following:

printf @;TZ=UTC-1 date '+scale=2;((%H*60+%M)*60+%S)/86.4'|bc

You can save this as a shell alias so that you can check the time in .beats whenever you like alias beat="printf @;TZ=UTC-1 date '+scale=2;((%H*60+%M)*60+%S)/86.4'|bc".

Notes:

@ruario
ruario / make_dated_directory.md
Last active March 24, 2024 22:20
This script creates a directory named with the current date, followed by the current Swatch .beat (down to "decibeat" level, which gives ≈ 9 seconds of time resolution)

This is a short shell script to make date named directories.

#!/bin/sh
a=`TZ=UTC-1 date +%y%m%d-%T`;b=${a#*-};c=${b#*:}
mkdir -v ${a%-*}`printf %04d $(echo "((${b%%:*}*60+${c%:*})*60+${c#*:})/8.64"|bc)`|grep -Eo \[0-9]+

Usage

@ruario
ruario / 1-signal-linux-manual-unpack.md
Last active November 6, 2025 10:21
Steps to fetch and run Signal on a Linux desktop that is not deb or apt based

The following is a quick guide on how to manually download, extract and run Signal for Linux on a non-(deb)apt based distro (and includes a shell script that automates the entire process). This is for use when no suitable, native (re)package is available. It also includes some additional instructions on how to integrate with your desktop environment. Almost any recent distro (configured for desktop use) will likely have all the dependencies already installed—especially so if you already have any other Electron apps or a Chromium based browser installed, since they will require the same things.

[Note: Triple-click to easily select any of the lines below for copy and pasting into the terminal]

Fetch, extract and launch

  • Switch to a directory you think is suitable for housing Signal (for example ~/opt)
mkdir -p ~/opt && cd ~/opt
@ruario
ruario / dtime.sh
Created October 16, 2023 13:29
Show the current Decimal time or convert from "Standard time" to Decimal time
#!/bin/sh -eu
# Check for -s as an argument and if so convert decimal time to 'standard time'
if [ "${1-}" = '-s' ]; then
if [ -n "${2-}" ]; then
TIME_IN_SECS="$(echo 864*$(echo "$2" | tr -d :)/10 | bc)"
if [ "$(uname -s)" = Darwin ]; then
date -j -f "%s" "$(expr $(date -j -f '%H:%M:%S' '00:00:00' '+%s') + $TIME_IN_SECS)" '+%H:%M'
exit 0
else
date --date="0 today + $TIME_IN_SECS seconds" '+%H:%M'
@ruario
ruario / register-vivaldi.md
Last active June 22, 2023 22:56
This script simply extracts and registers a Vivaldi Linux deb or rpm package with your Desktop Environment. Not a proper "install" but basically usable as such without the need for an appropriate package manager or root access.
@ruario
ruario / dailycountdown.sh
Last active October 20, 2023 20:32
Script to post every time a further 5% (1h12m) of the day is depleted.
#!/bin/sh -eu
# Minutes past the hour that could *potentially* be when a percentage lands, to be used as a
# simple cron tab entry.
#
# 0,12,24,36,48 * * * * [path]/dailycountdown.sh >/dev/null 2>&1
# Define account username
PUBLISHER_USERNAME="[email protected]"