Skip to content

Instantly share code, notes, and snippets.

View prologic's full-sized avatar
👋
Principal SRE, Founder of Yarn.social and Salty.im

James Mills prologic

👋
Principal SRE, Founder of Yarn.social and Salty.im
View GitHub Profile
@prologic
prologic / main.go
Created April 1, 2022 14:46
Test program to test Go'a netdns=cgo resolver on macOS
package main
import (
"fmt"
"log"
"net"
)
func main() {
cnames, addrs, err := net.LookupSRV("_salty", "_tcp", "home.arpa")
@prologic
prologic / consul.yml
Created October 11, 2021 07:21
Consul Stack (Docker Swarm)
---
version: "3.8"
services:
seed:
image: consul:latest
environment:
- "CONSUL_LOCAL_CONFIG={\"disable_update_check\": true}"
- "CONSUL_BIND_INTERFACE=eth0"
entrypoint:
@prologic
prologic / weed.yml
Created May 25, 2021 03:07
SeaweedFS Docker Swarm Stack
---
version: "3.8"
services:
master:
image: chrislusf/seaweedfs:latest
command: master -mdir=/data
networks:
- weed
@prologic
prologic / go.mod
Created January 11, 2021 23:07
Twtxt Search Engine Crawler proof-of-concept
module twtxt-search-engine
go 1.14
require (
github.com/gocolly/colly/v2 v2.1.0
github.com/jointwt/twtxt v0.0.0-20210108082814-7098fcfa49df
github.com/prologic/read-file-last-line v0.0.0-20200806014221-326f63458987
github.com/sirupsen/logrus v1.7.0
)
@prologic
prologic / LearnGoIn5mins.md
Last active February 18, 2024 15:59
Learn Go in ~5mins
# First try, we get edb8f4a65586 as our hash
$ cat << EOF | docker build --no-cache -
> FROM alpine
> RUN touch foo
> EOF
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM alpine
---> a24bb4013296
Step 2/2 : RUN touch foo
---> Running in 9687f21f4edb
@prologic
prologic / post.go
Created December 18, 2019 12:56
A quick 'n dirty MIcroPub Go (Golang) client for Micro.blog (https://micro.blog)
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
package main
import (
"fmt"
"log"
"os"
"runtime"
"runtime/pprof"
"strings"
@zicklag
zicklag / swarm-stack.yml
Last active May 25, 2021 00:31
SeaweedFS Swarm Stack
version: '3.5'
# WARNING: Haven't tested this version of this YAML exactly, but it *should* be correct.
services:
master-1:
image: chrislusf/seaweedfs:latest
networks:
- hostnet
command: "master -port=9333 -defaultReplication=001 -peers=localhost:9333,localhost:9334,localhost:9335"
@mrnugget
mrnugget / op_get_self.diff
Last active March 20, 2019 10:30
Fix for recursive closures that are defined in other functions. These break in version 1.0 of "Writing A Compiler In Go". This fix adds another opcode, OpGetSelf, and emits it whenever there's a reference to the currently executed function.
diff --git a/ast/ast.go b/ast/ast.go
index 8db3b39..f0420f4 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -2,6 +2,7 @@ package ast
import (
"bytes"
+ "fmt"
"strings"