Skip to content

Instantly share code, notes, and snippets.

@htfv
htfv / cmd-tools.md
Last active January 24, 2023 11:23
Scripting
@htfv
htfv / get-user-sid.cmd
Last active January 25, 2023 13:08
get-user-sid
@ECHO OFF
FOR /F "tokens=*" %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /F * /K') DO CALL :CHECK_PROFILE "%%A" && (ECHO %%~nA) && EXIT /B 0
EXIT /B 1
:CHECK_PROFILE
SETLOCAL && SET REGKEY=%~1
IF NOT [%REGKEY:~0,4%]==[HKEY] EXIT /B 1
FOR /F "tokens=1,2,*" %%A IN ('REG QUERY %1 /V ProfileImagePath') DO CALL :CHECK_PROFILE_PATH "%%A" "%%C" && EXIT /B 0
EXIT /B 1
@htfv
htfv / btrfs.md
Last active April 13, 2023 06:56
  • Deduplicate files in current directory: sudo jdupes . -rBZ
    • -r --recurse for every directory, process its subdirectories too
    • -B --dedupe do a copy-on-write (reflink/clone) deduplication
    • -Z --soft-abort act on matches so far if the user aborts (i.e. CTRL-C)
  • Disk usage of the current directory: btrfs filesystem du . -s
    • -s --summarize display only a total for each argument
msiexec /i Far30b6060.x64.20221208.msi /qb USERINSTALLDIR="%LOCALAPPDATA%\Far Manager x64"
::msiexec /i Far30b6060.x64.20221208.msi /qb ALLUSERS="" MSIINSTALLPERUSER=1
::msiexec /i Far30b6060.x64.20221208.msi /qb ALLUSERS="" MSIINSTALLPERUSER=1 USERINSTALLDIR="%LOCALAPPDATA%\Far Manager x64"

%LOCALAPPDATA%\GOG.com\Galaxy\plugins\installed\uplay_afb5a69c-b2ee-4d58-b916-f4cd75d4999a\consts.py

CLUB_APPID = "f35adcb5-1911-440c-b1c9-48fdc1701c68"
CLUB_GENOME_ID = "5b36b900-65d8-47f3-93c8-86bdaa48ab50"
@htfv
htfv / jdk-17-dcevm.md
Last active September 11, 2023 11:41
  • <?m2e ignore?> this execution will be ignored;
  • <?m2e execute?> this execution will be executed once on project import;
  • <?m2e execute onConfiguration?> this execution will be executed on every Project Configuration update;
  • <?m2e execute onIncremental?> this execution will be executed on every incremental build;
  • <?m2e execute onConfiguration,onIncremental?> this execution will be executed on every Project Configuration update and every incremental build;
  • <?m2e configurator configuratorId?> this execution will be delegated to the matching m2e configurator.

https://www.eclipse.org/m2e/documentation/release-notes-17.html#new-syntax-for-specifying-lifecycle-mapping-metadata

assume-unchanged vs skip-worktree

assume-unchanged is designed for cases where it is expensive to check whether a group of files have been modified; when you set the bit, git (of course) assumes the files corresponding to that portion of the index have not been modified in the working copy. So it avoids a mess of stat calls. This bit is lost whenever the file's entry in the index changes (so, when the file is changed upstream).

skip-worktree is more than that: even where git knows that the file has been modified (or needs to be modified by a reset --hard or the like), it will pretend it has not been, using the version from the index instead. This persists until the index is discarded.