Skip to content

Instantly share code, notes, and snippets.

View untoreh's full-sized avatar
🐭
munch...

Francesco Giannelli untoreh

🐭
munch...
View GitHub Profile
@untoreh
untoreh / Duplicacy init repo links.md
Created May 18, 2018 12:22
symlink root path to allow backing up from a different repository path
@untoreh
untoreh / Get Duplicacy.md
Created May 17, 2018 15:36
setup duplicacy cli binary on current host
prefix=/opt
alias=dup
osver=duplicacy_linux_x64_
ver=2.1.0
mkdir -p "$prefix$alias" "$prefix/bin"
wget -q "https://github.com/gilbertchen/duplicacy/releases/download/v$ver/$osver$ver" -O "$prefix/$alias"
chmod +x "$prefix/$alias/$alias"
ln -sr "$prefix/$alias/$alias" "$prefix/bin"

Generate a random string with just bash

Adding options to add newlines, choose lowercase or uppercase or both is trivial

rand_string() {
    local c=0
    while [ $c -lt $1 ]; do
        printf "\x$(printf '%x' $((97+RANDOM%25)))"
        c=$((c+1))
 done
@untoreh
untoreh / fix-ppa-keys
Created April 4, 2018 15:48
add all missing ubuntu ppa keys
#!/bin/sh
KEYS=$(apt update 2>/dev/null | grep NO_PUBKEY | sed -r 's/.*NO_PUBKEY (.*)/\1/')
for k in $KEYS; do
apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys $k
done

netcat http server

while true ; do nc -l -p 1234 -e 'echo -e "HTTP/1.1 200 OK\n\n $(date)"'; done

@untoreh
untoreh / alpine glibc.md
Last active March 15, 2018 15:22
download alpine glibc

alpine glibc

apk add --update ca-certificates wget
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-2.27-r0.apk
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-bin-2.27-r0.apk
apk add glibc-2.27-r0.apk glibc-bin-2.27-r0.apk