Skip to content

Instantly share code, notes, and snippets.

View arpanetus's full-sized avatar
🐃

Omar Änwar arpanetus

🐃
View GitHub Profile
@arpanetus
arpanetus / halıq.md
Last active February 8, 2023 21:00
Халық банк туралы бір ауыз сөз

Бірде Халық банктың Онлайн-Банк қызметіне хабарласқан едім.

Онлайн-банк, Гөгіл сұрамасы

Лендиңі түгел дерлік орыс тілінде. Қазақша бір түйір сөз таппайсың.

Онлайн-банк, Лендиң

Соны айтсам, көмекші қызметтегі қыз "Ондағының бәрін қазақша аударып болмайды, одан бөлек орысша нұсқасы бірінші жасалады" дегені бар.

@arpanetus
arpanetus / install.sh
Last active September 23, 2023 11:57
docker install oneliner
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
sudo rm -rf /usr/share/keyrings/docker-archive-keyring.gpg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \

I wanted to be able to detect when Dark mode was turned on or off in my Go program so I can swap icons in my tray app on Windows so I wrote this.
When Dark Mode is turned on or off, it writes to a pair of registry keys, both of which Windows allows you to set independently in Settings > Personalization > Colors.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize  

SystemUsesLightTheme  DWORD 0 or 1 // Changes the taskbar and system tray color  
AppsUseLightTheme     DWORD 0 or 1 // Changes app colors  

Mine is a tray app, so I am monitoring the first one. I did not want to just periodically poll the registry key and I wanted to be able to react immediately when the registry key is changed, so I am using the win32 function RegNotifyChangeKeyValue in advapi32.dll to tell the OS to notify my app so I can swap out the icon for a color-appropriate one.
I start the monitor function in main, which loads the RegNotifyChangeKeyValue function from advapi32 and starts a gorouti