all repos — dotfiles @ 5cae5ce7fa8585282f99f5b0c57b3e31ba471a58

my *nix dotfiles

bin/lock.sh (view raw)

 1#!/usr/bin/env bash
 2
 3import -window root /tmp/lock.png
 4convert /tmp/lock.png /tmp/lock.jpg
 5file=/tmp/lock.jpg
 6
 7# stolen from xero
 8function datamosh() {
 9	fileSize=$(wc -c < "$file")
10	headerSize=10
11	skip=$(shuf -i "$headerSize"-"$fileSize" -n 1)
12	count=$(shuf -i 1-10 -n 1)
13	for i in $(seq 1 $count);do byteStr=$byteStr'\x'$(shuf -i 0-255 -n 1); done;   
14	printf $byteStr | dd of="$file" bs=1 seek=$skip count=$count conv=notrunc >/dev/null 2>&1
15}
16
17steps=$(shuf -i 20-30 -n 1)
18for i in $(seq 1 $steps);do datamosh "$file"; done
19
20convert /tmp/lock.jpg /tmp/lock.png >/dev/null 2>&1
21rm /tmp/lock.jpg
22file=/tmp/lock.png
23
24i3lock -u -i "$file"