ioccc-src / temp-test-ioccc

Temporary test IOCCC web site that will go away
Creative Commons Attribution Share Alike 4.0 International
28 stars 6 forks source link

Question: Issues that aren’t really major issues but are still issues #5

Open xexyl opened 1 year ago

xexyl commented 1 year ago

TODO

Original comment

Like the thread in the other repo this is to help us keep the actual issues free from clutter.

I'll start out by showing the problem of not being able to fork this repo instead of winner.git. I'll do that in a follow-up comment.

xexyl commented 1 year ago

UPDATE on forking: it's resolved!

My idea worked: deleting my fork and re-forking it allowed me to create a fork of this repo.

Now I can actually make changes. I do not, I'm afraid, see that happening today, and I will actually be taking a break now rather than replying to the other comments (though the break might be short) but I will get to them later on if not in a bit (though technically that IS later on).

lcn2 commented 1 year ago

🤩

xexyl commented 1 year ago

🤩

What is this in reply to please ?

xexyl commented 1 year ago

Testing

Would it be possible to have a test subdomain of the main IOCCC website OR a temp / test subdirectory that has all the changes of THIS repo so we can make sure everything looks and works okay ? It might be a good way to verify that everything can be merged to the real website later on.

xexyl commented 1 year ago

...and I hope you're having a nice sleep my friend!

I'm going to be updating the keys (more recently recommended encryption standards) on the zones (DNSSEC keys I mean) and that will take a bit of time agains this repo but I'm a bit too tired for this and not that so that's okay. I did it with two domains yesterday as some keys were missing but I figure I might as well do it for the others too.

At least I think I'll be doing that now :-) .. either way I'll reply to your comments in the other issues later on.

UPDATE 0

