Skip to content

Instantly share code, notes, and snippets.

View Tom5521's full-sized avatar
💭
Writing an interpreter in Go

Tom Tom5521

💭
Writing an interpreter in Go
View GitHub Profile
@gitaarik
gitaarik / git_submodules.md
Last active August 3, 2026 17:58
Git Submodules basic explanation

Git Submodules - Basic Explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a sub-repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@sevkin
sevkin / url_open.go
Last active March 7, 2026 15:44
golang open url in default browser
// https://stackoverflow.com/questions/39320371/how-start-web-server-to-open-page-in-browser-in-golang
// open opens the specified URL in the default browser of the user.
func open(url string) error {
var cmd string
var args []string
switch runtime.GOOS {
case "windows":
cmd = "cmd"
args = []string{"/c", "start"}
@asukakenji
asukakenji / 0-go-os-arch.md
Last active June 5, 2026 16:29
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@nictuku
nictuku / gist:c9858a4fe2c7b92a01da2e635b7c147c
Created July 3, 2018 23:56
All valid GOOS and GOARCH values
$ go tool dist list
android/386
android/amd64
android/arm
android/arm64
darwin/386
darwin/amd64
darwin/arm
darwin/arm64
dragonfly/amd64
@jarun
jarun / Termux_from_Ubuntu.md
Last active March 7, 2026 17:40
How to connect to Termux from Ubuntu desktop

In this example, we will setup a SSH server on Termux (for Android) and connect to the server from Ubuntu desktop. However, a similar procedure should work with any SSH server.

  1. Generate your ssh key pair on your desktop

    $ ssh-keygen
    
  2. Check your desktop IP address (say, 192.168.0.100)

  3. Run ssh server on your desktop

  4. Copy the file to Termux over SCP

$ scp arun@192.168.0.100:~/.ssh/id_rsa.pub ~/.ssh/authorized_keys

@rb-dahlb
rb-dahlb / opengl-fix-hd-graphics-windows-10.md
Last active March 29, 2026 19:52
OpenGL fix for Intel HD Graphics 3000 on Windows 10

Fix for Open GL on Intel HD Graphics 3000 - Windows 10

The drivers for Intel HD Graphics 3000 in Windows 10 does not expose all Open GL capabilities of the GPU. So software relying on Open GL features not present in Open GL 1.1 will not work. Using older versions of Windows or Linux might work since the chip have more features than the driver exposes.

The fix is to add a compatibility shim using the Windows ADK software.

1. Download and install Windows ADK

Link: https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install

@gustawho
gustawho / arch-linux-instalacion.md
Last active February 24, 2025 18:14
Guía de Instalación de Arch Linux

Guía de Instalación de Arch Linux

El objetivo de este documento es orientar a quien sea que tenga la intención de instalar Arch Linux, por los motivos que sean. Aunque se tienen como prioridad a los nuevos usuarios, se espera que sea de utilidad a cualquiera persona, sin importar su nivel de experiencia. Aunque se ha realizado con las mejores intenciones, los errores y desinformaciones no siempre pueden evitarse. Una disculpa adelantada si esto provoca cualquier inconveniente, ¡las correcciones y recomendaciones son bienvenidas!

La estructura y el flujo de esta guía son de tal forma que, según el autor, proveen una serie de instrucciones naturales para que el resultado final de la instalación y configuración de Arch Linux sea equiparable a lo análogo de cualquier otra distribución o sistema operativo. Al principio de cada sección se ofrecen enlaces a la Wiki y a otros sitios (📌) y, aunque no necesariamente se tratarán de referencias, en la mayoría de los casos dichas entradas ofrecen soporte y una mayor p

@jerblack
jerblack / Elevate when needed in Go.md
Last active June 29, 2026 20:50
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

@probonopd
probonopd / Wayland.md
Last active August 14, 2026 18:08
Think twice about Wayland. It breaks everything!

Think twice before abandoning X11. Wayland breaks everything!

tl;dr: Wayland is not "the future", it is merely an incompatible alternative to the established standard with a different set of priorities and goals.

Wayland breaks everything! It is binary incompatible, provides no clear transition path with 1:1 replacements for everything in X11, and is even philosophically incompatible with X11. Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating e

@maratori
maratori / .golangci.yml
Last active August 1, 2026 16:08
Golden config for golangci-lint
# ==================================================================================================
#
# NOTICE
#
# This gist is no longer maintained. It was moved to repo:
#
# https://github.com/maratori/golangci-lint-config
#
# Full history and all v2 releases are preserved in the repo.
#