Skip to content

Instantly share code, notes, and snippets.

m=(3{0,2,4,7}\;4{0,2,4,7}) w=(0 1111 47f3 0fa 0ea cbb 1 1514 47f3 3ea caa0f bb0c 1 0101 0457 03fec 3faa2 3b88b3 2 0{011,57f7,0fa,caa} f88bb 4 1111 57f3 0eb 0ea cbb 5 1514 47f3 0eb 0ae0f bb0c 5 0{101,457,0efc,0ae3} 3b88b3 6 0{011,57f7,0fa,0ae} f88bb);for((i=0;i<75;x=++i/8*8+w[i%8*6])){ sleep .1;tput cup 0;for r in {1..5};{ printf %$x.s;eval printf %b▀ '\\e[${m[0x${w[i%8*6+r]:'{0..6}:1}]}m;echo;};}
@geirha
geirha / gist.bash
Last active January 24, 2018 22:28
Function to print the contents of a gist in a terminal
# Usage: gist url-or-hash or gist [-p] [file...]
#
# Given a url or hash, print a dump of the gist. Otherwise, create a new
# gist of the given file arguments, or stdin if no files are given.
# -p forces the arguments to be treated as files to be posted.
#
# Examples:
#
# - dump a gist in the terminal:
# gist https://gist.github.com/geirha/15103ebee61f2b129f2897be2397da2a
@geirha
geirha / gist:887e74e74877c7613920
Last active October 23, 2020 01:37 — forked from cdown/gist:1163649
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
local LC_ALL=C c i n
for (( i = 0, n = ${#1}; i < n; i++ )); do
c=${1:i:1}
case $c in
[[:alnum:].~_-]) printf %s "$c" ;;
*) printf %%%02X "'$c" ;;
esac
done