251 karma · joined May 2, 2021
For the first example I would just place the breakpoint on the return. The highlighting is quite nice but I see not much need for the prediction which was probably hard to implement.
In languages like Java features like "hot code replace" exist. In a function like this if the result is not what I expect, I can simply change the code and restart the function without restarting the application. Not much need for prediction.
What I wished were more common is reverse debugging were you can step backwards.
Also a reason why I'm against Unicode identifier in source code. You got some source with characters like 'ö' in one variant and now your editor decides to use a different variant (e.g. compatibility character vs base character + combining decoration). And from my observation programming languages which claim to support Unicode tend to not make the effort to resolve those equivalents. At least for older versions of Go the specification clearly stated that they only compare Unicode code points. (don't know the current state)
The footer is this way for month already. And secondary resources like developer.twitter.com will likely stay inconsistent for a long time (probably forever).
I'm still kinda surprised they actually changed the well known bird logo. I would be even more surprised if they actually try to fully replace the name Twitter.
Quite recently I noticed that Java2D text rendering cheats the same way as Firefox and Chrome described in the overlapping example.
The character Ø can be expressed in Unicode in two ways. Either as single code point U+00D8 or as an O + combining slash (U+0338). Since the first one is one code point Java2D renders it correctly with transparency but the second variant as two characters with notable overlap since Java is lazy on the 'combining' part.
set -e
[[ 0 == 1 ]] && true
echo Status: $?
will print "Status: 1" but set -e
func() {
[[ 0 == 1 ]] && true
}
func
echo Status: $?
will print nothing but exit after func returns.An alternative which works in both Bash and Zsh is
printf %q "$var"
using /usr/bin/printf %q "$var" has even a good chance to work in other shells.And as fun fact: the Zsh equivalent for Bash's ${var@@} is ${(q)var} and it was not enough to have one quoting style but instead you can also provide qq, qqq, qqqq, q+ or q- all with a different result.
https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parame...
or use 'emulate sh' to enable many flags at once.
(and I personally would prefer if other shells would behave like Zsh and not word split unquoted variables by default)
jq on Windows produces \r\n terminated lines which can be annoying when used with Cygwin / MSYS2 / WSL. The '--binary' option to not convert line delimiters is one of those pending improvements.
https://github.com/stedolan/jq/commit/0dab2b18d73e561f511801...
$ tasklist /V
ERROR: argument/option invalid - "C:/msys64/V"
or the time I wanted to use xmlstarlet and any xpath expression was interpreted as Windows path :(At least for MSYS2 the environment variable MSYS2_ARG_CONV_EXC can be used to prevent conversion. https://www.msys2.org/docs/filesystem-paths/#process-argumen...
In context of ADS the first thing I imagined was storing the compressed and uncompressed file alongside. (which is rather silly, why compress at all)
This use case is also kinda strange. Have the compressed content as ADS, the primary contend filled with 0 as sparse and fill it when needed/accessed. :/
NTFS would accept almost anything. The Windows API (I think of the old Win32 one) would apply most restrictions the article mentions.
But for example not the normalization part. A filename can end with a space, no problem. That lead me once to a minor bug in .NET Framework. One of the path related functions (I think it was Directory.move) did not correctly apply this normalization and could produce directories with trailing whitespace. Good luck removing/fixing those in Windows Explorer.
You seem to talk about a specific command line argument of the compact command with a Windows typical (and IMO ugly) option style with '/' instead of '--' as option marker and ':' instead of '=' as option value separator.
But that would not be directly related to ADS and I cannot imagine a good use case where the compact command should use ADS.
Data stream is basically the file content and on NTFS a file can have more than one. In practice it is comparable to extended attributes in the Linux world but somewhat superior.
But like extended attributes it doesn't seem to have too much real world use. The only use case for alternate data streams I can remember are the "this file was downloaded from the internet, do you really want to run it" warnings. In such cases the browser attached a standardized marker as alternate data stream to the file.
¹ https://github.com/ohmyzsh/ohmyzsh/commits/master
² https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/changel...
The result is something like this
BREAKING CHANGES:
- 61dd368 [nats]
Rename `nsc` plugin to `nats`
Features:
- eb2147c [aws] Load profiles from credentials file (#11196)
- 4b5076b [extract] Add `pbzip2` and `pixz` (#11435)
Bug fixes:
- f1a8000 [brew] Rename `buf` alias to `bfu`
- df65835 [clipboard] Move wsl detection to higher priority (#11440)
Performance:
- ba8777f [fzf] Speed up startup on debian (#11122)
Documentation:
- 6dc6646 [git] Add missing entries and run formatter
- 0f71cfd [qrsvg] Fix command example (#11436)Seeing all those "Shell AI Helper" examples there seem to be a surprising demand for finding and/or killing processes. And the result is usually killing (instead of terminating) whatever of some wonky ps/grep pipe finds instead of just using pgrep...
> With paper that'd be not so trivial, in my country the paper often has some special format and the paper itself is of a special type, and it ages and you cannot easily guess the printer which was used.
Read a similar discussion recently. Even with paper you can prove your account balance at day X but if your bank lose your money at day X + n and you want it back they could still claim you withdraw all since day X and had an empty account at day of lose.
Look at the mixed case tests below. Always the same string but sometimes a palindrome and sometimes not.
Same for the trailing whitespace test.
Maybe it got tired at this point. Could also explain why the performance test is missing warmup :D
One source even mentions that a chess opening consists of 10 to 15 moves which would match your observation that the AI gets worse after that.
Maybe the AI would appear more competent again in the endgame since I assume there is more training material for that again.
A bit surprising that it provides illegal moves since it should have enough training material not "understand" the rules but apparently prefers to produce sentences which appear like chess moves from the training material without any connection to the rules.
Imagine you have a line containing
prefix 1234 suffix
and want to only grep the number but need to match prefix and/or suffix to not grep another unwanted number.Can be solved with
grep --only-matching --perl-regexp 'prefix \K\d+(?= suffix)'
The magic is '\K' which kind of resets the 'matched buffer'. [1] So anything before \K is matched but not outputted with -o (or without -o anything before \K would not be highlighted).And for the suffix: (?=) is a positive lookahead [2] which checks if, in this case, ' suffix' is found after the number but also does not include it in the 'matched buffer'.
So the output for
echo "prefix 1234 suffix" | grep --only-matching --perl-regexp 'prefix \K\d+(?= suffix)'
is only 1234
PS: instead of \K the prefix could also be wrapped in a positive lookbehind (?<=prefix )And regards tail. I think most users want tail -F instead of tail -f in most cases. Lowercase f follows the file descriptor while uppercase F follows the file name.
So with -f you can still follow a file if it is moved or deleted (but I can't imagine many cases where you want to follow a deleted file and someone continues writing to the deleted file).
With -F you can follow a file which does not exist yet (and will start following when it's created) or when a logfile is rotated continue following the new logfile.
> Note in particular the fact that words of unquoted parameters are not automatically split on whitespace unless the option SH_WORD_SPLIT is set; see references to this option below for more details. This is an important difference from other shells.
https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parame...
The example works the same in Zsh. (of cause with the slightly different for loop syntax)
for i in *; do echo "<$i>"; doneNot really. I just mentioned it because it was notably slower than ss. I did not actually measured it, just saw it when trying the example.
From my 4 points I wouldn't hold the first two alone against an AI driven suggestion. Only the last two, while not horrible bad or severe or anything, are (imo) notable downsides compared to the typical ss/netstat approach.
In this case the AI answer might be somewhat better for Mac. On Linux I have more often manually installed lsof than ss (iproute2). Maybe Mac provides the similar command netstat which is yet another tool to check ports
netstat -nltp | grep -P ':8000\b'
Regarding available tools. Another very common Bash question is how to get the directory the executed script is located. A common answer involves `readlink -f` which (as far as I know) does not work on Mac (without extra steps).¹ How to get current users name. Maybe whoami or id -un or logname or echo $USER or who -m or who am i (learnt this last one just today; apparently works with any combination of two arguments after 'who')
This is actually a question I'm now really curious what the AI would answer since there are so many different correct answers (apt? yum? zypper? pacman? xbps?) and no indication for the AI which is the correct one for the asking user.
PS: But thinking about it I might just ask the wrong questions. "How to install X on <distro>" should work.
The example in the project readme is imo already a bad example.
$ ai ask "Check process running on port"
Answer Command is `lsof -i tcp:8000`
Apart from the facts that- I would say the chances that lsof is installed are significant smaller than ss or netstat
- is lsof notably slower than ss
it is also inferior for the requested task because
- it returns any process connecting to this port not only the listening one. Which process is running on port 443 on my desktop? None. How many processes does 'lsof -i tcp:443` return? 20.
- it does not work if the listening process is from another user (if lsof is not run by root). In this case lsof -i returns nothing while ss -nltp returns the information that the port is listened and only cannot tell by which process because of missing permissions.
My answer to "which process uses port x"
ss -nltp sport = x