Skip to content

Instantly share code, notes, and snippets.

@orirawlings
Last active April 23, 2020 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orirawlings/5d8971d17250bbfcc63fd3c0d1f49df6 to your computer and use it in GitHub Desktop.
Save orirawlings/5d8971d17250bbfcc63fd3c0d1f49df6 to your computer and use it in GitHub Desktop.
An awk program to tile ascii art up to a given column width, endlessly.
{
l[NR] = $0
if (length($0) > max) { max = length($0) }
}
END {
while (1) {
for (i=1;i<=NR;i++) {
for (j=1;j<=width/max;j++) {
printf("%-"max"s", l[i])
}
print substr(l[i], 1, width % max)
}
}
}
$ cat unicorn | awk -v width=150 -f paper.awk | head -n 50
////))))))\ ////))))))\
/////))))))))))======= /////))))))))))=======
/////// )) /////// ))
/////// \_ *) ) /////// \_ *) )
________________////// / \ / ________________////// / \ / ____________
////)) \> | | | ////)) \> | | | ////))
///////// \ \ |_o ///////// \ \ |_o /////////
//////////// ) _. | //////////// ) _. | ////////////
/////// \ \ \ | /////// \ \ \ | /////// \ \
/// \ \ \ \/\______. /// \ \ \ \/\______. /// \ \
/\ )________ \_ \____.__ \ /\ )________ \_ \____.__ \ /\ )_____
_/ \ / '--------- \________ \ \ \ _/ \ / '--------- \________ \ \ \ _/ \ /
/ _/ / / / / \ \ / _/ / / / / \ \ / _/ / /
/ / \ < / / > ) / / \ < / / > ) / / \ <
( < \ \ _// \/ ( < \ \ _// \/ ( < \ \
\ \ \ \ |_/ \ \ \ \ |_/ \ \ \ \
\\_ \\_ \\_ \\_ \\_ \\_
|_\ |_\ |_\ |_\ |_\ |_\
////))))))\ ////))))))\
/////))))))))))======= /////))))))))))=======
/////// )) /////// ))
/////// \_ *) ) /////// \_ *) )
________________////// / \ / ________________////// / \ / ____________
////)) \> | | | ////)) \> | | | ////))
///////// \ \ |_o ///////// \ \ |_o /////////
//////////// ) _. | //////////// ) _. | ////////////
/////// \ \ \ | /////// \ \ \ | /////// \ \
/// \ \ \ \/\______. /// \ \ \ \/\______. /// \ \
/\ )________ \_ \____.__ \ /\ )________ \_ \____.__ \ /\ )_____
_/ \ / '--------- \________ \ \ \ _/ \ / '--------- \________ \ \ \ _/ \ /
/ _/ / / / / \ \ / _/ / / / / \ \ / _/ / /
/ / \ < / / > ) / / \ < / / > ) / / \ <
( < \ \ _// \/ ( < \ \ _// \/ ( < \ \
\ \ \ \ |_/ \ \ \ \ |_/ \ \ \ \
\\_ \\_ \\_ \\_ \\_ \\_
|_\ |_\ |_\ |_\ |_\ |_\
////))))))\ ////))))))\
/////))))))))))======= /////))))))))))=======
/////// )) /////// ))
/////// \_ *) ) /////// \_ *) )
________________////// / \ / ________________////// / \ / ____________
////)) \> | | | ////)) \> | | | ////))
///////// \ \ |_o ///////// \ \ |_o /////////
//////////// ) _. | //////////// ) _. | ////////////
/////// \ \ \ | /////// \ \ \ | /////// \ \
/// \ \ \ \/\______. /// \ \ \ \/\______. /// \ \
/\ )________ \_ \____.__ \ /\ )________ \_ \____.__ \ /\ )_____
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment