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 / 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 September 25, 2025 10:04
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
@dungsaga
dungsaga / move-user-profile-folder.md
Last active July 13, 2024 01:41
move user profile folder of windows

move user profile folder of windows 7

  • During installation, instead of typing your username and computer name, press CTRL + SHIFT + F3 to boot into Audit Mode
  • After booting into Audit Mode, click Cancel in the window "System Preparation Tool 3.14"
  • Create a XML file (such as D:\relocate.xml) containing instructions to move user profiles
  • Run %windir%\system32\Sysprep\Sysprep.exe /audit /reboot /unattend:D:\relocate.xml
  • After rebooting again, click OK in the window "System Preparation Tool 3.14"
  • Continue with normal installation
@dungsaga
dungsaga / salvage-pdf.py
Last active December 11, 2024 05:30
Salvage text from a broken pdf file
#!/usr/bin/env python3
import re, zlib, sys
def main(argv):
print("Salvage text from a broken pdf file")
print("Usage: salvage-pdf.py [<input_file.pdf> [<output_file.txt>]]")
pdf = argv[1] if len(argv) > 1 else sys.stdin.fileno()
input = open(pdf, "rb").read()
output = salvage_pdf(input)
txt = argv[2] if len(argv) > 2 else sys.stdout.fileno()