Skip to content

Instantly share code, notes, and snippets.

@dimitris-k
dimitris-k / Useful_Links.txt
Created August 30, 2022 10:18
Some Usefull Links
@dimitris-k
dimitris-k / alu
Last active December 15, 2023 11:06
beautify "apt list --upgradable" output
#!/bin/bash
# beautify "apt list --upgradable" output
# sample output is like:
# Listing... Done
# bind9-dnsutils/stable-security 1:9.16.27-1~deb11u1 amd64 [upgradable from: 1:9.16.22-1~deb11u1]
# bind9-host/stable-security 1:9.16.27-1~deb11u1 amd64 [upgradable from: 1:9.16.22-1~deb11u1]
# bind9-libs/stable-security 1:9.16.27-1~deb11u1 amd64 [upgradable from: 1:9.16.22-1~deb11u1]
@dimitris-k
dimitris-k / __install_latest_starship
Last active October 21, 2024 10:27
A Shell scripts that checks starship repo for a newer binary version and installs it
#!/bin/bash
# Will check the "starship prompt" github repo for the latest binary version
# and in case a newer version exists, it will install it. Note, that the install script
# will ask the user to proceed.
# function to convert a string that contain a dotted version number to a string
# that can be used for alphanumeric comparison. It was found in this post replies:
# https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-#!/bin/bash
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
#!/bin/bash
function __msg_error() {
printf 'ERROR from line: %s %s\n' "${BASH_LINENO[$(( ${#BASH_LINENO[@]} - 2 ))]}" "$*"
}
# Do not run if an instance is already running
# -------------------------------------------------------------------------------------
RFLAG="/tmp/___RUNNING_FLAG___$( basename "${BASH_SOURCE[0]}" )"
mkdir "$RFLAG" 2>/dev/null || { __msg_error "There is an already running instance of this program"; exit 1; }
@dimitris-k
dimitris-k / xflock4
Created September 3, 2018 07:24
Custom /usr/bin/xflock4 to use only slock and check for user activity before actually locking the display
#!/bin/sh
PATH=/bin:/usr/bin
export PATH
sleep 1
xset dpms force off
sleep 20
# Check if the monitor is On after these 20 seconds,
Uninstall locales but the ones you want in Ubuntu:
--------------------------------------------------
sudo locale-gen --purge <locales you want>
e.g.
sudo locale-gen --purge el_GR.utf8 en_US.utf8
The above will NOT uninstall C, C.UTF-8 and POSIX