Skip to content

Instantly share code, notes, and snippets.

View paride's full-sized avatar

Paride Legovini paride

View GitHub Profile
@paride
paride / gists-as-blog.md
Last active February 23, 2026 20:40
gists as a blog

GitHub gists for blog articles

Each gist acts as an individual post, supporting Markdown for formatting, code snippets, and comments, without the need for a full blog. Gists are version-controlled, making edits and revisions transparent, and they are easily shareable via direct URLs. This approach keeps hosting lightweight, leverages GitHub's infrastructure, providing a low-maintenance way to maintain a minimal, code-friendly blog.

I am certainly not the first one to think of doing this (see for example

#!/usr/bin/python3
import sys
import yaml
# Use LibYAML is available, otherwise this is going to be super slow
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
print("Expect slowness!")
#!/usr/bin/python3
import sys
import yaml
# Use LibYAML is available, otherwise this is going to be super slow
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
print("Expect slowness!")
@paride
paride / defer.sh
Created November 20, 2023 18:59
defer
#!/bin/sh
DEFER=
defer() {
DEFER="$*; ${DEFER}"
trap "{ $DEFER }" EXIT
}
#!/bin/bash
set -e
CSV=/usr/share/distro-info/ubuntu.csv
if [[ $# != 1 ]]; then
echo "Usage: $0 <series>"
echo "Example: $0 <jammy>"
exit 1
#!/bin/bash
set -eu -o pipefail
### retry script snippet
retry() {
((${_try:=1}>5)) && exit $? || echo sleep "$((8*_try**3))"
_try=$((++_try)) exec "$BASH" "${BASH_SOURCE[-1]}" "$@"
}
trap 'retry "$@"' ERR
/* https://thelounge.chat/docs/guides/custom-css */
/* Bigger custom CSS field */
textarea#user-specified-css-input {
height: 400px;
width: 600px;
}
/* Compact sidebar */
@paride
paride / build-deb
Last active July 17, 2020 15:56
Build a deb of from the current branch
#!/bin/bash
fail() { echo "$@" 1>&2; exit 1; }
cleanup() {
rm -rf "$tmpd"
git worktree prune
}
if [[ $1 = "-h" || $1 = "--help" ]]; then
cat <<-EOF
@paride
paride / build-deb-prepare
Created July 17, 2020 15:06
Generate debian/ and the .orig tarball from a packaging branch
#!/bin/bash
: "${PACKAGING_BRANCH:=ubuntu/devel}"
: "${RELEASE:=UNRELEASED}"
: "${CLOGVER_DEBIAN:=0ubuntu1}"
: "${DEBFULLNAME:=$(git config user.name)}"
: "${DEBEMAIL:=$(git config user.email)}"
export DEBFULLNAME DEBEMAIL