Skip to content

Instantly share code, notes, and snippets.

Windows Registries

User Home Folder

  • HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
@MarkZhangTW
MarkZhangTW / echo.jsp
Last active June 26, 2022 05:23
A simple JSP for echoing the request.
<%@ page import="java.io.Reader" %>
<%@ page import="java.io.Writer" %>
<%@ page import="java.util.Enumeration" %>
<%
Enumeration headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements()) {
String name = headerNames.nextElement().toString();
response.setHeader(name, request.getHeader(name));
}
if (request.getMethod().equals("POST")) {
@MarkZhangTW
MarkZhangTW / pause.bat
Created May 10, 2022 05:57
Pause if bat is executed by double clicked.
for %%x in (%cmdcmdline%) do if /i "%%~x"=="/c" pause
@MarkZhangTW
MarkZhangTW / clock_show_seconds.bat
Last active March 22, 2022 05:43
Configure Windows 11's explorer to show seconds on clock.
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSecondsInSystemClock /t REG_DWORD /d 1
@MarkZhangTW
MarkZhangTW / PS1.sh
Last active August 20, 2021 09:39
Hide username & hostname in shell.
export PS1="\[\e]0;\w\a\]\[\e[32m\]Administrator@localhost \[\e[33m\]\w\[\e[0m\]\$ "
"\C-p": history-search-backward
"\C-n": history-search-forward
@MarkZhangTW
MarkZhangTW / oneline.bat
Created July 18, 2021 16:13
Batch script template for one line output.
@echo off
setlocal enabledelayedexpansion
rem Parameter List
rem Todo...
rem Return Code List
rem 99: Cannot create %~dp0\log folder.
rem 98: Path %~dp0\log is not a folder.
FOR /F "tokens=1,2,3,4,5" %%f in ('dir /a-d-h') DO echo %%f %%g %%h %%i %%j >> list.txt
@MarkZhangTW
MarkZhangTW / rpm.download.sh
Last active July 26, 2021 03:12
Download RPM files from yum/dnf
#!/usr/bin/env bash
for rpm in "$@"; do
mkdir -p $rpm
sudo yum install --downloadonly --downloaddir=$rpm -y $rpm
done
@MarkZhangTW
MarkZhangTW / sort.sh
Created June 24, 2021 02:58
Sort & Unique in Linux
#!/usr/bin/env bash
cat $1 | sort | uniq >> $1.sorted
mv $1.sorted $1