Skip to content

Instantly share code, notes, and snippets.

@cristaloleg
cristaloleg / golangci.yaml
Last active July 31, 2025 16:03
An opinionated golangci-lint config (right version™)
# $ golangci-lint run --config=~/.golangci.yml ./... > lint.txt
version: "2"
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
@micahyoung
micahyoung / go.mod
Last active March 19, 2024 20:47
Example of os.Chown-equivalent for Golang Windows
module go-windows-chown
go 1.15
require golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061
@aidvu
aidvu / Makefile
Last active March 21, 2023 21:06
Modify ping reply TTL with XDP
KDIR ?= /lib/modules/$(shell uname -r)
SDIR ?= $(KDIR)/source
CLANG ?= clang
LLC ?= llc
#ARCH := $(subst x86_64,x86,$(shell arch))
ARCH := x86
BIN := modify-ping-ttl.o
CLANG_FLAGS = -I. -I$(SDIR)/arch/$(ARCH)/include \
-I$(SDIR)/arch/$(ARCH)/include/generated \
@anikitenko
anikitenko / gist:b41206a49727b83a530142c76b1cb82d
Created October 11, 2017 07:41
[Golang] Convert size in bytes to Bytes, Kilobytes, Megabytes, GB and TB
package main
import (
"fmt"
"math"
"strconv"
)
var (
sizeInMB float64 = 999 // This is in megabytes