alias sumup='tr "\n" + | head -c-1 | bc -li | tail -n1'
Example: If you would like to find all files below 3MB and sumup their file size in bytes use:
find . -type f -size -3M -printf '%s+' | head -c-1 | bc -i | tail -n1
find -type f -name "*.jpg" -exec bash -c \ 'printf "%016x {}\n" "$((2#$(jpegtopnm "{}" -nosmooth | \ pnmscalefixed -h 8 -w 8 | ppmtopgm | pgmtopbm | \ pnminvert | pnmtoplainpnm | tr -dc 01)))"' \;
Dependencies: find and netpbm.
This script calculates a 64bit hash of all your jpg files, so you can compare them and find files with similar (or different) content. It's a really rough, quick and dirty approach:
a nice alternative to figlet by using netpbm
date +'%a %d.%m.%Y' | pbmtext | pbmtoascii
resulting in:
"M""""M oM M"""M oM"Mo oM o"""o oM"Mo o"""o oM"Mo M o o oo " M M M M " M M M M M M M M"""M M" M M M M M o" M M o" M M M M M M Mo oM M o" o Mo oM o" o Mo oM """" """ """ " " """ """ " """"" """ """"" """
this one generate lots of ed25519 ssh keypairs in your ramdisk and tries to find a keypair with a nice publickey sha256 base64 encoded fingerprint(!), matching the given pattern (e.g. your name). such a fingerprint is logged in syslog the host you'll login, and this will be an eyecatcher.
export s=YOURNAME d=/dev/shm;ulimit 64000;yes|xargs -P 0 sh -c "ssh-keygen -t ed25519 -P '' -f \"$d/s.$$.\$\$\"|\ grep -q \"$s\"&&cp \"$d/s.$$.\$\$\" \"$d/f.$$.\$\$.$(date +%s)\";rm \"$d/s.$$.\$\$\" \"$d/s.$$.\$\$.pub\";echo -n ."
it uses ssh-keygen from openssh. it will print a dot for every generated keypair, so you can add pipeviewer "|pv -b >/dev/null" for speed measurement.
just choose a special s= with your search pattern. replace YOURNAME and start the script. warning: this script will run many tasks in parallel and will generate several thousand keys per second on a modern machine.
if a keypair is found, its named "/dev/shm/f.??????.?????". the script won't terminate, just run forever and search further matching keys. all keys are deleted immediatly if they don't match.
you have to check manually ls /dev/shm/f.* if a key is found. if there is a result, choose a passphrase for the key ssh-keygen -p -f /dev/shm/f.????.???? and export your public key with ssh-keygen -y -f /dev/shm/f.?????.???? > /dev/shm/found.pub. copy both files to a safe place.
Hint: Since random input values are used to generate these keypairs, you can't really predict when you'll find a match. For short strings with 3-4 chars, you should get a result quiet fast. roll the dice. and you have to roll more than a double with lots of dices. :) This is just a quick hack.
Offtopic: Other Things that use Ed25519. So here is a tiny version of ssh-keygen: tiny-ssh-keygen-ed25519 from Péter Szabó (pts), based on tweetnacl. (local mirror. untested. do not trust in it. you would also have to modify the sourcecode to get the fingerprint of current generate key at stdout)
just for fun. hear some tick-sounds, like a geiger counter. they are getting faster if lesser memory is available. use pacat instead of aplay on pulse audio systems.
while true; do echo geigercounter_free_memory | aplay -q -f cd -r 2000; sleep 0.$(($(grep ^MemFree /proc/meminfo | tr -dc 0-9)/1000)); done
hex (0000-ffff) starting in 1970-01-01 overflow after year 2148:
date +%s/3600/24 | bc | xargs printf %04x | head -c 4 | tr -dc "0-9a-f"
hex (0000-ffff) starting 2022-01-01, overflow after year 2200:
date +%s/3600/24-18992 | bc | xargs printf %04x | head -c 4 | tr -dc "0-9a-f"
day of the year no sequence, human readable in decimal (YYDDD, YY: 00-99, DDD: day of year 1-366).
hex (0000-ffff), starting 2022-01-01. Overflow after year 2087:
date +%y%j-22000 | bc | xargs printf %04x | head -c 4 | tr -dc "0-9a-f"
the same, but decimal (00000-99366), leading zero, overflow after 2099:
date +%y%j-22000 | bc | xargs printf %05d | head -c 5 | tr -dc "0-9"