Skip to content

Instantly share code, notes, and snippets.

[Unit]
Description=some service
After=network.target
StartLimitIntervalSec=10
[Service]
Type=simple
Restart=always
RestartSec=5
User=someuser
@harrypunk
harrypunk / swap.ps1
Created September 21, 2019 19:17
Windows 10 swap ctrl and caps-lock by powershell
$SimplePairs = @(
0x3a, 0x1d # CapsLock > L Ctrl
0x1d, 0x3a # L Ctrl > CapsLock
)
$ExtendedPairs = @(
# 0x5d, 0xe0, 0x1d, 0xe0 # ContextMenu > R Ctrl
)
$ByteCount = 2 * $SimplePairs.Length + $ExtendedPairs.Length + 16
$Remap = New-Object -TypeName byte[] -ArgumentList $ByteCount
$Remap[8] = $SimplePairs.Length/2 + $ExtendedPairs.Length/4 + 1
@harrypunk
harrypunk / du-h.sh
Created November 6, 2020 15:42
linux du current directory and sort human readable
du -d 1 -h .| sort -h -r
@harrypunk
harrypunk / Howto.md
Last active April 3, 2021 14:53
Windows 10 efi repair

Select the efi volume

dispart
list vol
sel vol 0
assign letter=M
exit

Scan windows

@harrypunk
harrypunk / systemd-resolved-single-label.md
Last active January 18, 2025 02:52
Ubuntu 24 enable single label dns name for local domain. Systemd resolved

Ubuntu 24 enable single label dns name for local domain. Systemd resolved

TLDR: disable systemd-resolved's stub listener.

Interesting case of figuring single label name on my desktop.

openwrt server

I have an openwrt homelab server at 192.168.1.200 with dnsmasq installed.
DNS records set:

Hostnames IP address
homelab 192.168.1.200
homelab.lan 192.168.1.200
@harrypunk
harrypunk / add-user.md
Created January 18, 2025 02:47
Linux add new user and set sudo
sudo adduser newusername
sudo usermod -aG sudo newusername
sudo visudo
# Add the line: newusername ALL=(ALL) NOPASSWD:ALL
@harrypunk
harrypunk / set-cap.md
Created January 20, 2025 13:51
arp-scan Cannot open MAC/Vendor file mac-vendor.txt: Permission denied
@harrypunk
harrypunk / gh-api-notification.md
Created September 26, 2025 00:50
Clear github unread notifications
# get notifications, look for the ID of the spam notification
gh api notifications
# mark that spam notification as read
gh api -X DELETE notifications/threads/$NOTIFICATION_ID
# jq delete all
gh api notifications | jq -r '.[] | select(.unread == true) | .id' | xargs -I {} gh api -X DELETE "notifications/threads/{}"

https://github.com/orgs/community/discussions/174310#discussioncomment-14474599

@harrypunk
harrypunk / proto-caveats.md
Created October 3, 2025 13:14
moonrepo proto use python shims

https://moonrepo.dev/docs/proto/commands/activate#caveats

Tool versions configured in the global ~/.proto/.prototools are not included by default. Pass --config-mode all during activation to include them

pin python in local folders

# example ~/some-space
> proto pin -c local python 3.13.5
# in fish config or current shell
proto activate fish | source
# check python shims
> echo $PATH