setup src tree, clean out bin directory

The src tree now contains source for tools that will be published
as part of the IOCCC winner web site.  However, the compiled and/or
installed tools that install under bin, will NOT be published.
The bin directory is now excluded under .gitignore so that
those who use this repo will have to do:

```sh
cd src; make clobber all install
```

The src/Makefile in turn drives rules in sub-directory
Makefiles.  Currently there are only two sub-directories:

winner_name - a completely re-written extract_winner_handles.sh
sgit - run sed on all files under git control

The check_awards.sh tool was moved under tmp
as this tool depends on CSV file, will not be needed soon,
and will go away when the tmp directory is cleaned
out towards the end of finishing issue #4.
This commit is contained in:
Landon Curt Noll committed 2023-06-15 18:40:38 -07:00
1 parent 7df6b18ec4
commit 828ddef5eb
11 files changed
+451 -6

No files matched your search

-354
View File
@@ -1,354 +0,0 @@
#!/usr/bin/env bash
#
# This script was mostly auto-generated with the contents of the
# tmp/year-auth-prize.csv file but modified in vim to make it simpler to
# generate as it was not worth getting everything correct. It was initially
# generated like:
#
# echo '#!/bin/bash' > bin/check_awards.sh ; ( while read -r g ; do
# echo grep "$g";
# done < <(sed -e 's,_,/,g' -e 's/"/\\"/g' tmp/year-auth-prize.csv |
# awk -F, '{print grep "\x22" $2 "\x22" " " $1 "/" "README.md"}' ); )
# >> bin/check_awards.sh
#
# To determine how many entries have a mismatch in award compared to the CSV
# file do:
#
# sh bin/check_awards.sh | grep :0
#
# It must be run in the top level directory. It shouldn't be necessary in future
# IOCCC contests as the problem should not occur again.
#
# This was a hack and not the prettiest hack made by Cody Boone Ferguson
# (@xexyl) to quickly check all entries from 1984 through 2020. It probably could
# have been done simpler but this is what I came up with after being awake for
# 5+ hours at 0700 in the morning. I didn't particularly fancy going through 321
# README.md files and checking 321 lines of the CSV file!
#
# This file as well as some README.md and the CSV file all had to be modified a
# number of times as mismatches were found which is another reason I did not
# want to spend effort trying to get the exact pipeline as it was quicker to
# modify this script.
#
grep -Hc "^# Dishonorable mention" 1984/anonymous/README.md
grep -Hc "^# Second place" 1984/decot/README.md
grep -Hc "^# Third place" 1984/laman/README.md
grep -Hc "^# Grand Prize" 1984/mullender/README.md
grep -Hc "^# Best one liner" 1985/applin/README.md
grep -Hc "^# Most obscure program" 1985/august/README.md
grep -Hc "^# Strangest appearing program" 1985/lycklama/README.md
grep -Hc "^# Grand prize for most well-rounded in confusion" 1985/shapiro/README.md
grep -Hc "^# Worst abuse of the C preprocessor" 1985/sicherman/README.md
grep -Hc "^# Most adaptable program" 1986/applin/README.md
grep -Hc "^# Best complex task done in a complex way" 1986/august/README.md
grep -Hc "^# Most useful obfuscation" 1986/bright/README.md
grep -Hc "^# Worst abuse of the C preprocessor" 1986/hague/README.md
grep -Hc "^# Best simple task performed in a complex way" 1986/holloway/README.md
grep -Hc "^# Best layout" 1986/marshall/README.md
grep -Hc "^# Most illegible code" 1986/pawka/README.md
grep -Hc "^# Best one liner" 1986/stein/README.md
grep -Hc "^# Grand prize in most well-rounded in confusion" 1986/wall/README.md
grep -Hc "^# Best Abuse of the Rules" 1987/biggar/README.md
grep -Hc "^# Best Obfuscator of Programs" 1987/heckbert/README.md
grep -Hc "^# Worst Style" 1987/hines/README.md
grep -Hc "^# Best One Liner" 1987/korn/README.md
grep -Hc "^# Grand Prize" 1987/lievaart/README.md
grep -Hc "^# Most Useful Obfuscation" 1987/wall/README.md
grep -Hc "^# Best Layout" 1987/westley/README.md
grep -Hc "^# Best of show" 1988/applin/README.md
grep -Hc "^# Best abuse of system calls" 1988/dale/README.md
grep -Hc "^# Best visuals" 1988/isaak/README.md
grep -Hc "^# Best small program" 1988/litmaath/README.md
grep -Hc "^# Least likely to compile successfully" 1988/phillipps/README.md
grep -Hc "^# Most useful Obfuscated C program" 1988/reddy/README.md
grep -Hc "^# Best abuse of C constructs" 1988/robison/README.md
grep -Hc "^# Best abuse of the rules" 1988/spinellis/README.md
grep -Hc "^# Best layout" 1988/westley/README.md
grep -Hc "^# Best self-modifying program" 1989/fubar/README.md
grep -Hc "^# Strangest abuse of the rules" 1989/jar.1/README.md
grep -Hc "^# Best of show" 1989/jar.2/README.md
grep -Hc "^# Most humorous output" 1989/ovdluhe/README.md
grep -Hc "^# Most complex algorithm" 1989/paul/README.md
grep -Hc "^# Best minimal use of C" 1989/robison/README.md
grep -Hc "^# Best layout" 1989/roemer/README.md
grep -Hc "^# Best game" 1989/tromp/README.md
grep -Hc "^# Best one liner" 1989/vanb/README.md
grep -Hc "^# Most algorithms in one program" 1989/westley/README.md
grep -Hc "^# Best Small Program" 1990/baruch/README.md
grep -Hc "^# Best Game" 1990/cmills/README.md
grep -Hc "^# Best Language Tool" 1990/dds/README.md
grep -Hc "^# Best Abuse of the C Preprocessor" 1990/dg/README.md
grep -Hc "^# Best Entropy-reducer" 1990/jaw/README.md
grep -Hc "^# Most Unusual Data Structure" 1990/pjr/README.md
grep -Hc "^# ANSI Committee's Worst Abuse of C" 1990/scjones/README.md
grep -Hc "^# Strangest Abuse of the Rules" 1990/stig/README.md
grep -Hc "^# Best Utility" 1990/tbr/README.md
grep -Hc "^# Best of Show" 1990/theorem/README.md
grep -Hc "^# Best Layout" 1990/westley/README.md
grep -Hc "^# Best Utility" 1991/ant/README.md
grep -Hc "^# Best Of Show" 1991/brnstnd/README.md
grep -Hc "^# Best Output" 1991/buzzard/README.md
grep -Hc "^# Most Useful Label" 1991/cdupont/README.md
grep -Hc "^# Best X11 Graphics" 1991/davidguy/README.md
grep -Hc "^# Most Well Rounded" 1991/dds/README.md
grep -Hc "^# Best One Liner" 1991/fine/README.md
grep -Hc "^# Best Game" 1991/rince/README.md
grep -Hc "^# Grand Prize" 1991/westley/README.md
grep -Hc "^# Most Educational" 1992/adrian/README.md
grep -Hc "^# Most Useful Program" 1992/albert/README.md
grep -Hc "^# Best Utility" 1992/ant/README.md
grep -Hc "^# Most Obfuscated Algorithm" 1992/buzzard.1/README.md
grep -Hc "^# Best Language Tool" 1992/buzzard.2/README.md
grep -Hc "^# Most Humorous Output" 1992/gson/README.md
grep -Hc "^# Best Output" 1992/imc/README.md
grep -Hc "^# Best X Program" 1992/kivinen/README.md
grep -Hc "^# Worst Abuse of the C Preprocessor" 1992/lush/README.md
grep -Hc "^# Best Game" 1992/marangon/README.md
grep -Hc "^# Worst Abuse of the Rules" 1992/nathan/README.md
grep -Hc "^# Best of Show" 1992/vern/README.md
grep -Hc "^# Best Small Program" 1992/westley/README.md
grep -Hc "^# Best Utility" 1993/ant/README.md
grep -Hc "^# \"Bill Gates\" Award" 1993/cmills/README.md
grep -Hc "^# Best Abuse of the C Preprocessor" 1993/dgibson/README.md
grep -Hc "^# Best Obfuscated Algorithm" 1993/ejb/README.md
grep -Hc "^# Most Obfuscated X Program" 1993/jonth/README.md
grep -Hc "^# Best Game" 1993/leo/README.md
grep -Hc "^# Most Versatile Source" 1993/lmfjyh/README.md
grep -Hc "^# Best One Liner" 1993/plummer/README.md
grep -Hc "^# Most Well Rounded" 1993/rince/README.md
grep -Hc "^# Obfuscated Intelligence Award" 1993/schnitzi/README.md
grep -Hc "^# Most Irregular Expression" 1993/vanb/README.md
grep -Hc "^# Best Game" 1994/dodsond1/README.md
grep -Hc "^# Most Obfuscated Packaging" 1994/dodsond2/README.md
grep -Hc "^# Best Utility" 1994/horton/README.md
grep -Hc "^# Most Obfuscated Algorithm" 1994/imc/README.md
grep -Hc "^# Best One-liner" 1994/ldb/README.md
grep -Hc "^# Best Layout" 1994/schnitzi/README.md
grep -Hc "^# Most Well Rounded Obfuscation" 1994/shapiro/README.md
grep -Hc "^# Worst Abuse of the Rules" 1994/smr/README.md
grep -Hc "^# Best X11 Program" 1994/tvr/README.md
grep -Hc "^# Best Short Program" 1994/weisberg/README.md
grep -Hc "^# Worst Abuse of the C Preprocessor" 1994/westley/README.md
grep -Hc "^# Best Output" 1995/cdua/README.md
grep -Hc "^# Most Humorous" 1995/dodsond1/README.md
grep -Hc "^# Best Game" 1995/dodsond2/README.md
grep -Hc "^# Interesting Algorithm" 1995/esde/README.md
grep -Hc "^# Best Utility" 1995/garry/README.md
grep -Hc "^# Best Layout" 1995/heathbar/README.md
grep -Hc "^# Best Use of Obfuscation" 1995/leo/README.md
grep -Hc "^# Best Short Program" 1995/makarios/README.md
grep -Hc "^# Most Obfuscated Syntax" 1995/savastio/README.md
grep -Hc "^# Best One Liner" 1995/schnitzi/README.md
grep -Hc "^# Abusing The Rules" 1995/spinellis/README.md
grep -Hc "^# Worst Abuse of the C Preprocessor and Most Likely To Amaze" 1995/vanschnitz/README.md
grep -Hc "^# Best of Show" 1996/august/README.md
grep -Hc "^# Best Numerical Obfuscation" 1996/dalbec/README.md
grep -Hc "^# Best Output" 1996/eldby/README.md
grep -Hc "^# Best Layout" 1996/gandalf/README.md
grep -Hc "^# Best Obfuscated Character Set Utility" 1996/huffman/README.md
grep -Hc "^# Best X11 Entry" 1996/jonth/README.md
grep -Hc "^# Best RFC Obfuscation" 1996/rcm/README.md
grep -Hc "^# Worst Abuse of the C Preprocessor" 1996/schweikh1/README.md
grep -Hc "^# Best Algorithm" 1996/schweikh2/README.md
grep -Hc "^# Best Utility" 1996/schweikh3/README.md
grep -Hc "^# Best One Liner" 1996/westley/README.md
grep -Hc "^# Best of Show" 1998/banks/README.md
grep -Hc "^# Best Encapsulation" 1998/bas1/README.md
grep -Hc "^# Best Small Program" 1998/bas2/README.md
grep -Hc "^# Best Object Orientation" 1998/chaos/README.md
grep -Hc "^# Best Data Hiding" 1998/df/README.md
grep -Hc "^# Best Utility" 1998/dlowe/README.md
grep -Hc "^# Most Fun" 1998/dloweneil/README.md
grep -Hc "^# Obsolescent Feature" 1998/dorssel/README.md
grep -Hc "^# Most Obfuscated Translator" 1998/fanf/README.md
grep -Hc "^# Best Flow Control" 1998/schnitzi/README.md
grep -Hc "^# CPP Abuse" 1998/schweikh1/README.md
grep -Hc "^# Most Erratic Behavior" 1998/schweikh2/README.md
grep -Hc "^# Most Space Efficient" 1998/schweikh3/README.md
grep -Hc "^# Best Self-Documenting" 1998/tomtorfs/README.md
grep -Hc "^# Best Use of Flags" 2000/anderson/README.md
grep -Hc "^# Most Specific Output" 2000/bellard/README.md
grep -Hc "^# Best Utility" 2000/bmeyer/README.md
grep -Hc "^# Best Abuse of User" 2000/briddlebane/README.md
grep -Hc "^# Best Layout" 2000/dhyang/README.md
grep -Hc "^# Worst Abuse of the Rules" 2000/dlowe/README.md
grep -Hc "^# Best of Show" 2000/jarijyrki/README.md
grep -Hc "^# Best Small Program" 2000/natori/README.md
grep -Hc "^# Best Abuse of CPP" 2000/primenum/README.md
grep -Hc "^# Astronomically Obfuscated" 2000/rince/README.md
grep -Hc "^# Best game" 2000/robison/README.md
grep -Hc "^# Most Timely Output" 2000/schneiderwent/README.md
grep -Hc "^# Most Portable Output" 2000/thadgavin/README.md
grep -Hc "^# Most Complete Program" 2000/tomx/README.md
grep -Hc "^# Dishonorable mention" 2001/anonymous/README.md
grep -Hc "^# Best abuse of the rules" 2001/bellard/README.md
grep -Hc "^# Best short program" 2001/cheong/README.md
grep -Hc "^# Most obfuscated sound" 2001/coupard/README.md
grep -Hc "^# Worst Driver" 2001/ctk/README.md
grep -Hc "^# Best AI" 2001/dgbeards/README.md
grep -Hc "^# Best abuse of the C preprocessor" 2001/herrmann1/README.md
grep -Hc "^# Most eye-crossing" 2001/herrmann2/README.md
grep -Hc "^# Best Of Show" 2001/jason/README.md
grep -Hc "^# Best Curses Game" 2001/kev/README.md
grep -Hc "^# Best of Show" 2001/ollinger/README.md
grep -Hc "^# Best abuse of the user" 2001/rosten/README.md
grep -Hc "^# Best one-liner" 2001/schweikh/README.md
grep -Hc "^# Best position-independent code" 2001/westley/README.md
grep -Hc "^# Best Graphic Game" 2001/williams/README.md
grep -Hc "^# Best use of \"Precious\" Lines" 2004/anonymous/README.md
grep -Hc "^# Best use of Vision" 2004/arachnid/README.md
grep -Hc "^# Best Calculated Risk" 2004/burley/README.md
grep -Hc "^# Best Use of Light and Spheres" 2004/gavare/README.md
grep -Hc "^# Best of Show" 2004/gavin/README.md
grep -Hc "^# Best Abuse of the Guidelines" 2004/hibachi/README.md
grep -Hc "^# Most Functional Output" 2004/hoyle/README.md
grep -Hc "^# Best Abuse of the Periodic Table" 2004/jdalbec/README.md
grep -Hc "^# Best One-Liner" 2004/kopczynski/README.md
grep -Hc "^# Best Font Engine" 2004/newbern/README.md
grep -Hc "^# Best Utility" 2004/omoikane/README.md
grep -Hc "^# Best Non-Use of Curses" 2004/schnitzi/README.md
grep -Hc "^# Best Abuse of Indentation" 2004/sds/README.md
grep -Hc "^# Best X11 Game" 2004/vik1/README.md
grep -Hc "^# Best Abuse of CPP" 2004/vik2/README.md
grep -Hc "^# Most ingenious puzzle solution" 2005/aidan/README.md
grep -Hc "^# Best 3D puzzle" 2005/anon/README.md
grep -Hc "^# Most superfluous output" 2005/boutines/README.md
grep -Hc "^# Most ambiguous language" 2005/chia/README.md
grep -Hc "^# Best 2D puzzle" 2005/giljade/README.md
grep -Hc "^# Most sonorous output" 2005/jetro/README.md
grep -Hc "^# Abuse of the rules" 2005/klausler/README.md
grep -Hc "^# Best use of parenthesis" 2005/mikeash/README.md
grep -Hc "^# Best use of the WWW" 2005/mynx/README.md
grep -Hc "^# Best of Show" 2005/persano/README.md
grep -Hc "^# Best Emulator" 2005/sykes/README.md
grep -Hc "^# Most discourteous interpreter" 2005/timwi/README.md
grep -Hc "^# Best Game" 2005/toledo/README.md
grep -Hc "^# Most circuitous walk" 2005/vik/README.md
grep -Hc "^# Most beauteous visuals" 2005/vince/README.md
grep -Hc "^# EDAMAME Award" 2006/birken/README.md
grep -Hc "^# Most Useful" 2006/borsanyi/README.md
grep -Hc "^# Most Obfuscated Audio" 2006/grothe/README.md
grep -Hc "^# Most Irrational" 2006/hamre/README.md
grep -Hc "^# Best Game" 2006/meyer/README.md
grep -Hc "^# Best Compiled Graphics" 2006/monge/README.md
grep -Hc "^# Best Abuse of Computation" 2006/night/README.md
grep -Hc "^# Homer's Favorite" 2006/sloane/README.md
grep -Hc "^# Best Computed Graphics" 2006/stewart/README.md
grep -Hc "^# Best Assembler" 2006/sykes1/README.md
grep -Hc "^# Best One Liner" 2006/sykes2/README.md
grep -Hc "^# Best Small Program" 2006/toledo1/README.md
grep -Hc "^# Best of Show" 2006/toledo2/README.md
grep -Hc "^# Most Portable Chess Set" 2006/toledo3/README.md
grep -Hc "^# Best of Show - Most Shrinkable" 2011/akari/README.md
grep -Hc "^# Most devolving" 2011/blakely/README.md
grep -Hc "^# Best data utility" 2011/borsanyi/README.md
grep -Hc "^# Most self deprecating" 2011/dlowe/README.md
grep -Hc "^# Best ball" 2011/eastman/README.md
grep -Hc "^# Most useful" 2011/fredriksson/README.md
grep -Hc "^# Most artistic" 2011/goren/README.md
grep -Hc "^# Best solved puzzle" 2011/hamaji/README.md
grep -Hc "^# Best self documenting program" 2011/hou/README.md
grep -Hc "^# Best one liner" 2011/konno/README.md
grep -Hc "^# Most surprisingly portable" 2011/richards/README.md
grep -Hc "^# Best non-chess game" 2011/toledo/README.md
grep -Hc "^# Most sound" 2011/vik/README.md
grep -Hc "^# Most shiny" 2011/zucker/README.md
grep -Hc "^# Most GIFted expressions" 2012/blakely/README.md
grep -Hc "^# Most notable and best tool" 2012/deckmyn/README.md
grep -Hc "^# Best way to lose a life" 2012/dlowe/README.md
grep -Hc "^# Most complex ASCII fluid - Honorable mention" 2012/endoh1/README.md
grep -Hc "^# PiE in the sky award" 2012/endoh2/README.md
grep -Hc "^# Most conspiratorial" 2012/grothe/README.md
grep -Hc "^# Most elementary use of C - Silver award" 2012/hamano/README.md
grep -Hc "^# Most useful obfuscation" 2012/hou/README.md
grep -Hc "^# Best short program" 2012/kang/README.md
grep -Hc "^# Best one liner" 2012/konno/README.md
grep -Hc "^# Most surreptitious" 2012/omoikane/README.md
grep -Hc "^# Most functional" 2012/tromp/README.md
grep -Hc "^# Best use of cocoa - Bronze award" 2012/vik/README.md
grep -Hc "^# Balanced use of obfuscation - Gold award" 2012/zeitak/README.md
grep -Hc "^# Best painting tool" 2013/birken/README.md
grep -Hc "^# Most partisan 1-liner" 2013/cable1/README.md
grep -Hc "^# Best of show" 2013/cable2/README.md
grep -Hc "^# Largest small system emulator" 2013/cable3/README.md
grep -Hc "^# Best sparkling utility" 2013/dlowe/README.md
grep -Hc "^# Most lazy SKIer" 2013/endoh1/README.md
grep -Hc "^# Most recyclable" 2013/endoh2/README.md
grep -Hc "^# Most tweetable 1-liner" 2013/endoh3/README.md
grep -Hc "^# Most solid" 2013/endoh4/README.md
grep -Hc "^# Best use of 1 Infinite Loop" 2013/hou/README.md
grep -Hc "^# Most timely rendered" 2013/mills/README.md
grep -Hc "^# Most catty" 2013/misaka/README.md
grep -Hc "^# Smallest large system simulator" 2013/morgan1/README.md
grep -Hc "^# Most playfully versatile" 2013/morgan2/README.md
grep -Hc "^# Most poetic use of strings" 2013/robison/README.md
grep -Hc "^# Best use of port 1701" 2014/birken/README.md
grep -Hc "^# Most underscored argument" 2014/deak/README.md
grep -Hc "^# Most square (YODA award)" 2014/endoh1/README.md
grep -Hc "^# Best use of bioinformatics" 2014/endoh2/README.md
grep -Hc "^# Homage to a classic game" 2014/maffiodo1/README.md
grep -Hc "^# Most tweetable entry" 2014/maffiodo2/README.md
grep -Hc "^# Most likely to succeed" 2014/morgan/README.md
grep -Hc "^# Best choice of optimization" 2014/sinon/README.md
grep -Hc "^# Most dynamic" 2014/skeggs/README.md
grep -Hc "^# Best handling of beeps" 2014/vik/README.md
grep -Hc "^# Most functional" 2014/wiedijk/README.md
grep -Hc "^# Most Useful" 2015/burton/README.md
grep -Hc "^# Most Crafty" 2015/dogon/README.md
grep -Hc "^# Best Handwriting" 2015/duble/README.md
grep -Hc "^# Most Diffused Reaction" 2015/endoh1/README.md
grep -Hc "^# Most Overlooked Obfuscation" 2015/endoh2/README.md
grep -Hc "^# Back to the Future Award" 2015/endoh3/README.md
grep -Hc "^# Best One-liner" 2015/endoh4/README.md
grep -Hc "^# Most Well-rounded Hash" 2015/hou/README.md
grep -Hc "^# Most Different" 2015/howe/README.md
grep -Hc "^# \"For the Birds!\" Award" 2015/mills1/README.md
grep -Hc "^# Most Compact" 2015/mills2/README.md
grep -Hc "^# Most Complete Use of CPP" 2015/muth/README.md
grep -Hc "^# Best Documented" 2015/schweikhardt/README.md
grep -Hc "^# Most Pointed Reaction" 2015/yang/README.md
grep -Hc "^# Most cacophonic" 2018/algmyr/README.md
grep -Hc "^# Most able to divine code gaps" 2018/anderson/README.md
grep -Hc "^# Most inflationary" 2018/bellard/README.md
grep -Hc "^# Best one-liner" 2018/burton1/README.md
grep -Hc "^# Best abuse of the rules" 2018/burton2/README.md
grep -Hc "^# Most likely to be awarded" 2018/ciura/README.md
grep -Hc "^# Best tool to reveal holes" 2018/endoh1/README.md
grep -Hc "^# Best use of python" 2018/endoh2/README.md
grep -Hc "^# Best use of weasel words" 2018/ferguson/README.md
grep -Hc "^# Most unstable" 2018/giles/README.md
grep -Hc "^# Most likely to top the charts" 2018/hou/README.md
grep -Hc "^# Best of show" 2018/mills/README.md
grep -Hc "^# Most stellar" 2018/poikola/README.md
grep -Hc "^# Most connected" 2018/vokes/README.md
grep -Hc "^# Most shifty" 2018/yang/README.md
grep -Hc "^# Most functional interpreter" 2019/adamovsky/README.md
grep -Hc "^# Best one-liner" 2019/burton/README.md
grep -Hc "^# Most alphabetic" 2019/ciura/README.md
grep -Hc "^# Best small program" 2019/diels-grabsch1/README.md
grep -Hc "^# Most self-aware" 2019/diels-grabsch2/README.md
grep -Hc "^# Best use of space and time" 2019/dogon/README.md
grep -Hc "^# Best collaborative graphics" 2019/duble/README.md
grep -Hc "^# Most in need of debugging" 2019/endoh/README.md
grep -Hc "^# Most in need of wide space" 2019/giles/README.md
grep -Hc "^# Most in need of whitespace" 2019/karns/README.md
grep -Hc "^# Most functional compiler" 2019/lynn/README.md
grep -Hc "^# Most in need to be tweeted" 2019/mills/README.md
grep -Hc "^# Most calendrical" 2019/poikola/README.md
grep -Hc "^# Most in need of transparency" 2019/yang/README.md
grep -Hc "^# Best one-liner" 2020/burton/README.md
grep -Hc "^# Best of show - abuse of libc" 2020/carlini/README.md
grep -Hc "^# Most explosive" 2020/endoh1/README.md
grep -Hc "^# Best perspective" 2020/endoh2/README.md
grep -Hc "^# Most head-turning" 2020/endoh3/README.md
grep -Hc "^# Don't tread on me award" 2020/ferguson1/README.md
grep -Hc "^# Most enigmatic" 2020/ferguson2/README.md
grep -Hc "^# Most phony" 2020/giles/README.md
grep -Hc "^# Best utility" 2020/kurdyukov1/README.md
grep -Hc "^# Least detailed" 2020/kurdyukov2/README.md
grep -Hc "^# Bset slaml prragom" 2020/kurdyukov3/README.md
grep -Hc "^# Best abuse of lámatyávë" 2020/kurdyukov4/README.md
grep -Hc "^# Most percussive" 2020/otterness/README.md
grep -Hc "^# Most misleading indentation" 2020/tsoj/README.md
grep -Hc "^# Best abuse of CPP" 2020/yang/README.md
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/env bash
grep -o '<A NAME="[^"][A-Za-z_][A-Za-z_]*">' winners.html |sed -e 's,<A NAME=,,g' -e 's/"//g' -e 's/>//g'
-212
View File
@@ -1,212 +0,0 @@
#!/usr/bin/env bash
#
# sgit - run sed (by default with -i) on all files (or one or more globs) under
# git control
#
# This script allows one to run sed under git control without having to come up
# with a list of files first and then passing those to the command.
#
# It allows for multiple sed commands and multiple globs. By default it uses -i
# to edit the file in place (WITHOUT BACKUP EXTENSION; use -i option if you want
# a backup!) but in place editing can be overridden with the -I option. See -h
# option for all the options.
#
# DISCLAIMER AND WARNING: this is something of a hack and might be error prone.
# It works for what is needed but possibly could be improved. Even so I like it
# how it is and I don't think it would do much good to add many more additional
# features.
#
# - Cody Boone Ferguson (@xexyl)
#
export SGIT_VERSION="0.0.8-1 19-04-2023" # format: major.minor.patch-release DD-MM-YYYY
USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-x] [-I] [-i extension] [-o sed_options] [-s sed] [-e command] <glob...>
-h print help and exit
-V print version and exit
-v level set verbosity level
-x turn on tracing (set -x)
-I disable in place editing
-i extension set backup extension (default none)
WARNING: sed -i overwrites existing files
WARNING: this will create another file for each file changed
-o sed options (NOTE: don't pass '-'!)
WARNING: use of '-o n' without '-I', can depending on command, empty files
-s sed set path to sed
-e command append sed command to to list to execute on globs
sgit version: $SGIT_VERSION"
SED="$(type -P sed)"
export SED
export SED_OPTIONS=""
export I_FLAG=
export VERBOSITY=0
export EXTENSION=""
# we need an array for sed commands
declare -a SED_COMMANDS
# we need to remove ' ' from the IFS!
IFS=$'\t\n'
# parse args
#
while getopts :hVv:xIi:o:s:e: flag; do
case "$flag" in
h) echo "$USAGE" 1>&2
exit 2
;;
V) echo "$SGIT_VERSION" 1>&2
exit 2
;;
v) VERBOSITY="$OPTARG";
;;
x) set -x
;;
I) I_FLAG="-I"
;;
i) EXTENSION="$OPTARG"
;;
o) SED_OPTIONS="-$OPTARG"
;;
s) SED="$OPTARG"
;;
e) SED_COMMANDS+=(-e "$OPTARG")
;;
\?) echo "$0: ERROR: invalid option: -$OPTARG" 1>&2
exit 3
;;
:) echo "$0: ERROR: option -$OPTARG requires an argument" 1>&2
echo 1>&2
echo "$USAGE" 1>&2
exit 3
;;
*)
;;
esac
done
shift $(( OPTIND - 1 ));
# firewall
# check that SED_COMMANDS is not empty!
if [[ -z "${SED_COMMANDS[*]}" ]]; then
echo "$(basename "$0"): ERROR: you must specify at least one sed command" 1>&2
echo 1>&2
echo "$USAGE" 1>&2
exit 2
fi
# check that sed is executable
if [[ -z "$SED" ]]; then
echo "$(basename "$0"): ERROR: sed cannot be empty" 1>&2
echo 1>&2
echo "$USAGE" 1>&2
exit 2
elif [[ ! -f "$SED" ]]; then
echo "$(basename "$0"): ERROR: sed is not a regular file: $SED" 1>&2
echo 1>&2
echo "$USAGE" 1>&2
exit 2
elif [[ ! -x "$SED" ]]; then
echo "$(basename "$0"): ERROR: sed is not an executable file: $SED" 1>&2
echo 1>&2
echo "$USAGE" 1>&2
exit 2
fi
# also check number of remaining args
if [[ "$#" -eq 0 ]]; then
echo "$(basename "$0"): ERROR: you must specify at least one glob" 1>&2
echo 1>&2
echo "$USAGE" 1>&2
exit 2
fi
# then check that this is a git repo!
git status 2>/dev/null 1>&2
status="$?"
if [[ "$status" -ne 0 ]]; then
echo "$(basename "$0"): ERROR: ${PWD} not a git repository" 1>&2
exit 1
fi
if [[ $VERBOSITY -gt 1 ]]; then
echo "debug[2]: sed commands: ${SED_COMMANDS[*]}" 1>&2
fi
# This might not the best performance because it does this on all files of the
# glob rather than only those files matched by the glob with matching text but
# it's better than it used to be (it used to run git ls-files on the repo for
# each sed command so the more you had the slow it would become as it had to get
# the list of files each time!).
#
# A better approach would be to somehow use git grep to find files that match
# but this would complicate the command line (at least in anyway I can think of
# how to do it) so we do it on all files in the repo.
#
# But these would possibly require additional args to the command and
# unnecessarily complicate matters. Anyway it's something of a hack so it
# doesn't have to be perfect (not that there even is such a thing as perfect).
#
if [[ "$VERBOSITY" -gt 1 ]]; then
echo "debug[2]: looping through all globs" 1>&2
fi
if [[ -n "$EXTENSION" ]]; then
if [[ "$VERBOSITY" -ge 1 ]]; then
echo "debug[1]: using backup extension: $EXTENSION" 1>&2
fi
fi
GLOBS="$#"
i=0
while [[ "$i" -lt "$GLOBS" ]]; do
if [[ "$VERBOSITY" -gt 1 ]]; then
echo "debug[2]: found glob: $i" 1>&2
fi
if [[ "$VERBOSITY" -ge 1 ]]; then
if [[ -z "$I_FLAG" ]]; then
if [[ -n "$SED_OPTIONS" ]]; then
echo "debug[1]: about to run: git ls-files $1 | xargs $SED -i\"$EXTENSION\" $SED_OPTIONS ${SED_COMMANDS[*]}" 1>&2
else
echo "debug[1]: about to run: git ls-files $1 | xargs $SED -i\"$EXTENSION\" ${SED_COMMANDS[*]}" 1>&2
fi
else
if [[ -n "$SED_OPTIONS" ]]; then
echo "debug[1]: about to run: git ls-files $1 | xargs $SED $SED_OPTIONS ${SED_COMMANDS[*]}" 1>&2
else
echo "debug[1]: about to run: git ls-files $1 | xargs $SED ${SED_COMMANDS[*]}" 1>&2
fi
fi
fi
if [[ -z "$I_FLAG" ]]; then
if [[ -n "$SED_OPTIONS" ]]; then
git ls-files "$1" | xargs "$SED" -i"$EXTENSION" "$SED_OPTIONS" "${SED_COMMANDS[@]}"
else
git ls-files "$1" | xargs "$SED" -i"$EXTENSION" "${SED_COMMANDS[@]}"
fi
else
if [[ -n "$SED_OPTIONS" ]]; then
git ls-files "$1" | xargs "$SED" "$SED_OPTIONS" "${SED_COMMANDS[@]}"
else
git ls-files "$1" | xargs "$SED" "${SED_COMMANDS[@]}"
fi
fi
((i++))
shift 1
if [[ "$VERBOSITY" -gt 2 ]]; then
if [[ "$#" -eq 1 ]]; then
echo "debug[2]: $# remaining glob" 1>&2
else
echo "debug[2]: $# remaining globs" 1>&2
fi
fi
done
-205
View File
@@ -1,205 +0,0 @@
# sgit - run sed on files under git control
This was originally a quick and dirty hack to modify files under git control
via `sed`. It started out with some limitations like the inability to deal
with spaces in `sed` commands, only allowing one glob and it had terrible
efficiency because it ran git ls-files for each `sed` command.
Now it is a bit more thorough and is more efficient (though not perfect). It
allows you to specify a path to `sed`, `sed` options and multiple `sed` commands
(though this always existed). The _default_ behaviour is to use in place editing
(**WITHOUT A BACKUP EXTENSION**; use `-i` to provide a backup extension) but you
can override the saving to disk with the `-I` option.
## Usage
```sh
usage: sgit [-h] [-V] [-v level] [-x] [-I] [-i extension] [-o sed_options] [-s sed] [-e command] <glob...>
-h print help and exit
-V print version and exit
-v level set verbosity level
-x turn on tracing (set -x)
-I disable in place editing
-i extension set backup extension (default none)
WARNING: sed -i overwrites existing files
WARNING: this will create another file for each file changed
-o sed options (NOTE: don't pass '-'!)
WARNING: use of '-o n' without '-I', can depending on command, empty files
-s sed set path to sed
-e command append sed command to to list to execute on globs
sgit version: 0.0.8-1 19-04-2023
```
You **MUST** specify at least one `sed` command and one glob: the sed command by
way of the `-e` option (just like with `sed`); anything after the last option is
a glob. You may specify more than one of each. Specify `-e` for each command.
# A note about the `-i` option and backup extensions
It works like `sed -i` except that the default behaviour of the script is to use
`-i` just with an empty backup extension (this is required for some versions of
`sed` which force that a backup extension actually be provided with the `-i`
option .. I'm looking at you, BSD/macOS `sed`).
# `-i` WARNING: each file edited will result in another file in the working directory
Of course if you have 50 files that are affected then 50 new files will be
created.
# `-i` WARNING: `sed -i` **WILL OVERWRITE EXISTING FILES**!
Please be aware that if a backup file already exists it **WILL** be overwritten!
I won't even try and detect this because it's not how `sed` works and it would
overly complicate the script.
# `-o n` WARNING: invalid use of -o n can empty files!
Because `sed -n` does not print output if you do not use `-I` and you use
substitute you can empty the entire file. For instance **DO NOT** do this:
```sh
./sgit -o n -e 's/.//g' sgit
```
because it would empty `sgit`!
# Examples
## Change in this file (_IN MEMORY ONLY_) `\<sed\>` to `used` but only show lines changed:
```sh
./sgit -I -o n -e 's/\<sed\>/used/p' README.md
./sgit -I -n -e 's/\<sed\>/used/p' README.md
```
## Print out matches of `\<sed\>` in all files under git control
This is a simpler way of running `git --no-pager grep -h -E '\<sed\>'|sed
's/^[0-9]*://g'` which itself might or might not be more complicated than it
needs to be:
```sh
./sgit -I -o n -e '/\<sed\>/p' .
```
## With tracing enabled, change references of `\<sed\>` to `used` in this file and save it:
```sh
./sgit -e 's/\<sed\>/used/g' -x README.md
```
## With tracing enabled, change references of `\<sed\>` to `used`, duplicating the lines, in this file and save it:
```sh
./sgit -e 's/\<sed\>/used/p' -x README.md
```
## Verbosely (level 1) change references of `\<sed\>` to `used` in this file and save it:
```sh
./sgit -e 's/\<sed\>/used/g' -v1 README.md
```
## Verbosely (level 3) change references of `\<sed\>` to `used` in this file with a backup as `README.md.bak`
```sh
./sgit -i.bak -e 's/\<sed\>/used/g' -v3 README.md
```
With that you would see something like:
```sh
debug[2]: sed commands: -e s/\<sed\>/used/g
debug[2]: looping through all globs
debug[1]: using backup extension: .bak
debug[2]: found glob: 0
debug[1]: about to run: git ls-files README.md | xargs /opt/local/bin/sed -i".bak" -e s/\<sed\>/used/g
debug[2]: 0 remaining globs
```
Level 2 would not show how many globs remain after each operation.
## Change `\<sed\>` to `used` but only if it's on the first line
```sh
./sgit -e '1s/\<sed\>/used/g' README.md
```
Alternatively you could do one of:
```sh
./sgit -e '1s/\<sed\>/u&/g' README.md
./sgit -e '1s/\(\<sed\>\)/u\1/g' README.md
```
## Change `\<hack\>` to `crack` but only if it's on the third line
```sh
./sgit -e '3s/\<hack\>/crack/g' README.md
```
## Installation
If you wish to install it you may either copy it to a place in your path or if
you have make installed you can just run `make install` either as root or via
`sudo` like:
```sh
sudo make install
```
## Documentation?
Right now this is it but the Makefile is set up so that if a man page is added
it can easily install it as well.
## Limitations
One that comes to mind is you cannot specify `git ls-files` options but this
could be problematic anyway especially if one were to specify the `-z` option.
There are probably other limitations but it works well for what I needed.
## Bugs
None known but it does not try and determine which files have match the
patterns. This would likely greatly complicate the script and is I feel
unneeded.
If you specify invalid `sed` commands obviously there will be problems. If you
specify invalid `sed` options there will possibly be problems as well.
Again this was originally a hack.
## History
It has been a persistent problem for me that I need to edit files under git
control and `sed` is the obvious way to go about it.
Working on the [IOCCC mkiocccentry](https://github.com/ioccc-src/mkiocccentry)
and the [IOCCC temporary website](https://github.com/ioccc-src/temp-test-ioccc)
and the [IOCCC temporary website](https://github.com/ioccc-src/temp-test-ioccc)
repos (and in particular the latter) is what inspired me to do something about
it.
## Other thoughts
Pull requests are welcome but I think it's mostly in a good enough state where
this will probably generally not be needed.