Hacker Newsnew | past | comments | ask | show | jobs | submit | kritixilithos's commentslogin

Nicely done using Unix utils. You can have a pure sed solution (save the `ls` invocation) that is much simpler, albeit obscure, that hinges on the fact that every number has a `data.csv` file.

Given a sorted list of these files (through `ls` or otherwise) the following sed code will print out the data files for which A did not succeed on them.

  /data/!N
  /A/d
  P;D

This works on the fact that there exists a data file for all successful and unsuccessful runs on data, so sed simply prints the files for which there does not exist an `A` counterpart.

If you want to only print out the numbers, you can add a substitution or two towards the end.

  /data/!N
  /A/d
  s/^0*\|_.*//g;P;D
Edit: fixed the sed program


Actually the following is even shorter

  /A/{N;d;}
So all together this gives the following

  ls|sed '/A/{N;d;}'


Are you tails? Anyways, thanks for helping me tie with first place :)


No, I’m clock. As you can see, my sed skills aren’t as good as tails :)

Now that I’m 10 bytes behind I might have to give it another try. Though I haven’t golfed in years :/

EDIT: Well, I checked my old code and found a few places to optimize. Now down to 95 bytes :)


Reached 96 bytes (now where would that last byte be hmmmm). And as you can see, my sed skills aren't as good as yours either :)

Nice meeting a fellow golfer, this was fun :)


There's even an implementation of lisp in sed :) https://github.com/shinh/sedlisp/


That's probably because you used BSD sed. Running it on my BSD sed also gives an error, presumably because it thinks the `}` is a part of the label in `binput}`.

However it works fine in GNU sed, and now that you mention it, GNU sed's extensions were not used, like the `-z` flag to slurp all input in one "line" to avoid `:input;$!{N;binput}`.


As another user of iTerm2, I am currently using several keyboard mappings from key to key (like Tab being interpreted as Esc), do you know whether Kitty supports that? As far as I can see in the docs, only examples of key to action are shown.


You could do that at the macOS level using karabiner for example. I have Caps lock as esc when tapped and Ctrl when held.


Congratulations!

Are you familiar with code golf? If not, I recommend it. In Code Golf, the objective is to complete a programming task in the shortest program possible, measured in bytes. While doing so, you really learn about the nuances of your language and its obscure features.

When I was about your age, I joined the code golf community at Stack Exchange, and since then my JS skills and general programming skills have improved greatly. I hope that you would find it to be useful too.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: