Skip to content

Instantly share code, notes, and snippets.

View dungsaga's full-sized avatar
👻
ghost in the machine

DungSaga dungsaga

👻
ghost in the machine
View GitHub Profile
@dungsaga
dungsaga / humorous.js
Last active April 1, 2026 08:18
humorous constants
// Once upon a time, I stumbled on a code base splattered with hard-coded constants.
// And I think to myself: why don't I spice it up with meaningful constants?
const CONST_VOID = 0;
const CONST_NEO = 1;
const CONST_REDUX = 2;
const CONST_TRINITY = 3;
const CONST_FJORD = 4;
@dungsaga
dungsaga / install-and-uninstall.sh
Last active March 6, 2026 05:16
install and uninstall LibreOffice packages (under Debian/Ubuntu/...)
# INSTALLATION:
tar xf --strip-components=1 LibreOffice_26.2.0_Linux_x86-64_deb.tar.gz
sudo dpkg -i DEBS/*.deb
# UNINSTALLATION:
tar xf --strip-components=1 LibreOffice_26.2.0_Linux_x86-64_deb.tar.gz
cd DEBS
for f in DEBS/*.deb; do sudo dpkg -r --force-depends "${f/_*/}"; done
# alternative methods of UNINSTALLATION
@dungsaga
dungsaga / Excel column name to number.js
Last active December 30, 2025 03:46 — forked from danmana/Excel column name to number.js
Convert from excel column names to a index (1 based)
function colNum(name = '') {
const val = (c) => c.charCodeAt(0) - 'A'.charCodeAt(0) + 1
return name.split('')
.reduce((acc, v) => val(v) + acc * val('Z'), 0)
}
colNum('A') === 1
colNum('Z') === 26
colNum('AA') === 27
@dungsaga
dungsaga / magento-criticisms.md
Created December 11, 2025 10:39
Magento criticisms
@dungsaga
dungsaga / Hirofumi-Nakai-Improved.md
Last active February 22, 2026 21:33
Hirofumi Nakai Improved (HNI) - a method for Doomsday calculation

Hirofumi Nakai Improved

The Doomsday rule was devised by John Conway in 1973 to compute the day of week in your head (https://en.wikipedia.org/wiki/Doomsday_rule). Others have made improvements for easier mental calculation.

Currently, the simplest one is published in 2023 in the paper "A Simple Formula for Doomsday" by Hirofumi Nakai (https://thatsmaths.com/2023/06/22/a-simple-formula-for-the-weekday/).

  • split the year into century part and the remaining 2-digit part: Y = 100c + y
  • compute the modulo 4 of these 2 parts: c₄ = c % 4, y₄ = y % 4
  • the Doomsday would be (5(c₄ + y₄ - 1) + 10y) % 7
<?php
/**
* Adminer plugin that display the first CHAR/VARCHAR column of the foreign key
*
* @category Plugin
* @link http://www.adminer.org/plugins/#use
* @author Bruno VIBERT <http://www.netapsys.fr>
* @modified by Peter Hostačný <hostacny.peter AT gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
@dungsaga
dungsaga / 01-next-html.md
Last active July 30, 2025 06:52
what's the next HTML version? HTML6!?
@dungsaga
dungsaga / bash_strict_mode.md
Created March 18, 2025 02:26 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@dungsaga
dungsaga / fix-osnews.md
Last active February 9, 2025 10:37
fix invisible titles in osnews.com
@dungsaga
dungsaga / rfc3161.txt
Created July 26, 2024 07:52 — forked from Manouchehri/rfc3161.txt
List of free rfc3161 servers.
https://rfc3161.ai.moda
https://rfc3161.ai.moda/adobe
https://rfc3161.ai.moda/microsoft
https://rfc3161.ai.moda/apple
https://rfc3161.ai.moda/any
http://rfc3161.ai.moda
http://timestamp.digicert.com
http://timestamp.globalsign.com/tsa/r6advanced1
http://rfc3161timestamp.globalsign.com/advanced
http://timestamp.sectigo.com