Skip to content

Instantly share code, notes, and snippets.

View cstockton's full-sized avatar

Chris Stockton cstockton

View GitHub Profile
BenchmarkSend/128-24 200000 5788 ns/op
BenchmarkSend/128#01-24 1000000 2053 ns/op
BenchmarkSend/256-24 100000 10465 ns/op
BenchmarkSend/256#01-24 500000 3311 ns/op
BenchmarkSend/512-24 100000 18025 ns/op
BenchmarkSend/512#01-24 200000 6123 ns/op
BenchmarkSend/1024-24 30000 36596 ns/op
BenchmarkSend/1024#01-24 100000 11584 ns/op
BenchmarkSend/2048-24 20000 64805 ns/op
BenchmarkSend/2048#01-24 50000 22978 ns/op
@cstockton
cstockton / gist:4212207
Created December 5, 2012 04:19
Simple kue cleanup script
// this is a simple log action
function QueueActionLog(message) {
this.message = message || 'QueueActionLog :: got a action for job id(%s)';
this.apply = function(job) {
console.log(util.format(this.message, job.id));
return true;
};
}

Arch Linux Install Guide

WARNING

Do not blindly paste commands from this guide, you're responsible for any destruction it causes.

This is a guide for installing a minimal arch linux from scratch.

This guide uses full disk encryption with a detached luks header so if you were to lose your laptop it's impossible for an attacker to brute force one of your luks slots. This works with any generic USB storage device.

The main threat I'm trying to mitigate is someone stealing my laptop from my backpack while I'm out and about. I can rest easy if my laptop is ever stolen knowing that it's nothing but random data on both the backup disk and the root partition.

@cstockton
cstockton / cancellation.go
Created September 16, 2017 16:14
Example of cancellation.
package main
import (
"context"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"time"
# Certs are for local testing.
certs := api.test api01.test api02.test api03.test \
server.test server01.test server02.test server03.test \
client.test client1.test client2.test client3.test
.PHONY: all
all: | $(foreach c,$(certs),$(addprefix certs/,$(c)).crt)
# destroy private CA key immediately after make completes so it can be
# trusted for local dev.
test -f ca/ca.key && shred -uz -n 1024 ca/ca.key || true

TLDR, I want to propose / have a conversation around two things:

  1. Create a protocol / wire / some form of structural definition for distributed tracing. I urge the project owners to please reconsider having the libraries be the specification. I should not have to import an SDK to participate in distributed tracing, I should only need to be a cooperative client able to produce the data in the format agreed upon.
  2. The protocol / specification is designed to be 100% stateless. For lack of better words "eventual causality", I should know which set of spans are open and there should not be a consequence to a span which never was closed. Leave it to visualization and tooling to iron through the edge cases. Tracing is about observation across systems, a failed transaction, seg fault, crashing program, etc should not lose all the data that led up to that event as it does in the implementations I've used today (due to buffering log records and hanging onto unfinished spans in memory).

Where could I find more i

$ grep -r 'Error generating capa'
Binary file dmvd matches
$ _bin=$(which dmvd)
$ readelf -S $_bin | grep rodata
  [15] .rodata           PROGBITS         0000000000457a40  00057a40
$ readelf -p15 $_bin | grep -i 'Error generating'
  [  43c8]  Error generating capability request.
$ python -c 'print(hex(int("0000000000457a40", 16) + int("43c8", 16)))'
0x45be08
####
# Machine GoBGP configuration: gobgp01
##
[global.config]
as = 26496
router-id = "10.20.30.21"
####
# Environment GoBGP configuration: docker
package ipnet
var (
// these allow zero-allocation IP masking
cidrMasksIPv4 = [33]net.IPMask{}
cidrMasksIPv6 = [129]net.IPMask{}
)
func init() {
for i := 0; i <= 32; i++ {
type contextKey struct{}
// FromContext returns the current zap logger from the given context, or
// the default global logger (by calling zap.L()) otherwise.
func FromContext(ctx context.Context) *zap.Logger {
if v, ok := ctx.Value(contextKey{}).(*zap.Logger); ok {
return v
}
return zap.L()