Skip to content

Instantly share code, notes, and snippets.

Tibor Vass tiborvass

  • Docker
View GitHub Profile
@tiborvass
tiborvass / unix.c
Created Apr 14, 2020
Pass fds over unix socket
View unix.c
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
static
@tiborvass
tiborvass / s3etag.sh
Created Jan 31, 2020 — forked from emersonf/s3etag.sh
A Bash script to compute ETag values for S3 multipart uploads on OS X.
View s3etag.sh
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 file partSizeInMb";
exit 0;
fi
file=$1
if [ ! -f "$file" ]; then
@tiborvass
tiborvass / demo.go
Last active Jan 17, 2020
Script to show fake demos with monkey typing: go run demo.go path/to/textfile [number_of_steps_to_skip]
View demo.go
package main
import (
"bufio"
"fmt"
"io"
"log"
"math/rand"
"os"
"os/exec"
View gist:05f99086c7fce95c941c9aafb6d1b83e
package main
import (
"strconv"
"strings"
)
type version []int
func parseVersion(s string) (version, error) {
View create-user.sh
#!/bin/bash
useradd -s /bin/bash -m unprivileged
cp -rf ~/.ssh ~unprivileged/
chown -R unprivileged:unprivileged ~unprivileged/.ssh/
@tiborvass
tiborvass / gist:f9303e496644c77bd11ba08ec00d9fa0
Created Jul 25, 2017
archive/tar changes between go1.8 and go1.9rc1
View gist:f9303e496644c77bd11ba08ec00d9fa0
$ git log origin/release-branch.go1.8..origin/release-branch.go1.9 src/archive/tar
commit c991d2ab14496789146560608c5756d5d83b35f6
Author: Joe Tsai <joetsai@digital-static.net>
Date: Tue Jun 27 17:30:39 2017 -0700
archive/tar: use best effort at writing USTAR header
Prior to this change, if the Writer needed to use the PAX format, it would
output a USTAR header with an empty name. This should be okay since the PAX
specification dictates that the PAX record for "path" should override the
View main.go
package main
import (
"fmt"
git "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/utils/ioutil"
)
func main() {
@tiborvass
tiborvass / Dockerfile
Last active Jul 7, 2017
Docker+vndr tip for Go libraries
View Dockerfile
FROM golang:1.8
RUN go get github.com/lk4d4/vndr
WORKDIR /go/src/github.com/someone/someproject
# Make sure vendor.conf only has commit hashes to always behave correctly with build caching.
COPY vendor.conf .
RUN vndr -whitelist '.*'
COPY . .
# Rationale:
# Go libraries can have 3rd-party dependencies and should have tests.
View gist:45bd25394f09b69fb682ac126877b9eb
[root@fedora-2gb-nyc3-01 ~]# curl -G https://experimental.docker.com/ | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- 100 14811 100 14811 0 0 84919 0 --:--:-- --:--:-- --:--:-- 85612
+ sh -c 'sleep 3; dnf -y -q install docker-engine'
warning: /var/cache/dnf/docker-experimental-repo-aab05090d83f3f86/packages/docker-engine-1.12.0-1.fc24.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 2c52609d: NOKEY
Importing GPG key 0x2C52609D:
Userid : "Docker Release Tool (releasedocker) <docker@docker.com>"
Fingerprint: 5811 8E89 F3A9 1289 7C07 0ADB F762 2157 2C52 609D
From : https://yum.dockerproject.org/gpg
You can’t perform that action at this time.