Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
lhoursquentin
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
lhoursquentin
4y ago
The lack of arrays, dicts and local variables when trying to be POSIX compliant becomes quickly annoying when writing big programs though. There are of course workarounds to deal with those but I wish we didn't have to use them.
2.
▲
by
lhoursquentin
4y ago
What's interesting with this example of command1 | command2 is that some shells such as zsh will optimize the last member of the pipeline to be executed in the current process (nothing mandated by POSIX here), so effectively this works
3.
▲
by
lhoursquentin
4y ago
> [[ ]] is a bash builtin, and is more powerful than [ ] or test. Agreed on the powerful bit, however [[ ]] is not a "builtin" (whereas [ and test are builtins in bash), it's a reserved word which is more similar to if and
4.
▲
Show HN: Visual strace – visualize processes forks and pipes
(lhoursquentin.github.io)
2 points
by
lhoursquentin
4y ago
|
0 comments
5.
▲
by
lhoursquentin
4y ago
> Yeah, I know there's D3.js but that involved way more knowledge and learning than I was interested in. Same, d3 looked very powerful but had a steep learning curve. I was looking for something simple to generate process trees in r
6.
▲
Show HN: Portable object-oriented shell scripting
(github.com)
2 points
by
lhoursquentin
4y ago
|
0 comments
7.
▲
by
lhoursquentin
5y ago
https://www.grymoire.com/Unix/Sed.html is a good resource to get started, though it's definitely something you should not just read due to the fact that sed code is pretty hard to read. Have a terminal on the side
8.
▲
by
lhoursquentin
5y ago
> I would be curious if mksh is also faster. ksh93 also claims great performance increases, but it is no longer (well) maintained. mksh `printf` is not builtin, so if the script makes heavy use of it then it tends to be slower than bash.
9.
▲
by
lhoursquentin
6y ago
Cool I'll definitely try to set it up in the coming days! Here's my humble strace visualizer: https://lhoursquentin.github.io/visual-strace/
10.
▲
by
lhoursquentin
6y ago
Great post, also love what you are trying to do with C playground, this is awesome! I've recently been trying to build something similar, visualizing forks/exeve/read/write, but using the strace output of a binary, which
11.
▲
by
lhoursquentin
6y ago
You should probably note that this hack spawns an additional shell process per comment :)
12.
▲
by
lhoursquentin
6y ago
Yes most of the time the respecting POSIX to the letter is not needed, but it is of course satisfying knowing that your script can run fine on BSDs and other less common distributions :) Though sometimes you don't need to go that far t
13.
▲
by
lhoursquentin
6y ago
> Remember readable means that you can read and understand it Yes you are right, my usage of "readable" was probably wrong there. Maybe the point I was trying to make was less about the individual constructs but more about how
14.
▲
by
lhoursquentin
6y ago
The thing is when you restrict yourself to only what POSIX specifies you don't even have basic data structures, no array, no hash map not even local variables, and that often leads to code that relies on multiple hacks. For instance: y
15.
▲
by
lhoursquentin
6y ago
-i is definitely not specificed by POSIX, but it supported on all those platforms with some small differences, for instance on OSX the backup extension (-i.bak) is not optional.
16.
▲
by
lhoursquentin
6y ago
Yep I can confirm intel cards are still an issue. I installed FreeBSD a week ago and gave up trying to enable Wi-Fi after an hour of struggle on a Thinkpad T490, didn't even get to the point of having the interface show up in ifconfig.
17.
▲
by
lhoursquentin
6y ago
Yep that's exactly right :) ! To clarify my statement POSIX requires at least 8192 bytes for the pattern and hold space, and I chose to allow at most 8192 bytes here, which indeed means that this will prevent working on really long l
18.
▲
by
lhoursquentin
6y ago
No concrete benchmarks no, I just timed a few scripts I had on hand and generated a bunch of others, and I saw compiled ones performed slightly faster than GNU and toybox sed, so nothing serious. Unfortunately, it's also pretty hard to
19.
▲
Show HN: Sed to C translator written in sed
(github.com)
160 points
by
lhoursquentin
6y ago
|
14 comments
20.
▲
by
lhoursquentin
6y ago
A Sed to C translator written in Sed, the objective being to be able to translate itself: https://github.com/lhoursquentin/sed-bin
21.
▲
by
lhoursquentin
6y ago
Really cool stuff, I've been working on being able to debug sed scripts as well by translating it to pseudo readable C[1], compiling the result and then using gdb to step in the script, but this TUI is much more readable! [1] https:&#
22.
▲
by
lhoursquentin
7y ago
Regarding 4. it's an interesting point, and this actually exists, few people know that ksh93 (which was a big inspiration for bash and zsh) does not fork when it doesn't really need to, for instance if you strace the following: ec