Skip to content

Instantly share code, notes, and snippets.

View master-hax's full-sized avatar
💤
sleeping

Vivek master-hax

💤
sleeping
  • Seattle
View GitHub Profile
@master-hax
master-hax / best_config.cfg
Last active October 1, 2023 07:50
cs2 config
// my CS2 config file
// crosshair code CSGO-A2KWo-P6kQJ-dAJQP-iAzGm-YSc3K
// mouse sensitivity stuff
sensitivity "1.65"
// HUD scaling for ultrawide
safezonex 0.55
safezoney 1.0
@master-hax
master-hax / gist:3feb0fb26512a79241a403f6c4ac2e01
Created January 20, 2022 08:11
create a netsh proxy in Windows to allow IPFS companion to load content on HTTPS websites from a LAN IPFS node
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=127.0.0.1 connectport=8080 connectaddress=<ip addr of LAN IPFS node>
netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=127.0.0.1
@master-hax
master-hax / Elevate when needed in Go.md
Created May 5, 2020 08:14 — forked from jerblack/Elevate when needed in Go.md
Relaunch Windows Golang program with UAC elevation when admin rights needed.

I'm buiding a command line tool in Go that has an option to install itself as a service on Windows, which it needs admin rights for. I wanted to be able to have it reliably detect if it was running as admin already and if not, relaunch itself as admin. When the user runs the tool with the specific switch to trigger this functionality (-install or -uninstall in my case) they are prompted by UAC (User Account Control) to run the program as admin, which allows the tool to relaunch itself with the necessary rights.

To detect if I was admin, I tried the method described here first:
https://coolaj86.com/articles/golang-and-windows-and-admins-oh-my/
This wasn't accurately detecting that I was elevated, and was reporting that I was not elevated even when running the tool in CMD prompt started with "Run as Administrator" so I needed a more reliable method.

I didn't want to try writing to an Admin protected area of the filesystem or registry because Windows has the ability to transparently virtualize those writes