Skip to content

Instantly share code, notes, and snippets.

@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 / make-install-remove.md
Last active December 22, 2023 18:14
Uninstalling (removing) a package installed via make install. No make uninstall target required

make install, uninstall help (howto remove)

Background

A common mistake for users who are new to Linux (and even a few seasoned users) is to install a package from source without any clear idea about how they will remove it in the future, should they want to.

The classic instructions to install a source package are ./configure && make && make install. This (or slight variants) can work nicely for installation but

@ruario
ruario / 1-patchelf.md
Last active December 13, 2023 02:46
Fetching, building and installing PatchELF

The following assumes you want a single user install. If you want a system wide install instead, run the attached script create-patchelf-pkg.sh (after first installing a suitable build environment).

Note: create-patchelf-pkg.sh also provides an uninstall script.

Setting up a Build Environment

Install a basic build environment (if you don't already have one). How to install this varies from distro to distro. Your best bet to refer to your distro's wiki or ask in their forums. That said, here are a few example install commands for a few of the popular distros:

  • Ubunt/Mint/Debian: sudo install build-essential
  • Fedora: sudo dnf install @development-tools
@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="dailyprogress@velocipederider.com"
@ruario
ruario / register-vivaldi.sh
Last active September 26, 2023 10:49
This script allows you to extract and register a Vivaldi Linux deb or rpm package with your Desktop Environment using a unique keyword, to assist with multiple side-by-side "installs".
#!/bin/sh -eu
a=off
if [ "x${1:-}" = "x-n" ] && [ -n "${2:-}" ]; then
n="${2#vivaldi-}"
c="Vivaldi-$n"
a=on
echo "Using the name: vivaldi-$n"
shift 2
fi
if [ -n "${1:-}" ]; then
@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 / latest-vivaldi.sh
Last active June 21, 2023 22:03
This script will find the latest Vivaldi binary package, download it and repackage it into Slackware format.
#!/bin/bash
# latest-Vivaldi Version 1.6.6
# This script will find the latest Vivaldi binary package, download it
# and repackage it into Slackware format.
# Copyright 2019 Ruari Oedegaard, Oslo, Norway All rights reserved.
#
# Redistribution and use of this script, with or without modification,
# is permitted provided that the following conditions are met:
@ruario
ruario / latest-chrome.sh
Last active June 2, 2023 12:58
This script will find the latest Google Chrome binary package, download it and repackage it into Slackware format.
#!/bin/bash
# latest-chrome Version 1.5
# This script will find the latest Google Chrome binary package,
# download it and repackage it into Slackware format.
# I don't use Chrome for regular browsing but it is handy for
# comparative tests against Vivaldi. :P
# Copyright 2018 Ruari Oedegaard, Oslo, Norway
@ruario
ruario / appimage-vivaldi.sh
Last active March 29, 2023 14:08
A script to convert a Vivaldi rpm or deb into Appimage format.
#!/bin/sh
#
# appimage-vivaldi.sh (version 0.2)
#
# A script to convert a Vivaldi rpm or deb into Appimage format.
# Before you use this script, you may need to adjust the following
# variable, based on the name and location of AppImageAssistant on
# your system.
@ruario
ruario / h264-vivaldi-linux.md
Last active March 18, 2023 11:17
How to enable HTML5 MP4 (H.264/AAC) video in Vivaldi for Linux, via an alternative FFMpeg library