Skip to content

Instantly share code, notes, and snippets.

@AldoMX
AldoMX / curl.md
Last active January 4, 2024 01:30
cURL flags I use the most

cURL flags I use the most

Context

I always see commands like curl -LsS https://www.example.com over the internet, I never remember what does each flag do, and man curl is overwhelming.

This is the list of the flags I use the most.

Flags

@AldoMX
AldoMX / easterAlgos.js
Last active January 3, 2023 15:29
JavaScript implementation of Easter Algorithms
// Algorithm by Tom O’Beirne
// (1961) Puzzles and Paradoxes. New Scientist, No. 228, p. 829, Table 1
// https://books.google.com/books?id=zfzhCoOHurwC&pg=PA829
//
// Implementation in JavaScript by Aldo Fregoso.
// Released under public domain without any kind of warranty or support.
//
function oBeirnesEasterAlgo(x) {
assert(x != 0, "Year zero does not exist in the Anno Domini (AD) calendar year system.");
if (x <= 1582) {
@AldoMX
AldoMX / MX_Holidays.toml
Last active January 1, 2023 03:13
Días de los años 2000 a 2023 en que las entidades financieras sujetas a la supervisión de la Comisión Nacional Bancaria y de Valores (México) deberán cerrar sus puertas y suspender operaciones.
# Días de los años 2000 a 2023 en que las entidades financieras sujetas a la
# supervisión de la Comisión Nacional Bancaria y de Valores (México) deberán
# cerrar sus puertas y suspender operaciones.
#
# Archivo en formato TOML creado por Aldo Fregoso, publicado como obra de
# dominio público y ofrecido sin garantía ni soporte de ningún tipo.
#
# ===
#
# English: Mexico’s Bank Holidays from 2000 to 2023.
@AldoMX
AldoMX / Cargo.toml
Created November 13, 2022 22:19
How I built a 'Hello World' in Rust that works for Windows XP [2022]
[package]
name = "hello_world"
version = "0.1.0"
edition = "2021"
[profile.dev]
panic = "abort"
[profile.release]
lto = true
@AldoMX
AldoMX / DisplayProductID-db7
Last active June 6, 2021 20:56
Sceptre C35 Override
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayProductName</key>
<string>Sceptre C355W-3440UN</string>
<key>DisplayProductID</key>
<integer>3511</integer>
<key>DisplayVendorID</key>
<integer>19988</integer>
@AldoMX
AldoMX / banamex_msi.js
Created May 18, 2021 14:04
Copia MSI de los Smart Statement de Banamex.
setTimeout(
() =>
navigator.clipboard.writeText(
[...document.getElementById("tablaMovimientos").rows]
.filter(({ id, children: [, { innerText: description }] }) => id.startsWith("idexpand") && /\d{3}\s\d{3}\s*$/.test(description))
.map(({ children: [, { innerText: description }, { innerText: amount }] }) => [description, amount].join("\t"))
.join("\n")
),
1000
);
@AldoMX
AldoMX / local.user-key-mapping.plist
Created October 12, 2019 18:52
Changes the mapping between “§” and “`” keys when using US distribution with non-US keyboards. Download it to `/Library/LaunchDaemons/local.user-key-mapping.plist` and launch it with `launchctl load -w /Library/LaunchDaemons/local.user-key-mapping.plist`.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.user-key-mapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
@AldoMX
AldoMX / rocksdb.js
Created November 11, 2018 12:52
ES2018 wrapper for `rocksdb`, works without Babel with Node.js v10 and upwards
const rocksdb = require('rocksdb');
const valueCallback = resolve => (err, value) => err ? Promise.reject(err) : resolve(value);
class RocksDBIterator {
constructor(iterator) {
this.iterator = iterator;
}
async end() {

Installing Windows 10 to an external drive without a Windows host

The long story

We were talking at the office about having a LAN Party and playing some old school games like Age of Empires and Starcraft. The issue is that I have Linux installed. I didn't want to ruin everyone else's fun by having random crashes, out-of-sync errors and similar stuff using Wine, and I didn't want to do the dual boot dance, so I figured out that the best option was to install Windows to an external drive.

@AldoMX
AldoMX / _amx-wsl-startup.sh
Last active November 26, 2017 17:43
Start services during WSL startup
#!/bin/sh
sudo service atd start
sudo service cron start
sudo service dbus start
sudo service irqbalance start
sudo service lvm2-lvmetad start
sudo service lvm2-lvmpolld start
sudo service mdadm start
sudo service ondemand start
sudo service rc.local start