Skip to content

Instantly share code, notes, and snippets.

@elvuel
elvuel / go-env-with-msys2.md
Created March 18, 2025 14:08 — forked from glycerine/go-env-with-msys2.md
Go development environment on Windows with MSYS2

Go development environment on Windows with MSYS2

Normally, it is sufficient to grab the Go MSI installer from the website in order to set up the toolchain. However, some packages that provide Go wrappers for C libraries rely on cgo tool, which in turn, needs the GCC toolchain in order to build the glue code. Also, 3rd-party dependencies are usually hosted on services like GitHub, thus Git is also needed. This mini-guide illustrates how to setup a convenient development environment on Windows using MSYS2.

@elvuel
elvuel / ss.go
Created January 11, 2025 16:53 — forked from rgl/ss.go
take a screenshot of a specific Windows application window in pure Go
// +build windows
package screen
import (
"fmt"
"image"
"reflect"
"syscall"
"unsafe"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elvuel
elvuel / main.go
Created January 8, 2025 02:05 — forked from EliCDavis/main.go
Find Windows Handle Of Application In Golang
package main
import (
"fmt"
"log"
"syscall"
"unsafe"
)
var (

Find input audio rate beforehand thus:

ffmpeg -i input.mp4

Assuming input audio rate 44,100 Hz, this command will do the job:

ffmpeg -i input.mp4 -af asetrate=44100*3/4,atempo=4/3 output.mp4

The factor of 3/4 will change most female and “skinny” (chipmunk) voices into male and “fat” voices. Use 4/3 for the opposite:

@elvuel
elvuel / vncserver@:1.service
Created June 6, 2024 03:11 — forked from spinxz/vncserver@:1.service
systemd service file for running a vncserver (e.g. tightvncserver)
# Vncserver service file for Debian or Ubuntu with systemd
#
# Install vncserver and tools
# e.g. apt-get install tightvncserver autocutsel gksu
#
# 1. Copy this file to /etc/systemd/system/vncserver@:1.service
# 2. Edit User=
# e.g "User=paul"
# 3. Edit the vncserver parameters appropriately in the ExecStart= line!
# e.g. the -localhost option only allows connections from localhost (or via ssh tunnels)
@elvuel
elvuel / ed25519genandsave.go
Created August 8, 2023 14:07 — forked from rorycl/ed25519genandsave.go
Generate ed25519 keys in PEM format using Go
// RCL 05 June 2021
/*
verify with `openssl pkey -in <privatekey>` or `openssl pkey -in <privatekey> -pubout`
the latter should match the publickey
*/
package main
import (
@elvuel
elvuel / about.md
Created April 26, 2022 02:38 — forked from d4l3k/about.md
Golang Performance Tricks

This is a gist with a set of helpful performance tricks and best practices that I've found on the internet.

@elvuel
elvuel / delete_git_submodule.md
Created July 31, 2018 02:04 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@elvuel
elvuel / nats-cluster-tls-kubernetes.org
Created June 14, 2018 03:24 — forked from wallyqs/nats-cluster-tls-kubernetes.org
Secure NATS Cluster in Kubernetes

Secure NATS Cluster in Kubernetes

Creating the certificates

Generating the Root CA Certs

{
    "CN": "My Custom CA",
    "key": {