275 points · by ingve · 2y ago · 54 comments
My fav option in this class of apps: https://lnav.org/ It lets you use journalctl with pipes as requested here: https://github.com/Textualize/toolong/issues/4
- System tool niche that I find interesting so it's nice to see a fairly complete and yet relatively small project
- Textual seems to be their largest dependency, but other than that the project seems self-contained and relies on the standard library
- With some exceptions, the majority of methods are short and easy to parse
- Typing support :)
But after a second glance it looks very well written compared to many other python projects, which sometimes read like a 5000 line bash script.
And I can't argue against your arguments, especially using "minimal" dependencies and using typing.
Typing often helps for autocompletion and understanding what a variable/function "means", which makes it [1] easier to start hacking on it.
[0] not necessarily bad, just wasn't what I would expect to be a small reference project
[1] not always, sometimes types can be too verbose and start messing with your brain ;)
I appreciate the work you are doing by dogfooding textual and how consistent you (or your team, I didn't know there was more than one person behind it) have been.
I just wanted to say thanks so yeah, Thanks!
Or some other similar reminder -- perhaps just a list of things you're going to install when you need them, so you don't install them until you have a use.
(I have this problem too)
Usually I don’t even need the reminder, just writing it down is reminder enough.
alias tail='echo "use toolong instead"
Now using tail to view logs will print that reminder instead.You might want to open an issue on the repo.
I had to replace line 4 of a 200 GB SQL dump, it took a substantial amount of compute time to perform a find / replace with sed and it also required having over double the disk space since sed creates a temp file before it writes out the new file.
Using a hex editor could have worked but it seemed too risky because data integrity was really important.
Hold it like so:
seek=$bytes-offset-until-line-4 conv=notrunc,sync
Enjoy responsibly :) head -n4 sqldump > sqldump2
Then change the line 4 in sqldump2 to whatever you wanted to, and after that: tail -n+5 sqldump >> sqldump2
And now sqldump2 contains sqldump but with line 4 edited.This still requires double the disk space, but at least shouldn't take 30 minutes.
YMMV, but I just reproduced this on my machine, and the tail command took 3 minutes. Maybe you are limited by disk IO?
What was the sed command you used?
EDIT: sed was even a bit faster with:
sed -i '4s/^.*$/your line four/' sqldump
Took 20s less than my tail solution, and does not occupy duplicated disk space.I don't remember exactly how long it took but I remember it being something like 30 minutes of purely waiting for the find / replace to finish on a 4 CPU core / 8 GB of memory machine. Memory wasn't an issue fortunately.
The syntax escapes me at the moment, but I'm quite sure I've used sed (or maybe awk?) in the past to do exactly that
Didn’t find this in the help/GitHub readme…