Skip to content

Instantly share code, notes, and snippets.

View vbatts's full-sized avatar
🧁

Vincent Batts vbatts

🧁
View GitHub Profile
@vbatts
vbatts / config.json
Last active March 3, 2016 20:04
OCI Sample config.json for testing https://github.com/opencontainers/specs/pull/313
{
"ociVersion": "0.3.0",
"platform": {
"os": "linux",
"arch": "amd64"
},
"process": {
"terminal": true,
"user": {
"uid": 1,
@vbatts
vbatts / e.go
Last active January 8, 2016 15:30
etcd hammer
package main
import (
"crypto/rand"
"flag"
"fmt"
"log"
"os"
"time"
@vbatts
vbatts / README.md
Created September 24, 2015 13:59
`fmt.Sprintf("%s", buf)` vs `string(buf)` for simple []byte arrays

Curiosity on the differences from moby/moby#16531 (comment)

$ go test
PASS
ok      _/home/vbatts/tmp/string        0.003s
$ go test -run=NONE -bench=. -test.benchmem=true 
PASS
BenchmarkString-4 100000 18982 ns/op 0 B/op 0 allocs/op
/home/vbatts/opt/bin/godoc
PACKAGE DOCUMENTATION
package oci
import "."
Package oci is a generated protocol buffer package.
package oci.config.bundle;
@vbatts
vbatts / show-tar-header.go
Created August 14, 2015 18:05
show-tar-header
package main
import (
"archive/tar"
"flag"
"fmt"
"io"
"os"
)
package main
/*
#include <inttypes.h>
struct dm_deps {
uint32_t count;
uint32_t filler;
uint64_t device[0];
};
package main
import (
"compress/gzip"
"io"
"os"
)
// usage `cat foo.gz | ./gogunzip > foo`
func main() {
@vbatts
vbatts / README.md
Last active August 29, 2015 14:23
validating tar-split, with golang `compress/gzip`

Output

vbatts@valse ~/tmp/010494540a4d46e2f516 (master) $ go build app.go
vbatts@valse ~/tmp/010494540a4d46e2f516 (master) $ ./app
Starting Sum on "/tmp/tar-split-test.160191501": 2b1c1c203e6bb0ab10c14db7361ede2402ef27468f901f979fb7e8ff8cf3d8c5
Ending Sum on "/tmp/tar-split-test.160191501": 2b1c1c203e6bb0ab10c14db7361ede2402ef27468f901f979fb7e8ff8cf3d8c5
@vbatts
vbatts / google-chrome_scale.diff
Created June 10, 2015 14:02
fix the scaling in chrome, without passing flags everywhere. (google-chrome-stable-43.0.2357.124-1.x86_64) (https://twitter.com/vbatts/status/608393019465859074)
--- /tmp/orig 2015-06-10 10:00:10.403089775 -0400
+++ /opt/google/chrome/google-chrome 2015-06-10 10:00:14.350098293 -0400
@@ -78,7 +78,7 @@ exec 2> >(exec cat >&2)
if [[ -n "$CHROME_USER_DATA_DIR" ]]; then
# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/chrome" \
- --user-data-dir="$CHROME_USER_DATA_DIR" "$@"
+ --user-data-dir="$CHROME_USER_DATA_DIR" --force-device-scale-factor=1 "$@"
else
- exec -a "$0" "$HERE/chrome" "$@"
@vbatts
vbatts / docker.sh
Created May 28, 2015 15:36
Isolated Docker daemon (for testing and portability)
#!/bin/sh
set -e
while getopts Dd:s:f:H: c; do
case $c in
H) # docker socket to use
export DOCKER_HOST="$OPTARG"
;;
d) # docker binary to use