Skip to content

Instantly share code, notes, and snippets.

View emanueleaina's full-sized avatar

Emanuele Aina emanueleaina

View GitHub Profile
@akisys
akisys / azure-bastion-connect.sh
Created May 11, 2023 16:04
Use Azure Bastion with ssh-user-config blocks
#!/usr/bin/env bash
set -fu
destination="${1:-""}"
port="${2:-"8122"}"
timeout="${3:-""}" # this will auto-terminate the azure bastion tunnel after this many seconds
azure_bastion_opts=""
@quad
quad / 0-modular-errors-with-rusts-thiserror.md
Last active April 16, 2025 06:18
Modular Errors with Rust's thiserror

I've been writing Rust full-time with a small team for over a year now. Throughout, I've lamented the lack of clear best practices around defining error types. One day, I'd love to write up my journey and enumerate the various strategies I've both seen and tried. Today is not that day.

Today, I want to reply to a blog post that almost perfectly summarised my current practice.

Go read it; I'll wait!


"""
This python script will find flatpak deduplication size stats.
Made with :heart: by powpingdone#3611, or just powpingdone on github.
Explaination for output:
'no dedupe': The size that the ostree repository would take up if files were not deduplicated.
'dedupe': The actual size of the ostree repository.
'singlet': The size of all files that are referenced once.
'orphan': The size of all files not referenced (ie, only one hard link).
@eatonphil
eatonphil / psql-srv.py
Last active April 18, 2025 17:32 — forked from matteobertozzi/psql-srv.py
postgres "server" wire protocol example (ported python3)
# th30z@u1310:[Desktop]$ psql -h localhost -p 55432
# Password:
# psql (9.1.10, server 0.0.0)
# WARNING: psql version 9.1, server version 0.0.
# Some psql features might not work.
# Type "help" for help.
#
# th30z=> select foo;
# a | b
# ---+---
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@rpavlik
rpavlik / notes.md
Last active March 12, 2024 21:54
Debian packaging notes

These are my personal notes on how to handle Debian packaging best locally. Naturally they aren't authoritative, and I may have "missed a memo" - if so, let me know!

  • New package
    • git init
    • gbp import-orig ...
    • debmake
  • Clean up and edit
    • cme edit dpkg
  • see
@3v1n0
3v1n0 / fattura-elettronica-imap-extractor.py
Last active November 14, 2023 20:58
Extract italian electronic invoices (fatture elettroniche) from a PEC provider IMAP server
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2019-2022 - Marco Trevisan
#
# A Tool to export your invoices in the Italian electronic Fattura Elettronica
# format from any IMAP PEC provider (defaulting to Aruba PEC) to your computer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@3v1n0
3v1n0 / canoninvoice.py
Last active November 14, 2023 21:26
Fattura Elettronica and Python playground
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# 2019-2021 - Marco Trevisan
#
# Fattura Elettronica and python Playground
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@ryancdotorg
ryancdotorg / frag32.py
Created August 20, 2015 16:27
A FAT32 fragmenter, because I am a horrible person.
#!/usr/bin/env python
import random
import struct
import sys
# Most of the Fat32 class was cribbed from https://gist.github.com/jonte/4577833
def ppNum(num):
return "%s (%s)" % (hex(num), num)
@koreno
koreno / README.md
Last active April 1, 2020 10:44
'rebaser' improves on 'git rebase -i' by adding information per commit regarding which files it touched.

Prebase

git-prebase improves on 'git rebase -i' by adding information per commit regarding which files it touched.

  • Each file gets an alpha-numeric identifier at a particular column, a list of which appears below the commit list. (The identifiers wrap around after the 62nd file)
  • Commits can be moved up and down safely (without conflicts) as long as their columns don't clash (they did not touch the same file).

Installation

Add the executable to your path and git will automatically expose it as