Skip to content

Instantly share code, notes, and snippets.

$ cp (which vault) .
$ upx ./vault
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2020
UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020
File size Ratio Format Name
-------------------- ------ ----------- -----------
205827425 -> 76223880 37.03% linux/amd64 vault
# TCP latency vs UDS latency:
$ tcp_lat 4096 4096
message size: 4096 octets
roundtrip count: 4096
average latency: 23817 ns
$ unix_lat 4096 4096
message size: 4096 octets
roundtrip count: 4096
average latency: 14799 ns
@jboero
jboero / gist:295d8d48d4d8f5e2df224935280628fd
Created March 22, 2021 12:40
Find my biggest binaries.
$ ls /usr/bin/| wc -l
4826
$ du -sch /usr/bin/* | sort -h | tail -25
13M /usr/bin/qemu-system-ppc
13M /usr/bin/qemu-system-x86_64
14M /usr/bin/qemu-system-arm
14M /usr/bin/qemu-system-ppc64
15M /usr/bin/qemu-system-aarch64
17M /usr/bin/audacity
19M /usr/bin/clementine
#!/bin/bash
# Usage: secure-badge.sh [NAME] [YEAR]
INPUT=$(echo "$@" | base64) 
SIG=$(vault write image-verifiers/hmac/svg-signer \
 input="$INPUT" -format=json) 
SIG=$(echo $SIG | jq .data.hmac) 
SIG="#${SIG:10:8}"
sed -i "s/NAME/$1/" template.svg 
sed -i "s/YEAR/$2/" template.svg 
sed -i "s/SIGNATURE/$SIG/" template.svg
#!/bin/bash
# Note requirement: ./last-hash is a symlink to the previous file or seed text.
# Usage: sign-image.sh [IMAGE FILE]
LAST=$(readlink -f last-hash)
cat last-hash | base64 -w 0 > last-base64
# Get signature from the last image/block
SIG=$(vault write image-verifiers/sign/chain-signer/sha2–256 input=@last-base64 -format=json)
SIG=$(echo “$SIG” | jq -r .data.signature)
@jboero
jboero / unix-to-tcp.go
Created July 27, 2020 17:22 — forked from jpillora/unix-to-tcp.go
Forward unix socket to tcp socket
package main
import (
"io"
"log"
"net"
"os"
)
const (
$ sudo yum list --showduplicates vault-enterprise
Last metadata expiration check: 0:00:19 ago on Thu 16 Jul 2020 10:39:05 AM BST.
Installed Packages
vault-enterprise.x86_64 1.4.3+ent-1 @hashicorp
Available Packages
vault-enterprise.x86_64 1.3.3+ent-1 hashicorp
vault-enterprise.x86_64 1.3.4+ent-1 hashicorp
vault-enterprise.x86_64 1.3.5+ent-1 hashicorp
vault-enterprise.x86_64 1.3.6+ent-1 hashicorp
vault-enterprise.x86_64 1.3.7+ent-1 hashicorp
# RPM systemd distros:
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
# APT or DEB systemd distros:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
#!/bin/bash
export ATLAS_TOKEN={YOURTOKEN}
export OLD_ORG={YOUROLDORG}
export NEW_ORG={YOURNEWORG}
for ws in $(tfe workspace list)
do
tfe pullvars -name "$OLD_ORG/$ws" > $ws.vars
tfe pullvars -name "$OLD_ORG/$ws" -env true > $ws.env