Skip to content

Instantly share code, notes, and snippets.

View aetonsi's full-sized avatar
👋
Hi there!

Andrea Edin Tonsi aetonsi

👋
Hi there!
View GitHub Profile
@aetonsi
aetonsi / enums.js
Last active March 13, 2025 02:30
PHP-like Enums in JavaScript
function MakeEnumValue(key, value) {
key = key.toString();
const o = {},
v = arguments.length > 1 ? value : key,
s = Symbol(arguments.length > 1 ? `ENUMVALUE[(${typeof value})${key}=${JSON.stringify(value)}]` : `ENUMVALUE[${key}=]`);
Object.defineProperty(o, '[[Symbol]]', { value: s }, Object.create(null));
Object.defineProperty(o, 'valueOf', { value: () => v }, Object.create(null));
Object.defineProperty(o, 'toString', { value: () => v.toString() }, Object.create(null));
Object.defineProperty(o, 'toJSON', { value: (space = '') => JSON.stringify(v, null, space) ?? `[[${key}]]` }, Object.create(null));
return Object.freeze(o);
@aetonsi
aetonsi / wulist.vbs
Created February 10, 2025 18:46
wulist.vbs
Option Explicit
WScript.Echo "This script is provided by Microsoft Corporation to demonstrate techniques that can be used to search, download,"
WScript.Echo "and install updates through the Windows Update Agent API."
WScript.Echo ""
WScript.Echo "This script is not intended as production code."
WScript.Echo ""
' Supported parameters:
' /AppName: Name to pass to the WUA API as the 'calling application';
@aetonsi
aetonsi / WSB.CMD
Last active January 28, 2025 12:07
Launches Windows Sandbox with a configuration file that allows a folder (defaulting to the current folder of the script), to be mapped either as read-only (default) or read-write. ... Featuring: - the ugliest cmd-pwsh polyglot ever - embedded XML data with variable replacement - escaped batch multiline strings
@REM WSB.CMD
@REM Launches Windows Sandbox with a configuration file that allows
@REM a folder (defaulting to the current folder of the script), to be mapped
@REM either as read-only (default) or read-write.
@REM ... Featuring:
@REM - the ugliest cmd-pwsh polyglot ever
@REM - embedded XML data with variable replacement
@REM - escaped batch multiline strings
@aetonsi
aetonsi / rfc3161.txt
Last active June 24, 2024 14:01 — forked from Manouchehri/rfc3161.txt
List of free rfc3161 servers.
JohnPlanetary commented on Jul 12, 2021 •
As of 16-MARCH-2024 here are the TSA that I know work and are available for real use.
Do your own investigation in order to find if any is appropriate for your use case.
"Credible" information is personal opinion based on information that I found, doesn't mean that the service is not credible at least in certain jurisdictions.
Digicert:
http://timestamp.digicert.com
Credible: Yes. [Adobe Approved Trust List] and [Windows Cert Store].
Server returns the expected hash value for: SHA256, SHA384, SHA512
Working Hashes: SHA1, SHA256, SHA384, SHA512
@aetonsi
aetonsi / reconnect.cmd
Last active January 9, 2024 18:27
OpenVPN Connect (ovpnconnector.exe) Reconnect Script (ADMIN)
@echo off
REM SIMPLE OPENVPN-CONNECT (ovpnconnector) RECONNECT SCRIPT
REM REQUIRES OpenVPN Connect (ovpnconnector) + pwsh (powershell core) TO BE INSTALLED
REM REQUIRES ADMIN RIGHTS
setlocal EnableDelayedExpansion
REM re-run as admin if not already
net session >nul 2>&1
if errorLevel 1 (
@aetonsi
aetonsi / update_android_DCIM_media_datetime.ps1
Last active January 10, 2024 14:31
update_android_DCIM_media_datetime.ps1
# update_android_DCIM_media_datetime.ps1
Get-ChildItem *.jpg, *.mp4, *.mkv -Recurse | ForEach-Object {
$name = $_.BaseName
$year = $name.Substring(4, 4)
$month = $name.Substring(8, 2)
$day = $name.Substring(10, 2)
$hour = $name.Substring(13, 2)
$minute = $name.Substring(15, 2)
$second = $name.Substring(17, 2)
@aetonsi
aetonsi / ram_script.md
Last active January 2, 2024 01:23
windows batch: load script into ram before execution

ram_script.md

https://stackoverflow.com/a/37940551

This simple script loads whatever is inside the parenthesis into ram before executing it.

This can be used, for example, to run a script that deletes itself, avoiding any error messages by cmd.exe.

@(goto) 2>nul & ( rem some comment too...
@aetonsi
aetonsi / tokenize.md
Last active January 1, 2024 23:15
powershell: tokenize command line string via CommandLineToArgvW
@aetonsi
aetonsi / ScrolllerRedirectwithURLCondition.user.js
Last active December 27, 2023 10:26
Scrolller Redirect with URL Condition
// ==UserScript==
// @name Scrolller Redirect with NO NAV
// @namespace https://your-namespace.example.com/
// @version 1.0
// @description Redirects to the media URL on Scrolller.com after waiting for the element to appear (excluding URLs with ?NONAV and scrolller.com/r/*)
// @author YourName
// @match https://scrolller.com/*
// @exclude https://scrolller.com/r/*
// @grant none
// ==/UserScript==
@aetonsi
aetonsi / nvmCommands.js
Created December 19, 2023 08:24 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node