2 ms·
Obfuscated oneliners are where it gets really, really fun though. I love making these, because they can be edited and iterated directly from the terminal promp
by i336_ 11y ago
Obfuscated oneliners are where it gets really, really fun though.
I love making these, because they can be edited and iterated directly from the terminal prompt, and you can just paste them from the clipboard to see if you like them and want to keep them.
For example, the URL this oneliner spits out is actually real. The technique works almost nowhere now thanks to HTTPS (it's one of my poorest oneliners), but it's hilarious to show people who don't know about networking.
$ echo http://google.com/trends | (E=echo\ ;S=sed\ ;read a;x=($($E "$a"|$S's,^\([^:]\+://\)*\([^/]\+\)/\(.*\)$,\1 \2 \3,'));$E"${x[0]}$(i=32;o=0;for x in $(ping -c1 "${x[1]}"|$S's/[^(]\+(//;s/).*//;;s/\./ /g;q');do((o+=(x*(2**(i-=8)))));done;$E$o)/$(for((i=0;i<${#x[2]};i++));do printf "%%%x" "'${x[2]:i:1}";done)")
http://3627736174/%74%72%65%6e%64%73
If you use VT100's alternate character sets you might like this character map which shows all the character mappings at once (man console_codes for the idea behind B0UK)
(((r=255/((${COLUMNS:-$(tput cols)}-16)/18)));C="\e[38;5";Z="\e[0m";A="\e(";for((i=-1;i<r;i++));do X=;for((j=0;c=20,(v=j*r+i),v<256;j++));do((v>r-(\!(i+1)+1)))&&X="$X$C;177m |";((\!(i+1)))&&X="$X$Z 0UKB ddd/ooo/hh"||{(((v>32&&v<127)||v>160))&&printf -v c %x $v;printf -v X "$X $C;160m${A}0\x$c${A}U\x$c${A}K\x$c${A}B\x$c $C;120m%3d$Z/$C;214m%03o$Z/$C;33m%02x" $v $v $v;X=${X//\%/%%};} done;printf "$X\n";done)
Then there's this one I won't tell you about, which #bash suggested I put in the channel bot (!! wow) when I showed them... run it in a 256-color terminal. :P
E=echo\ ;P=printf\ ;M=$'\e[0m';a(){ $P"\e[38;5;2${z}5;48;5;${1}m %4d $M" $1;};Z=$E$M;for i in 16 93 160;do ((r=(n=\!n)*2-1));for((x=0;x<6;x++,i+=r)) do for((j=0;L=(i+(R=(j/6?17-j:j))*6),z=(R%6>1?3:5),j<12;j++))do a $L;done;$E;done;done;z=5;for i in {0..23};do a $[i+232];((i==11))&&$Z;done;for i in {0..15};do ((i==8||\!i))&&$P'\n%*s' 12;a $i;done;$E