Skip to content

Instantly share code, notes, and snippets.

View as's full-sized avatar

as

View GitHub Profile
@as
as / copy-k8s-resources-across-namespaces.sh
Created October 8, 2017 22:40 — forked from simonswine/copy-k8s-resources-across-namespaces.sh
Copying kubernetes resources accross namespaces
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create-f -
@as
as / samersa.go
Created March 9, 2018 03:09
Compare two RSA keys in Go
package main
import (
"crypto/rsa"
"errors"
"fmt"
"math/big"
)
const confidence = 100
@as
as / win10.daisycutter.bat
Last active March 17, 2018 23:08
Make Windows 10 remotely sufferable when required to work on it
:: Remove Apps from Windows 10
:: - You need the go command for this
:: - %GOBIN% should be set, and in %PATH%
:: - This wont remove all of the apps
:: - You need to be "ADMIN" cmd prompt for this to work
:: - Paste this into cmd.exe
:: - Yes, this could be a powershell script, but who has time to do that?
:: - This script comes with no warranty
:: - This script is in the public domain, with the hopes that someone other than me will find it useful
:: - Windows 10 is insufferable
@as
as / goodtimes.go
Created March 21, 2018 03:10
How to compare time correctly in Go
package main
import (
"fmt"
"time"
)
func main() {
t0 := time.Now()
t1 := t0
@as
as / cpu.go
Last active May 3, 2018 00:00
package main
import "time"
//
// [ producer ] ---------- [ scheduler ] ----------- [ consumer ]
// | |
// [ cpu ]
// [ cpu ]
// [ cpu ]
@as
as / consul.kv.md
Created May 18, 2018 06:47
Consul Key/Value Storage Notes - Brief

SYNOPSIS Consul Key/Value Storage Notes

DESCRIPTION Structure and function of consul key-value storage. Easier to find and slightly less verbose than the resources on the Consul documentation and sources

WIRE FORMAT

@as
as / Dockerfile
Last active June 27, 2018 07:10 — forked from dlsniper/Dockerfile
Dockerfile to test your Go code with the latest version of Go 1.10
FROM golang:1.10
ADD . /go/src/github.com/<user>/<repo>
WORKDIR /go/src/github.com/<user>/<repo>
RUN go test -coverpkg=all -coverprofile cover.out ./...
@as
as / pipes.go
Created July 8, 2018 08:00
Go: Using standard I/O, or "Portable Inter-process Communication without Berkeley"
// With no arguments, this program starts the launcher. For every line read from standard input,
// the launcher executes a second copy of itself with in 'calc' mode, and writes the line of input
// to that second process. The 'calc' process parses the data into a simple arithmetic expression
// and evaluates it. Then it writes the successful result back to the launcher, which prints it to
// the standard output or standard error. The calc process is launched once for every line of input
// typed by the user. This is intentional. The more optimal approach would be to run calc only once.
//
// go build pipes.go && pipes
package main
@as
as / self aware
Created August 9, 2018 05:39
"A challenge: to create a source code that contains a valid link to itself"
package main
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"io"
)
var x = string(0x60)
@as
as / godoc
Created August 17, 2018 08:17
godoc go doc missing command not found golang 1.12
go get golang.org/x/tools/cmd/godoc
#:: Q: Where's godoc?
#:: A: They removed it....
#::
#:: This is a system agnostic script that will download and install the godoc command