Skip to content

Instantly share code, notes, and snippets.

View simonesestito's full-sized avatar
🇮🇹

Simone Sestito simonesestito

🇮🇹
View GitHub Profile
@simonesestito
simonesestito / sendfile.sh
Last active August 12, 2024 15:20
Simple script to send a file in LAN via HTTP
#!/bin/bash --
set -euo pipefail
PORT=8000
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <file_to_send>"
exit 1
fi
@simonesestito
simonesestito / sign_pdf.sh
Last active February 24, 2024 13:53
Electronically sign and timestamp PDF files
#!/bin/bash
#
# Script to quickly electronically sign
# and apply a qualified eIDAS timestamp
# on a PDF document of your choice.
#
# Java is required.
# open-pdf-sign software will be used.
#
# You MUST have a certificate before using this script.
@simonesestito
simonesestito / use_dual_monitor_speakers.sh
Created January 19, 2024 08:37
PulseAudio: use multiple speakers
#!/bin/bash
# TODO: Update this strings with the actual values for your speakers
# TODO: Remember to also adjust the volumes to balance them (depending on their power and their distance from your location)
SPEAKER_1_NAME=alsa_output.pci-0000_03_00.1.hdmi-stereo
SPEAKER_1_VOLUME=80%
SPEAKER_2_NAME=alsa_output.pci-0000_03_00.6.analog-stereo
SPEAKER_2_VOLUME=100%
# Initially, remove previous state
@simonesestito
simonesestito / extension.js
Last active March 25, 2024 08:58
Fix noisy microphone's left channel
/**
* Gnome Extension (tested on Gnome 46 and with previous exact configuration).
*/
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
const { GLib } = imports.gi;
const DEBUG_LOG_TAG = 'mic-hider';
function log(message) {
console.log(`[${DEBUG_LOG_TAG}] ${message}`);
@simonesestito
simonesestito / raster.sh
Created October 12, 2023 11:20
Rasterize PDF file on Linux (bash function)
#!/bin/bash
#
# Script to rasterize a PDF file
#
# You can adjust the density ("convert" argument)
# or other options as you wish
#
# It is a function so that you can include in your .bashrc (or whatever)
# and use as a command
@simonesestito
simonesestito / find_hash.c
Created September 12, 2023 08:08
Message contains the first chars of its SHA256 hex digest
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <openssl/sha.h>
/*
* Example message:
* The SHA256 for this sentence begins with: one, eight, two, a, seven, c and nine.
*
@simonesestito
simonesestito / README.md
Last active October 3, 2024 17:17
eduroam connection fix

Error

journalctl --boot --unit wpa_supplicant.service --follow

wpa_supplicant[888]: SSL: SSL3 alert: write (local SSL3 detected an error):fatal:protocol version

wpa_supplicant[888]: OpenSSL: openssl_handshake - SSL_connect error:0A000102:SSL routines::unsupported protocol

That may indicate that the network you're trying to connect to, requires some very old protocols.

@simonesestito
simonesestito / subset.py
Created April 14, 2023 19:55
NFA Subset Construction
nfa = {
0: {
'a': { 6 },
'b': set(),
'e': { 1 },
},
1: {
'a': { 7 },
'b': { 4 },
'e': { 3 },
@simonesestito
simonesestito / bitflip.c
Created April 11, 2023 05:43
Flip an amount of bytes in a file, randomly
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#define NUMBER_BYTES_TO_FLIP 10
//#define FLIP_PROBABILITY 0.0001
@simonesestito
simonesestito / example_input.txt
Last active April 7, 2023 08:53
Recursion remover for CFG
X XaZ|YWc|W
Y Yd|WbZ|ZWc|X
W WXa|ZZd|YYe|c
Z XX|Zc