Skip to content

Instantly share code, notes, and snippets.

@miekg
miekg / udpserv.go
Created May 10, 2017 09:29
Simple udp server in Go
package main
import (
"log"
"net"
)
func main() {
// listen to incoming udp packets
pc, err := net.ListenPacket("udp", ":1053")
@miekg
miekg / gist:e80d2eadfea48422178cdbaaf9f8a33f
Created May 1, 2017 08:25
SO_REUSEPORT for am64 Golang
diff --git a/udp_linux.go b/udp_linux.go
index 033df42..e1f9be8 100644
--- a/udp_linux.go
+++ b/udp_linux.go
@@ -44,18 +44,25 @@ func setUDPSocketOptions4(conn *net.UDPConn) error {
if err != nil {
return err
}
+ defer file.Close()
+
Apr 06 10:16:00 kube kubelet[4369]: W0406 10:16:00.202137 4369 container_manager_linux.go:218] Running with swap on is not supported, please disable swap! This will be a fatal error by default starting in K8s v1.6! In the meantime, you can opt-in to making this a fatal error by enabling --experimental-fail-swap-on.
Apr 06 10:16:40 kube kubelet[5117]: error: failed to run Kubelet: invalid kubeconfig: stat /etc/kubernetes/kubelet.conf: no such file or directory
Apr 06 10:16:51 kube kubelet[5148]: W0406 10:16:51.106208 5148 container_manager_linux.go:218] Running with swap on is not supported, please disable swap! This will be a fatal error by default starting in K8s v1.6! In the meantime, you can opt-in to making this a fatal error by enabling --experimental-fail-swap-on.
Apr 06 11:18:59 kube kubelet[6108]: error: failed to run Kubelet: invalid kubeconfig: stat /etc/kubernetes/kubelet.conf: no such file or directory
Apr 06 11:19:09 kube kubelet[6144]: W0406 11:19:09.575408 6144 container_manager_linux.
Apr 06 10:16:00 kube kubelet[4369]: W0406 10:16:00.202137 4369 container_manager_linux.go:218] Running with swap on is not supported, please disable swap! This will be a fatal error by default starting in K8s v1.6! In the meantime, you can opt-in to making this a fatal error by enabling --experimental-fail-swap-on.
Apr 06 10:16:40 kube kubelet[5117]: error: failed to run Kubelet: invalid kubeconfig: stat /etc/kubernetes/kubelet.conf: no such file or directory
Apr 06 10:16:51 kube kubelet[5148]: W0406 10:16:51.106208 5148 container_manager_linux.go:218] Running with swap on is not supported, please disable swap! This will be a fatal error by default starting in K8s v1.6! In the meantime, you can opt-in to making this a fatal error by enabling --experimental-fail-swap-on.
Apr 06 11:18:59 kube kubelet[6108]: error: failed to run Kubelet: invalid kubeconfig: stat /etc/kubernetes/kubelet.conf: no such file or directory
Apr 06 11:19:09 kube kubelet[6144]: W0406 11:19:09.575408 6144 container_manager_linux.
Colleague1: We should just quit and start a farm.
Me: Oh yeah, just some animals and nothing else.
Colleague2: Yes, sounds great.
Me: But, you know how it goes. Soon you'll buy a laptop.
Next, you'll fix the WiFi. Before you're know it, you're doing the same shit.
C2: Yes, you're doing the same shit *and* you have to take care of these fucking animals as well!

CoreDNS Proxy

This Corefile allows most names to be proxied to Google using https/json, but some local names used in my network are forwarded to my router. Yes, for some reason my local DNS does not use a proper domain, but default to root. I've also haven't found a way to change this...

. {
	proxy . 8.8.8.8:53 {
 except raspberrypi higgs libreelec gluon brik flo
@miekg
miekg / parseSRV.go
Created December 23, 2016 11:36
parse server records
package main
import (
"fmt"
"github.com/miekg/dns"
)
func main() {
fmt.Println("vim-go")
@miekg
miekg / grpc-dns.txt
Created December 29, 2015 21:21
gRPC based DNS protocol
Network Working Group R. Gieben
Internet-Draft December 20, 2015
Intended status: Standards Track
Expires: June 22, 2016
@miekg
miekg / gist:0e563d1fd25ffea0fa85
Created December 19, 2015 08:12
Debugging pkcs11 go program
# kernel lock up?
[ 1778.501345] WARNING: CPU: 3 PID: 6455 at /build/linux-jHWiKd/linux-3.13.0/kernel/watchdog.c:24
5 watchdog_overflow_callback+0x9c/0xd0()
[ 1778.501347] Watchdog detected hard LOCKUP on cpu 3
% ps aux|grep '[6]455'
miek 6455 16.3 0.2 145652 7784 pts/6 R 08:01 0:45 ./slot
% kill -9 6455
% ps aux|grep '[6]455'
miek 6455 15.0 0.2 145652 7784 pts/6 R 08:01 0:45 ./slot
R. Gieben
Atoom
December 10, 2014
Using mmark to create I-Ds and RFCs