Skip to content

Instantly share code, notes, and snippets.

View well-it-wasnt-me's full-sized avatar
💭
Can’t find my motivation. If you see it, keep it.

Antonio well-it-wasnt-me

💭
Can’t find my motivation. If you see it, keep it.
View GitHub Profile
#!/usr/bin/env bash
set -euo pipefail
[[ "${DEBUG:-0}" == "1" ]] && set -x
# --- Requirements -------------------------------------------------------------
command -v jq >/dev/null || { echo "[x] jq not found"; exit 1; }
# rg is optional; we'll check later for the malware scan
TOOL="${TOOL:-npm}"
# --- Watchlist ----------------------------------------------------------------
@well-it-wasnt-me
well-it-wasnt-me / markov_chain.py
Created October 6, 2025 13:47
Resource-Aware Markov Chain Indexer (PoC)
#!/usr/bin/env python3
"""
Resource-Aware Markov Chain Indexer (PoC)
Attempt
-----
Index a very large corpus (up to ~25 TB) of heterogeneous documents (pdf, docx, txt, images)
by building an n-gram Markov chain (order=2 or 3) over tokenized text in a *disk-backed* way.
Design Principles
@well-it-wasnt-me
well-it-wasnt-me / monty_hall.py
Created October 6, 2025 13:44
run monty hall simulations to see if is better to switch door or not
import random
def monty_hall_trial(switch: bool) -> bool:
"""
Run a single Monty Hall trial.
Returns True if the player wins the car, False otherwise.
"""
doors = [0, 1, 2]
prize = random.choice(doors) # door hiding the prize
@well-it-wasnt-me
well-it-wasnt-me / deepJsonCompare.js
Created January 24, 2025 18:17
json diff compare in js
/**
* Recursively compare two JSON objects and print out their differences.
*
* Differences are logged to the console in the form:
* "Difference at path: <path>, val1 = <valueInObj1>, val2 = <valueInObj2>"
*
* @param {object} obj1 - First JSON object
* @param {object} obj2 - Second JSON object
*/
function deepCompareJSON(obj1, obj2) {
@well-it-wasnt-me
well-it-wasnt-me / TUTORIAL_SDI_CERTIFICATI.md
Created March 2, 2024 15:35
TUTORIAL: SDI, FatturaPA ed Agenzia delle Entrate. Guida pratica (e funzionante) su come usare e gestire i certificati

Pre-Requirements

  • La chiave usata per firmare (server.key)

Note: Se avete seguito la guida fornita da fatturapa avete generato la chiave con openssl. Il formato è PKCS-8

Step 1 - File necessari

  • Andare sul sito FatturaPA
  • Cliccare su "Interoperability Test"
  • Cliccare su "Download test files"
  • Scaricare KitDiTest.zip e Certificato Client e Server
@well-it-wasnt-me
well-it-wasnt-me / procedure_db_search_and_replace.sql
Last active March 1, 2024 14:09
Small mysql procedure to search and replace string in all tables inside a specific database. I had to do this recenty because of a moving wordpress installation in another path
DELIMITER //
CREATE PROCEDURE search_replace_db(IN db_name VARCHAR(255), IN search_for VARCHAR(255), IN replace_with VARCHAR(255))
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE tableName VARCHAR(100);
DECLARE columnName VARCHAR(100);
DECLARE cur CURSOR FOR
SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
@well-it-wasnt-me
well-it-wasnt-me / active_conn.sh
Created December 24, 2023 14:27
Check current active connections on your server, useful during DoS attack
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
@well-it-wasnt-me
well-it-wasnt-me / check_duplicate_ip.sh
Created December 24, 2023 14:27
Script to check which IP are duplicated in a network you are connected
sudo arping -D -I INTERFACE_NAME -c 2 IP_TO_CHECK
echo $? # If 0, means NO duplicated...Hurray !
@well-it-wasnt-me
well-it-wasnt-me / instructions.md
Last active December 24, 2023 14:30
How to format usb drive that MacOS cannot read. In macOS

Let's see the attached usb drive

$ sudo diskutil list

Now, from the list, note the usb drive name and path

$ sudo diskutil eraseDisk FAT32 NAME MBRFormat /dev/diskX