Skip to content

Instantly share code, notes, and snippets.

Vincent Batts vbatts

Block or report user

Report or block vbatts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vbatts
vbatts / quickest.go
Created Nov 14, 2019
quickest rsync server response
View quickest.go
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"os/exec"
"sort"
@vbatts
vbatts / Corefile
Last active Oct 30, 2019
using coredns to route a split tunnel (like having wireguard connected to home network)
View Corefile
batts.lan. {
# i compiled in this unbound plugin, to get recursive lookups. On centos it needed the 'unbound-devel' package.
unbound
cache
forward . 192.168.0.1
errors
log
}
. {
@vbatts
vbatts / Dockerfile
Created Mar 7, 2019
I want repo:tag@digest from every layer in non-colliding values!
View Dockerfile
ARG IMAGE=fedora
ARG IMAGE_TAG=29
FROM ${IMAGE}:${IMAGE_TAG}
LABEL com.hashbangbash.image=${IMAGE}:${IMAGE_TAG}@${DIGEST}
LABEL com.hashbangbash.image.repo=${IMAGE}
LABEL com.hashbangbash.image.tag=${IMAGE_TAG}
LABEL com.hashbangbash.image.digest=${DIGEST}
@vbatts
vbatts / main.go
Created Mar 4, 2019
buffering features from go releases
View main.go
package main
import (
"fmt"
)
func main() {
var str = "apples and bananas; apples and bananas; apples and bananas; apples and bananas;"
fmt.Println(ReplaceAll(str, "an", "op"))
}
@vbatts
vbatts / README.md
Last active Oct 18, 2018
knative+buildah deep dive
View README.md

walkthrough: buildah on knative

The buildah utility is a versitile container build tool that does not require a daemon (everything is direct invocation). See my "deep dive" for a few hands on use-cases.

Recently knative was announced. It is a project to enable the kubernetes primitives needed to build a functions-as-a-service. There are a plumbing services needed around this use-case, "build" is one of them. Building containers is largely an indepenent goal and story of "serverless" or "FaaS", but I get why they are grouped together.

@vbatts
vbatts / Dockerfile
Last active Jan 18, 2019
buildah: quick deep dive
View Dockerfile
FROM buildpack-deps:stretch-scm
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
@vbatts
vbatts / main.go
Last active Oct 24, 2017
[golang] Looking for struct pointers in interface function signatures
View main.go
package main
// spurred from discussion around https://github.com/kubernetes/kubernetes/pull/54257#issuecomment-338274869
import (
"flag"
"fmt"
"go/ast"
"go/build"
"go/parser"
@vbatts
vbatts / main.go
Created Oct 9, 2017
grafeas client trial
View main.go
package main
import (
"log"
"github.com/davecgh/go-spew/spew"
grf "github.com/grafeas/client-go"
)
func main() {
@vbatts
vbatts / output.txt
Last active Feb 24, 2017
sl-feeds on stock slackware
View output.txt
root@slackware64-current:/home/vbatts# which go
/usr/bin/go
root@slackware64-current:/home/vbatts# go version
go version go1.4.2 gccgo (GCC) 5.4.0 linux/amd64
root@slackware64-current:/home/vbatts# export GOPATH=`mktemp -d`
root@slackware64-current:/home/vbatts# export GOBIN=/usr/local/bin
root@slackware64-current:/home/vbatts# go get github.com/vbatts/sl-feeds/cmd/sl-feeds
root@slackware64-current:/home/vbatts# sl-feeds --sample-config > /tmp/sl-feeds.conf
root@slackware64-current:/home/vbatts# sl-feeds --config /tmp/sl-feeds.conf -d /tmp/
Writing to: "/tmp/"
@vbatts
vbatts / crc4.go
Created Jan 16, 2017
CRC-4 for golang
View crc4.go
package crc4
func Checksum(b []byte) uint8 {
crc := 0xFFFF
for bI := 0; bI < len(b); bI++ {
bit := uint8(0x80)
for bitI := 0; bitI < 8; bitI++ {
xorFlag := ((crc & 0x8000) == 0x8000)
crc = crc << 1
if ((b[bI] & bit) ^ uint8(0xFF)) != uint8(0xFF) {
You can’t perform that action at this time.