Skip to content

Instantly share code, notes, and snippets.

@zmb3
zmb3 / static_cgo.md
Last active February 21, 2025 14:23
Compile static binaries for Go programs that leverage Cgo.

In order to compile a fully static binary when using Cgo you'll need to link in a C library like musl.

I find it convenient to have a Docker image ready for building these artifacts.

FROM golang
RUN wget https://musl.libc.org/releases/musl-1.2.5.tar.gz && \
   tar -xzf musl-1.2.5.tar.gz && \
   cd musl-1.2.5 && \
 ./configure --enable-static --disable-shared && \
@KiitoX
KiitoX / youtubemusicvolume.js
Last active March 14, 2024 12:19
More volume steps on youtube music
// ==UserScript==
// @name More volume steps on youtube music
// @version 1.0.5
// @author Emma
// @license WTFPL; do with this whatever you want
// @namespace https://github.com/KiitoX
// @updateURL https://gist.githubusercontent.com/KiitoX/38f8e4c1375939848a79cfa756fa32ef/raw/youtubemusicvolume.js
// @match https://music.youtube.com/*
// @grant none
// @run-at document-end
@xirixiz
xirixiz / Set up GitHub push with SSH keys.md
Last active June 6, 2025 11:21 — forked from developius/README.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "[email protected]"
@kennwhite
kennwhite / word_wrap.go
Last active February 6, 2022 06:11
Basic golang word wrap string split
/*
Wrap long lines on rough column boundaries at spaces
Working example: https://play.golang.org/p/3u0X6NyMua
Based on algo from RosettaCode, which is nifty
https://www.rosettacode.org/wiki/Word_wrap#Go
*/
package main
import (
@andrewmilson
andrewmilson / file-upload-multipart.go
Last active April 14, 2025 12:54
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@callerobertsson
callerobertsson / fibonacci.go
Last active January 14, 2022 15:49
Golang: Fibonacci Big Number
package main
import (
"fmt"
"math/big"
)
func main() {
for i := 1; i <= 10; i++ {