Skip to content

Instantly share code, notes, and snippets.

# cloud-config
hostname: pi-4
manage_etc_hosts: true
write_files:
- content: |
network:
ethernets:
eth0:
@narqo
narqo / main.go
Last active July 27, 2020 19:56
A boilerplate for a new Go application
package main
import (
"context"
"flag"
"log"
"os"
"os/signal"
"syscall"
)
// pkg/svc
type SettingsService struct {
db DB // DB is an interface
}
func (svc *SettingsService) IsProCustomer(token Token) bool {
v := svc.db.GetProCustomer(makeProPKFromToken(token))
return v == "1"
}
@narqo
narqo / aerospike-README.md
Last active February 10, 2020 21:05
Aerospike Server systemd configuration @ rpi (Ubuntu 19.10, aarch64)
package main
import (
"net"
"net/http"
)
const addr = ":8080"
func main() {
@narqo
narqo / one_value_key_intern_test.go
Last active September 28, 2018 13:32
An example of strings interning. See the discussion https://github.com/golang/go/issues/5160
package main
import (
"sync"
)
type oneValueK struct {
k1, k2, k3 string
}
@narqo
narqo / ids.go
Last active September 21, 2018 11:23
package id
type IdType int
const (
IdTypeUnknown IdType = -1
IdType1 IdType = iota
IdType2
)

Run delve in headless mode, logging rpc calls to the delve.out file

= ./go/bin/dlv core adjust_server core.250387 --headless --listen 178.162.216.107:40233 --api-version=2 --log --log-output rpc 2> delve.out

Get list of running goroutines:

= dlv connect 178.162.216.107:40233
goroutines