Skip to content

Instantly share code, notes, and snippets.

View vbatts's full-sized avatar
🧁

Vincent Batts vbatts

🧁
View GitHub Profile
@vbatts
vbatts / ensure_loops.sh
Created November 6, 2014 15:35
ensure enough loop devices. Pulled from https://github.com/jpetazzo/dind/issues/19#issuecomment-48859883 but ensure there are at least 4 loop devices
#!/bin/bash
ensure_loop(){
num="$1"
dev="/dev/loop$num"
if test -b "$dev"; then
echo "$dev is a usable loop device."
return 0
fi
echo "Attempting to create $dev for docker ..."
#!/bin/sh
set -e
dd of=pool.img if=/dev/zero bs=1G count=2
dd of=meta.img if=/dev/zero bs=1G count=1
l1=$(sudo losetup -f)
sudo losetup ${l1} ./pool.img
l2=$(sudo losetup -f)
@vbatts
vbatts / .gitignore
Last active May 13, 2020 00:17
renegotiation example
.client
.server
Dockerfile
FROM busybox
RUN dd if=/dev/urandom of=/dev/null bs=1024k count=5
@vbatts
vbatts / Dockerfile
Created January 16, 2015 19:45
Devel container
FROM fedora:20
RUN yum erase -y vim-minimal &&\
yum groupinstall -y "development tools" && \
yum install -y --setopt=override_install_langs=en --setopt=tsflags=nodocs \
yum-utils \
git \
golang \
mercurial \
bzr \
@vbatts
vbatts / setns.c
Created January 22, 2015 03:26
setns
#define _GNU_SOURCE
#include <fcntl.h>
#include <sched.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
} while (0)
@vbatts
vbatts / README.md
Last active August 29, 2015 14:14
investigating archive permutations due to hardlinks

Issue

The difference in the sum, has to do with an arbitrary order that can occur
when tar'ing hardlinks. The first file encountered pointing to the inode wins
and has it's Size recorded. Then following files that may have the same inode, then have their LinkName point to the first file's Name, and their Size is 0.

WIP to fix ti https://github.com/vbatts/docker/compare/vbatts-archive_sort

@vbatts
vbatts / README.md
Last active August 29, 2015 14:16
checksum consistency of gzip (golang and gnu utils)

Overview

Choose or make a simple tar archive to work with.

Layout

$ ls -sh t.tar
24K t.tar

Keybase proof

I hereby claim:

  • I am vbatts on github.
  • I am vbatts (https://keybase.io/vbatts) on keybase.
  • I have a public key whose fingerprint is 5B16 75CE 143A 088B AE92 EDFE 1093 7E57 733F 1362

To claim this, I am signing this object:

@vbatts
vbatts / build.sh
Created April 9, 2015 14:02
FORTIFY_SOURCE
#!/bin/sh
# build and see output
go build -x c.go
# if you link to outside libraries
#go build -ldflags '-extldflags "-DFORTIFY_SOURCE"' -x c.go