Skip to content

Instantly share code, notes, and snippets.

View flowchartsman's full-sized avatar
🏠
Working from home

Andy Walker flowchartsman

🏠
Working from home
View GitHub Profile
@StefanPetrick
StefanPetrick / basic_render_engine_v01
Last active December 8, 2023 02:50
Demo code for Stefans FastLED tutorial #2. It's a 2d render engine for procedural animations v0.1
// Polar basics demo for the
// FastLED Podcast #2
// https://www.youtube.com/watch?v=KKjFRZFBUrQ
//
// VO.1 preview version
// by Stefan Petrick 2023
// This code is licenced under a
// Creative Commons Attribution
// License CC BY-NC 3.0
@LOZORD
LOZORD / json_test.go
Created January 12, 2020 17:14
An example of using a native JSON-friendly Go struct as a type and input in a CEL program.
package test
import (
"bytes"
"encoding/json"
"testing"
"github.com/golang/protobuf/jsonpb"
structpb "github.com/golang/protobuf/ptypes/struct"
"github.com/google/cel-go/cel"
@jzelinskie
jzelinskie / config
Last active January 18, 2024 19:23
generate a knot-resolver (kresd) blacklist.rpz from pihole sources
-- Refer to manual: https://knot-resolver.readthedocs.io/en/latest/daemon.html#configuration
-- Listen on all interfaces (localhost would not work in Docker)
net.listen('0.0.0.0')
net.listen('0.0.0.0', 853, {tls=true})
-- Auto-maintain root TA
trust_anchors.file = '/data/root.keys'
-- Load Useful modules
@grihabor
grihabor / Makefile.version
Last active April 24, 2024 18:18
Makefile to use for incremental semantic versioning
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --match "v*" --always --tags)
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
VERSION := $(subst v,,$(VERSION_TAG))
VERSION_PARTS := $(subst ., ,$(VERSION))
@awalterschulze
awalterschulze / Makefile
Created February 2, 2017 13:27
golang: How to check whether a function is inlined
all:
make build
make objdump
build:
go build -gcflags -m main.go
objdump:
go tool objdump -s "main.main" main | grep CALL

Problems & Solutions for Interaction Between C and Go

At Vimeo, on the transcoding team, we work a lot with Go, and a lot with C, for various tasks such as media ingest. This means we use CGO quite extensively, and consequently, have run into bits that are perhaps not very well documented, if at all. Below is my effort to document some of the problems we've run into, and how we fixed or worked around them.

Many of these are obviously wrong in retrospect, but hindsight is 20/20, and these problems do exist in many codebases currently.

Some are definitely ugly, and I much welcome better solutions! Tweet me at @daemon404 if you have any, or have your own CGO story/tips, please! I'd love to learn of them.

Table of Contents

@17twenty
17twenty / GoWithC.go
Last active July 11, 2016 04:29
Cross Compiling and Language Interop oh my!
package main
import (
"./binding"
"fmt"
)
func main() {
binding.PrintHello()
binding.Seed(1)
fmt.Println(binding.Random())
@iamralch
iamralch / sshtunnel.go
Last active April 16, 2023 03:07
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
@jonhoo
jonhoo / README.md
Last active July 19, 2021 10:49
Distributed RWMutex in Go
@denji
denji / golang-tls.md
Last active April 29, 2024 03:39 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)