Was troubleshooting a strange problem .. solved that so now I can continue the above. Then if I have time I'll reply to the other comments. Else I'll do that after a break. I then maybe (we'll see!) can get more work done on this repo.

UPDATE 1

... it wasn't solved after all but what is done works well enough for now. I didn't finish the task because of it. I will be taking a quick break and then I will work on the comments here. Hopefully by the time you're awake I will be done with that.

xexyl commented 1 year ago

Questions about moving forwards

What issues have things that can be done before the json tools are made?

If there are any what are they? I guess some (perhaps not all) typos and consistency in some (not all - an example where it's probably possible is the Makefiles) would be something that can be done. Is this so? Anything else that you can think of?

I'll be doing other things now and might not work on this today. I'm feeling pretty worn out right now. That certainly might change but right now I definitely need to do something else.

lcn2 commented 1 year ago

Questions about moving forwards

What issues have things that can be done before the json tools are made?

If there are any what are they? I guess some (perhaps not all) typos and consistency in some (not all - an example where it's probably possible is the Makefiles) would be something that can be done. Is this so? Anything else that you can think of?

Issue #1, issue #2, and issue #3 can be done.

lcn2 commented 1 year ago

We have not forgotten about comment 1418905409.

xexyl commented 1 year ago

Questions about moving forwards

What issues have things that can be done before the json tools are made? If there are any what are they? I guess some (perhaps not all) typos and consistency in some (not all - an example where it's probably possible is the Makefiles) would be something that can be done. Is this so? Anything else that you can think of?

Issue #1, issue #2, and issue #3 can be done.

But if the fourth one might impact some of these is this wise? That's kind of what I was getting at. I mean some things in the issues can be done but what can't be or what shouldn't be might be a better way of putting it?

xexyl commented 1 year ago

We have not forgotten about comment 1418905409.

Oh thank you!

lcn2 commented 1 year ago

Questions about moving forwards

What issues have things that can be done before the json tools are made?

If there are any what are they? I guess some (perhaps not all) typos and consistency in some (not all - an example where it's probably possible is the Makefiles) would be something that can be done. Is this so? Anything else that you can think of?

Issue #1, issue #2, and issue #3 can be done.

But if the fourth one might impact some of these is this wise? That's kind of what I was getting at. I mean some things in the issues can be done but what can't be or what shouldn't be might be a better way of putting it?

As you didn't seem inclined to want to edit years.html when you went about renaming and removing files .. that is OK, we just have to adjust our approach to that fact .. we will have to accelerate the building of the pre-directory .winner.json files via a tool that we will write .. a tool that needed to be written eventually anyway, BTW.

Also now, before this forked repo can be merged into the main IOCCC winner repo and web site, another tool to build the years.html web page from all .winner.json files .. also one that we need to also write eventually anyway .. will need to automatically build the years.html web page before the the main IOCCC winner repo and web site can be updated.

xexyl commented 1 year ago

Questions about moving forwards

What issues have things that can be done before the json tools are made?

If there are any what are they? I guess some (perhaps not all) typos and consistency in some (not all - an example where it's probably possible is the Makefiles) would be something that can be done. Is this so? Anything else that you can think of?

Issue #1, issue #2, and issue #3 can be done.

But if the fourth one might impact some of these is this wise? That's kind of what I was getting at. I mean some things in the issues can be done but what can't be or what shouldn't be might be a better way of putting it?

As you didn't seem inclined to want to edit years.html when you went about renaming and removing files .. that is OK, we just have to adjust our approach to that fact .. we will have to accelerate the building of the pre-directory .winner.json files via a tool that we will write .. a tool that needed to be written eventually anyway, BTW.

Also now, before this forked repo can be merged into the main IOCCC winner repo and web site, another tool to build the years.html web page from all .winner.json files .. also one that we need to also write eventually anyway .. will need to automatically build the years.html web page before the the main IOCCC winner repo and web site can be updated.

Hmm .. what should have been changed in years.html ? What did I miss ?

xexyl commented 1 year ago

Though it's true I didn't want to do a major update as I think editing html files directly is risky. Then again maybe editing markdown is as well without testing it.

So what should be done please? I will look at doing it if that's helpful?

lcn2 commented 1 year ago

We were taken out to dinner at a new place by a friend and ate something that was "off". Lack of sleep and frequent access to "you know what" (🚽🧻) while humming the SouthPark "Mr. Hanley💩" song, is our current focus until it flushes out of our system.

To maintain something to do, we have our iPhone to answer questions and provide feedback and encouragement .. interrupted as just happened now from time to time until things are flushed out of our system .. followed by rest .. followed by resetting our sleep clock.

In between all that, we will design the tool in our head, to generate the .winner.json files, the tool to build the years.html page, and the format of the author based JSON files.

xexyl commented 1 year ago

We were taken out to dinner at a new place by a friend and ate something that was "off". Lack of sleep and frequent access to "you know what" (🚽🧻) while humming the SouthPark "Mr. Hanley💩" song, is our current focus until it flushes out of our system.

I shouldn't laugh but I did! I'm sorry. It's the way you worded it. I also know what having to use that in the night a lot is like. Does not help with my sleep issues I can tell you. I hope you feel better soon.

If it's liquid (and I do not mean the yellow/clear one) too please remember to remain hydrated! You can even make your own isotonic drink by putting ½ teaspoon of salt into 1 cup of warm water. I've known this for years but it was also mentioned in the medical book I finally got through (quite quickly .. I did say it was light reading .. it was fun and I learnt a lot from it - not at all the only medical book I've read) so it's recently on my mind.

To maintain something to do, we have our iPhone to answer questions and provide feedback and encouragement .. interrupted as just happened now from time to time until things are flushed out of our system .. followed by rest .. followed by resetting our sleep clock.

Best wishes!

In between all that, we will design the tool in our head, to generate the .winner.json files, the tool to build the years.html page, and the format of the author based JSON files.

Sounds good.

lcn2 commented 1 year ago

If it's liquid (and I do not mean the yellow/clear one) too please remember to remain hydrated! You can even make your own isotonic drink by putting ½ teaspoon of salt into 1 cup of warm water. I've known this for years but it was also mentioned in the medical book I finally got through (quite quickly .. I did say it was light reading .. it was fun and I learnt a lot from it - not at all the only medical book I've read) so it's recently on my mind.

Thanks, we are keeping well hydrated, which means more frequent trips .. but that is part of the process.

We have people in the house that are checking in on us too.

xexyl commented 1 year ago

The strings of the form "years.html#2020_ferguson2" refer to name tag in the top level years.html file. And thus will refer to the 2020/ferguson2/ winning entry directory (a rather fine entry if you ask us 🤓). So the file 2020/ferguson2/.winner.json will contain things like the manifest for that particular entry as well as JSON stuff for the list if authors .. which in this case will be "Cody_Ferguson".

Thank you for the great compliment! I enjoyed making that one. I found it fitting that I finished it on 30 April 2020, exactly 75 years after a certain man ended his life, he who started the Second World War and brought the world to such misery (though ironically we've gained things from it .. a sad thing about humans is that we both strive for and thrive on conflict).

I don't wish any harm on them either. We're all human beings and we could all be the worst sadist in different situations. This is well documented but it's something that a lot of people have a problem accepting. There's so much to that but it's OT for even OT so I won't go there. I just wanted to thank you!

I enjoyed the fact that some previous entries played with the Morse code which could be used with my Enigma machine (I found a bug in one of those two entries but I don't remember which one without looking at my remarks .. perhaps that should be mentioned somehow in the remarks but how? I guess to start out I can extract the bug I found for you to think about).

I only thought of the idea for that entry after the contest closed but due to Covid you opening it I lucked out. I had a feeling that entry had a good chance of winning - as well as Snake (which was by far the most fun for me to write ... and play).

xexyl commented 1 year ago

If it's liquid (and I do not mean the yellow/clear one) too please remember to remain hydrated! You can even make your own isotonic drink by putting ½ teaspoon of salt into 1 cup of warm water. I've known this for years but it was also mentioned in the medical book I finally got through (quite quickly .. I did say it was light reading .. it was fun and I learnt a lot from it - not at all the only medical book I've read) so it's recently on my mind.

Thanks, we are keeping well hydrated, which means more frequent trips .. but that is part of the process.

I know how that goes far too well! :-( ... I had two huge kidney stones (see below for fun word) in 2020 so I have to be extra careful. But I also have a highly sensitive bladder (normal function but hypersensitive) so it's a problem in other ways. I know this because of a horrible medical procedure.

We have people in the house that are checking in on us too.

That's good.

Fun word for kidney stone: renal calculus. Can you figure out why ? I guess you can but I can tell you if you don't know.

lcn2 commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

lcn2 commented 1 year ago

🤩

What is this in reply to please ?

comment 1422487862

xexyl commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

xexyl commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

Oh actually. I did update it. It includes README.md. Did I miss others?

UPDATE 0

Though it does refer to README.html. Any such lines should be deleted, right?

UPDATE 1

What about hint.html ? author.html ?

xexyl commented 1 year ago

🤩

What is this in reply to please ?

comment 1422487862

Ah .. I thought it was a laugh so I wasn't sure what was funny. But that could be my misinterpreting that emoji (my vision certainly does not help there either)! Maybe it's just a happy smile or something.

lcn2 commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

Oh actually. I did update it. It includes README.md. Did I miss others?

UPDATE 0

Though it does refer to README.html. Any such lines should be deleted, right?

UPDATE 1

What about hint.html ? author.html ?

For now, all files in a winning directory need a link in the years.html file.

And for now, those files can cannot be directly displayed (and thus force someone to download them) should be link into the github repo, not the web site. This "hack" allows someone to use the GitHub view to see the contents of a file.

For an example, see how near the bottom of years.html we have links such as:

<UL TYPE=square>
<LI><A HREF="1984/laman/index.html">index.html</A> - <B>README</B>
<LI><A HREF="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/laman.c">laman.c</A>
<LI><A HREF="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/Makefile">Makefile</A>
<LI><A HREF="1984/laman/README.md">README.md</A> - <I>original README</I>
<LI><A HREF="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/orig.Makefile">orig.Makefile</A> - <I>original Makefile</I>
</UL>
<A NAME="1984_mullender"></A>
<P><B>mullender</B></P>

The links into the GitHub repo give the user quick viewer of the code for those files that might otherwise compel the browser to download it instead (which isn't much fun).

This is touched on in issue #3, BTW.

BTW: Later on we will change the HTML to directly display the content, similar to how GitHub does it, without causing a "download file" to occur.

BTW: For the compressed tarballs that might be present, the link WILL force a downloads .. which presumably is what the user wants. But this is a technicality to be addressed later.

xexyl commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

Oh actually. I did update it. It includes README.md. Did I miss others?

UPDATE 0

Though it does refer to README.html. Any such lines should be deleted, right?

UPDATE 1

What about hint.html ? author.html ?

For now, all files in a winning directory need a link in the years.html file.

Right. I was more thinking of those related to the files I renamed/removed.

And for now, those files can cannot be directly displayed (and thus force someone to download them) should be link into the github repo, not the web site. This "hack" allows someone to use the GitHub view to see the contents of a file.

Yes that's an unfortunate issue indeed!

For an example, see how near the bottom of years.html we have links such as:

<UL TYPE=square>
<LI><A HREF="1984/laman/index.html">index.html</A> - <B>README</B>
<LI><A HREF="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/laman.c">laman.c</A>
<LI><A HREF="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/Makefile">Makefile</A>
<LI><A HREF="1984/laman/README.md">README.md</A> - <I>original README</I>
<LI><A HREF="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/orig.Makefile">orig.Makefile</A> - <I>original Makefile</I>
</UL>
<A NAME="1984_mullender"></A>
<P><B>mullender</B></P>

The links into the GitHub repo give the user quick viewer of the code for those files that might otherwise compel the browser to download it instead (which isn't much fun).

Agreed.

This is touched on in issue #3, BTW.

Resolving it you mean? Ah .. you mean the directory clean up and consistency checks.

BTW: Later on we will change the HTML to directly display the content, similar to how GitHub does it, without causing a "download file" to occur.

That will be nice for sure.

But in the meantime this means all the links have to be updated, is that correct? Any idea how to best go about this ? It seems like it might be tedious unless a simple (or not many) regex can be contrived.

BTW: For the compressed tarballs that might be present, the link WILL force a downloads .. which presumably is what the user wants. But this is a technicality to be addressed later.

Of course.

xexyl commented 1 year ago

Do you want to add the GitHub check template to the repo ?

Unrelated I just fixed the FAQ - a missing entry from 2020 in a theme for entries not likely to win.

I also noticed the joke in there:

Screenshot 2023-02-09 at 11 17 03

Fun reference to WarGames.

xexyl commented 1 year ago

OT

Would you please tell me what ccode_analysis is all about? I have wondered that for years now. I know that might need to be kept a secret but it does intrigue me and always has amused me too. The option --deep_magic reminds me of the Deep Magic in The Chronicles of Narnia (I read all seven when I was five and a couple times since then) but I doubt very much it's related.

And now I really am going to do other things! I will be here a while though most likely.

lcn2 commented 1 year ago

Do you want to add the GitHub check template to the repo ?

To check what?

xexyl commented 1 year ago

Do you want to add the GitHub check template to the repo ?

To check what?

I'm not sure if it's needed. I refer anyway to .github/workflows/codeql.yml. Just popped into my head.

lcn2 commented 1 year ago

OT

Would you please tell me what ccode_analysis is all about? I have wondered that for years now. I know that might need to be kept a secret but it does intrigue me and always has amused me too. The option --deep_magic reminds me of the Deep Magic in The Chronicles of Narnia (I read all seven when I was five and a couple times since then) but I doubt very much it's related.

And now I really am going to do other things! I will be here a while though most likely.

It is thing for judges.

The name of the option, --deep_magic, is a HACKTRAN reference as well as a reference to the magic switch.

lcn2 commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

Oh actually. I did update it. It includes README.md. Did I miss others?

UPDATE 0

Though it does refer to README.html. Any such lines should be deleted, right?

UPDATE 1

What about hint.html ? author.html ?

It depends on the context .. are they copies of something else but in HTML form?

xexyl commented 1 year ago

OT

Would you please tell me what ccode_analysis is all about? I have wondered that for years now. I know that might need to be kept a secret but it does intrigue me and always has amused me too. The option --deep_magic reminds me of the Deep Magic in The Chronicles of Narnia (I read all seven when I was five and a couple times since then) but I doubt very much it's related. And now I really am going to do other things! I will be here a while though most likely.

It is thing for judges.

I won't ask:

what does it do ?

because I think I'll get:

/* no comment */

or worse

/* You are not expected to understand this */

but I'll ask if you actually do use it. I noticed the Makefile rule seems like it might not be useful but then that could be a misleading thing.

The name of the option, --deep_magic, is a HACKTRAN reference as well as a reference to the magic switch.

That story always makes me laugh. Yes I know it. It reminds me of other things in computers as well. The famous printf statement that prevented a segfault comes to mind (I had heard of it before you mentioned it but I didn't know where it was until you told me).

But what is HACKTRAN please ?

lcn2 commented 1 year ago

If it's liquid (and I do not mean the yellow/clear one) too please remember to remain hydrated! You can even make your own isotonic drink by putting ½ teaspoon of salt into 1 cup of warm water. I've known this for years but it was also mentioned in the medical book I finally got through (quite quickly .. I did say it was light reading .. it was fun and I learnt a lot from it - not at all the only medical book I've read) so it's recently on my mind.

Thanks, we are keeping well hydrated, which means more frequent trips .. but that is part of the process.

I know how that goes far too well! :-( ... I had two huge kidney stones (see below for fun word) in 2020 so I have to be extra careful. But I also have a highly sensitive bladder (normal function but hypersensitive) so it's a problem in other ways. I know this because of a horrible medical procedure.

We have people in the house that are checking in on us too.

That's good.

Fun word for kidney stone: renal calculus. Can you figure out why ? I guess you can but I can tell you if you don't know.

Calculus comes from Latin for "small stone".

xexyl commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

Oh actually. I did update it. It includes README.md. Did I miss others?

UPDATE 0

Though it does refer to README.html. Any such lines should be deleted, right?

UPDATE 1

What about hint.html ? author.html ?

It depends on the context .. are they copies of something else but in HTML form?

Well that was a more general what if query. I am not sure if any other lines referencing some files need to be deleted from that file.

xexyl commented 1 year ago

If it's liquid (and I do not mean the yellow/clear one) too please remember to remain hydrated! You can even make your own isotonic drink by putting ½ teaspoon of salt into 1 cup of warm water. I've known this for years but it was also mentioned in the medical book I finally got through (quite quickly .. I did say it was light reading .. it was fun and I learnt a lot from it - not at all the only medical book I've read) so it's recently on my mind.

Thanks, we are keeping well hydrated, which means more frequent trips .. but that is part of the process.

I know how that goes far too well! :-( ... I had two huge kidney stones (see below for fun word) in 2020 so I have to be extra careful. But I also have a highly sensitive bladder (normal function but hypersensitive) so it's a problem in other ways. I know this because of a horrible medical procedure.

We have people in the house that are checking in on us too.

That's good. Fun word for kidney stone: renal calculus. Can you figure out why ? I guess you can but I can tell you if you don't know.

Calculus comes from Latin for "small stone".

And to complete the puzzle: they're usually insoluble calcium. The renal you of course know.

... also as for as calcium goes:

early 19th century: from Latin calx, calc- ‘lime’ (see calx) + -ium.

lcn2 commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

Oh actually. I did update it. It includes README.md. Did I miss others?

UPDATE 0

Though it does refer to README.html. Any such lines should be deleted, right?

UPDATE 1

What about hint.html ? author.html ?

It depends on the context .. are they copies of something else but in HTML form?

Well that was a more general what if query. I am not sure if any other lines referencing some files need to be deleted from that file.

If this is in regards to years.html then lines referring to middling files should go away, lines referring to renamed files should be changed, lines for new files should be added. Moreover, for every file in an entries directory, there should be a line in 1st years.html`.

xexyl commented 1 year ago

Hmm .. what should have been changed in years.html ? What did I miss ?

See in issue #3, the stuff at the top about years.html links.

Oops. My mistake. I'll fix those. I have to remember what files changed.

Oh actually. I did update it. It includes README.md. Did I miss others?

UPDATE 0

Though it does refer to README.html. Any such lines should be deleted, right?

UPDATE 1

What about hint.html ? author.html ?

It depends on the context .. are they copies of something else but in HTML form?

Well that was a more general what if query. I am not sure if any other lines referencing some files need to be deleted from that file.

If this is in regards to years.html then lines referring to middling files should go away, lines referring to renamed files should be changed, lines for new files should be added. Moreover, for every file in an entries directory, there should be a line in 1st years.html`.

I think that's indeed it. Files that are missing / renamed are obvious. I was also unsure on if some files should be removed though - from the repo and thus also years.html.

Also what do you mean with:

Moreover, for every file in an entries directory, there should be a line in 1st years.html

please?

xexyl commented 1 year ago

Leaving for the day but before I do a couple notes.

In comment https://github.com/ioccc-src/temp-test-ioccc/issues/3#issuecomment-1424875758 I generated a list of files that are listed in the years.html file that do not exist (didn't include the output .. just included the simple script I wrote that does it, originally as a long one liner). This comment has some questions for you on some files. I think I know what needs to be done but before I do those changes I am asking.

That comment also gave a possible way to generate a list of files in json format.

Finally I wonder if there should be a changelog? Should the progress of the updates be noted? Or will you every so often update the news?

Making one more comment and then leaving for the day. Hope you feel better soon!

xexyl commented 1 year ago

Good morning!

I'm waking up still .. can't sleep or even lie down so sitting up at the laptop and once I'm a bit more awake I'll start working more on this repo. I'm hoping to do more today than I have done because starting tomorrow for some days I might be slower (though that doesn't mean I won't be able to do anything).

But more importantly I wanted to say: I hope you're feeling all better today my good friend! I hope you're getting some sleep as well.

More from me soon in the way of commits .. I think also I can figure out the missing files situation in years.html but we'll see if it becomes obvious once I look at the real website and this one.

Anyway just wanted to give you an update and say I hope you're feeling better (that was my primary reason for this comment)!

xexyl commented 1 year ago

You might get a laugh out of commit e6d146bb002085f3f3b395a5f6e138e61d4c29c7 and in particular the second and third part of:

Not that this is a double negative but on the subject of language a
couple fun facts about double negatives: in standard Spanish and Polish
they are used AND it was not until after the 16th century that they were
frowned up on in English.

Question: if !! (not not) cancels out the ! (meaning it's not negative
or rather it's true) is !!! (not not not or false) a not (false), a
double not (true) or a triple not (false) ? :-)

[0] Actually in this case it should be one or more alternatives but this
is either a mistake in OED or me being too literal (which is very
possible). 'Possibility' would be a better word to use as would 'choice'
(but there are certainly other, uh, choices).

but probably esp the second part.

Anyway I think it's a useful change.

xexyl commented 1 year ago

Commit https://github.com/ioccc-src/temp-test-ioccc/commit/017278725a36772512632b9d821c841cd247b0fd fixes the typo for 'resubmission'.

See next comment for a useful script I wrote that can update all files of a specific glob that are under git control with sed that.

xexyl commented 1 year ago

The script that's a hack and probably error prone (this a reason for git diff!) that can mass replace patterns in files under git control. Probably it should take the command first so that the more than one glob can be used in the git ls-files command but this might or might not complicate the script slightly. On the other hand it now (second version) allows for more than one sed command so it's a pick or choose on that one. Anyway:


#!/usr/bin/env bash
#
# sgit - sed on all files under git control
#
# usage: sgit <sed command...> <glob>
#
# sed must be GNU sed and we use -i'' just in case it's not. Even so sed under
# macOS will fail. This script could be improved to check for GNU sed and it
# might be an easy way to fix it in other sed implementations but it works for
# my purposes and since I want to work on the reason for this script (and not
# the script itself) I'm not going to worry about that.
#
# DISCLAIMER AND WARNING: this is hack and most likely error prone!
#
# - Cody Boone Ferguson (@xexyl)
#

# firewall
#
# first 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

# check number of args
if [[ "$#" -lt 2 ]]; then
    echo "$(basename "$0"): ERROR: usage: $(basename "$0") <sed command...> <glob>" 1>&2
    exit 2
fi

export SED_COMMANDS=""
export GLOB=""
# go through the command line, extracting the sed commands. When we've reached
# the end (one arg left) we know we have the glob to pass to git ls-files.
# We do it this way because apparently $BASH_ARG[VC] are not set unless in
# extended debugging mode (shopt -s extdebug).
i=0;
while [[ "$i" -le "$#" ]]; do
    SED_COMMANDS="$SED_COMMANDS -e $1";
    ((i++))
    shift 1
done
GLOB="$1"

# This is 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 a hack so it doesn't have to be
# perfect (not that there even is such a thing as perfect).
#
# NOTE: it is a burden on the user to specify a glob that will only match
# regular files. Although we could try and figure out if each matching file is a
# regular file it would mean we would have to go through the list a line at a
# time and then add it to a new list if it's a regular file and this seems
# unnecessary. Besides doing '.' will not cause a problem so it might be fine.

# shellcheck disable=SC2086
# SC2086 (info): Double quote to prevent globbing and word splitting. We can't
# disable this because we need to have word splitting.
git ls-files "$GLOB" | xargs sed -i'' $SED_COMMANDS

I hope it's useful to you but whether or not it's useful to you it's certainly useful to me .. many times I've had to create a list of files and then run sed on those files only.

Since it requires GNU sed (possibly could be fixed for other sed implementations but I'm not bothered as I want to work on the repo and it works if one uses GNU sed .. though I'd like it to be fixed it's just extremely low priority) and since that might not be end up being in the path of the script it specifies gsed and not sed. Obviously that would break if gsed does not exist but one could change it to be just sed.

It's what I used for commit https://github.com/ioccc-src/temp-test-ioccc/commit/017278725a36772512632b9d821c841cd247b0fd though I used the first version. The second version allows fore more sed commands which seems more useful. Performance is terrible of course but that went for all versions. Well it's a hack so it's okay.

xexyl commented 1 year ago

Do you want to add the GitHub check template to the repo ?

To check what?

I'm not sure if it's needed. I refer anyway to .github/workflows/codeql.yml. Just popped into my head.

I thought of a reason to not include it .. at least not the code checks! Given the nature of the code in this repository it's very possible that some tests would fail which could, if fixed, break the entry.

lcn2 commented 1 year ago

Feeling better today. If there is the energy, will look at comments on all issues marked as 👀.

xexyl commented 1 year ago

Feeling better today. If there is the energy, will look at comments on all issues marked as 👀.

I noticed you marked some.

Glad you're feeling better! But don't worry about replying if you're not up to it. Better to spend time to fully recover.

Best wishes on the rest of your recovery!

xexyl commented 1 year ago

Would you tell me about:

This program was selected for the 1987 t-shirt collection.

please ? It's from 1985/shapiro.

I incidentally have my entries on a shirt .. I should show you sometime but right now I'm working on this repo.

xexyl commented 1 year ago

OT if you need a laugh or two whilst recovering

Fun and funny essays:

You can imagine this one.

Here it's suggested that int should normally not be used. He gave three uses (or actually one as he thinks char should normally not be used either or at least not as often as it is) where it's valid but he did not include function parameters including in syscall (e.g. accept() or any other file descriptor for that matter). He stated that int is non-portable when of course not using it is actually what's not portable. He then tried to give some pitfalls but it doesn't actually say that int is bad just that it's bad in some situations (which it very well can be) though in some cases he gives there are exceptions that pop into my head.

--

Anyway I'm done working on the repo for the day. I hope tomorrow to work more on it before my cousin gets here. After she does I won't be able to do anything until Sunday - but how much I do is hard to say. I should actually be able to do some on my birthday but later in the day I won't be able to.

Off to do other things. Good day and hope you're all better soon!

xexyl commented 1 year ago

I was hoping to do some things here today but I'm afraid I'm too tired. I hope that tomorrow I can do at least a little bit but for now I'm just going to take it easy. I do have a fun image to share with you which I'll post in the next comment but then I'll be resting (which might just be watching a funny film).

Hopefully you're all better today. if you get to reply today then I will at least be able to reply tomorrow if not today (depends on the time).

xexyl commented 1 year ago

OT fun with dates

It also did this for even older posts. The 'yesterday', two days ago, one week ago, one month ago etc. instead of the date (including the year) and time drives me crazy (what is a year ago? Is it 365/366 days or is it twice that less one ? According to some systems it can be the latter) but this is the first time I saw a service mess up this much.

github-is-having-a-serious-mental-breakdown-cropped

Have a great day!

xexyl commented 1 year ago

vim tips

I just discovered the real use of the Command Line window that can be opened with q: (or for searching forwards and backwards q/ and q? which do what it sounds like - search commands).

You can look at the commands you entered and then re-execute them by pressing enter. You can even edit the command and re-enter it!

If you want it open and you need to go to another buffer you'll have to close it, move to it like I noted in my .vimrc: :winc [jklh] and then open it again.

You can even save the buffer to a file to look at later.

See also the help entries also :help q: and :help q/ and :help :q? Some are obvious but some might not be. For instance the pressing enter I thought of and editing as well though it does seem to talk about it some. :winc is a command I use very often.

Of course to quit that window it's :q or if you want to quit all (will close vim unless unsaved changes as you'd expect) :qa.

There are other things but in case you did not know about this I think you might find it useful.

More from me tomorrow. Have a great day!