Skip to content

Instantly share code, notes, and snippets.

View tnhung2011's full-sized avatar

tnhung2011

  • Vietnam
View GitHub Profile
@tnhung2011
tnhung2011 / reexplorer.bat
Last active December 14, 2025 02:33
ReExplorer: Restart explorer.exe
@echo off
echo [+] Restarting explorer.exe...
taskkill /f /im explorer.exe >nul
timeout 2 >nul
start %systemroot%\explorer.exe
echo [+] Starting explorer.exe...
set /p _p=
@tnhung2011
tnhung2011 / grabUnusedFiles.js
Last active December 16, 2025 11:43
Grab unused files on a page of Special:UnusedFiles
// ".gallery" for Wikipedia
// "#gallery-0" for Fandom
Array.prototype.forEach.call(document.querySelector(".gallery").querySelectorAll("div > a"), function(elem) {
console.log(decodeURI(/(File:[^\?]*)/g.exec(elem.href)[1]));
});
@tnhung2011
tnhung2011 / build_windows.yml
Last active September 10, 2023 13:16
Builds Tauri applications for Windows (x64, x86), then draft a release
name: Build executable
on: workflow_dispatch
env:
name: PLACE_REPO_NAME_HERE
CARGO_TERM_COLOR: always
jobs:
build:
@tnhung2011
tnhung2011 / spam_random_characters.c
Last active December 13, 2025 14:08
Tested on https://www.onlinegdb.com/ with Turbo C and gcc compilers
#include <stdio.h>
#include <limits.h>
int main(void) {
int i = CHAR_MIN;
for (; i <= CHAR_MAX; i++)
putchar(i);
}
@tnhung2011
tnhung2011 / rocursor.bat
Last active December 28, 2025 13:39
A handy program for customizing your Roblox cursor (ANSI-encoded) (now a kludge for people who doesn't like Bloxstrap)
<# :
@echo off
setlocal enableextensions
set stop=:eof
set powershell="%__appdir__%WindowsPowershell\v1.0\powershell.exe"
>nul 2>nul dir /b /a:-d %powershell% || (
echo Unsupported OS.
goto %stop%
)
@tnhung2011
tnhung2011 / EnvShortcut.vbs
Last active December 13, 2025 13:40
Creates a shortcut for convenient access to environment variables (could be placed in "Start Menu" folder)
Set h = WScript.CreateObject("WScript.Shell")
Set oLink = h.CreateShortcut(".\Environment Variables.lnk")
oLink.TargetPath = "%SystemRoot%\System32\rundll32.exe"
oLink.Arguments = "sysdm.cpl,EditEnvironmentVariables"
'Alternative way
'oLink.TargetPath = "%SystemRoot%\System32\SystemPropertiesAdvanced.exe"
oLink.IconLocation = "%SystemRoot%\System32\shell32.dll,104"
oLink.Save
@tnhung2011
tnhung2011 / memreduct-onlogon.bat
Last active December 24, 2025 17:28
Creates a scheduled task that runs Mem Reduct with administrative privileges (skipping UAC) on logon. Alternative to faulty GUI option.
<!-- : Begin batch script
@echo off
setlocal enableextensions enabledelayedexpansion
(set lf=^
)
::net session would not work if the Server service is not started
reg query HKEY_USERS\S-1-5-19\Environment /v TEMP >nul 2>nul || (
choice /M "Re-run the script as administrator"
if errorlevel 2 goto :eof
@tnhung2011
tnhung2011 / regread.bat
Last active December 14, 2025 01:57
Read a value from the registry using a single path (HKXX or HKEY_ABC\SubKey\Value). Useful for lazy copy-pasting.
@echo off
setlocal enableextensions enabledelayedexpansion
for /f "usebackq eol= delims=" %%a in ('%*') do set sArgs=%%~a
::Split at last backslash ("\")
for /f "delims==" %%a in ('set _a 2^>nul') do set "%%a="
(set lf=^
)
for %%l in ("!lf!") do set "_a=!sArgs:\=%%~l!"
@tnhung2011
tnhung2011 / hosts.bat
Created December 15, 2025 14:27
Aggregates local hosts files to the global one, rejecting any duplicates
@echo off
:: detect wrapping
:: writePublic defined = jump to :writePublic
:: this evades CTRL-C canceling all operations
:: https://stackoverflow.com/a/27131024
if "%~1"=="" if defined writePublic (goto writePublic) else (goto noargs)
set writePublic=
setlocal enableextensions enabledelayedexpansion
if "%~1"=="/?" goto help
@tnhung2011
tnhung2011 / hoststree.bat
Last active January 6, 2026 13:29
Creates a HOSTS tree view with hostnames branching out of their resolving IPs.
@echo off
setlocal enableextensions enabledelayedexpansion
if defined hoststreeMain goto main
if "%~1"=="/?" (
for /f %%A in ('prompt $H ^&echo on ^&for %%B in ^(1^) do rem') do set bs=%%A
echo Creates a HOSTS tree view with hostnames branching out of their resolving IPs.
echo:
echo HOSTSTREE file
echo:
echo !bs! file If none specified, defaults to %%SystemRoot%%\System32\drivers\etc\hosts