r/ProgrammerHumor • u/RideNatural5226 • 1d ago
Meme typaShiClaudeGivesYouForASimpleMonitoring
186
u/ThaBroccoliDood 1d ago
love putting words in the terminal
sort -rn
rm -fr
journalctl -ball
43
22
12
u/acceleratedpenguin 1d ago
ss -tunapls
(I think I heard about this one from Julia Evans weekly email)
1
27
291
u/djbarsone 1d ago
Just rename this sub AIcirclejerk already
158
u/Cutalana 1d ago
might as well rename the entire field that too
52
u/Kooshi_Govno 1d ago
this but unironically
6
u/einzweidreihorn 1d ago
Might aswell get a pay increase out of it. I'm an AI engineer now, software engineering is for dinosaurs.
15
0
u/pagraphdrux 11h ago
Is this not criticism of a.i. or do ya'll think this is genuinely a good way to monitor something?
18
11
u/Spare-Subject-796 1d ago
just did the same a couple of minutes ago for my influxDB exited when it should not have
11
u/ZunoJ 23h ago
Looks more or less fine to me
10
u/Jimmyfartballs 22h ago
no it's not less it's head
1
u/adamantium4084 21h ago
Yea, less >= more and isLessOrMore() != head You could '<command> | head | less' If you wanted..
11
31
u/-Redstoneboi- 1d ago edited 1d ago
"damn bro i'll let you use python at this point"
all these linux cli tools are so stringy, would definitely much rather have standardized apis for them
17
u/rosuav 1d ago
That's fundamental to shell scripting. It's always very stringy. There are a few shell languages that took the leap to become applications programming languages (I spent a lot of my time in the 1990s writing REXX code, for example), and they will always be that bit different from "classic" programming languages.
0
u/-Redstoneboi- 1d ago edited 1d ago
i'm really just saying i dont like strings in general
my favorite language is rust so i can and will strongly type everything by pure instinct rather than by logic even when scripting languages are objectively more convenient for these tasks
i like micro optimizations and overvalue it a lot more than developer time so i generally dont like the very idea of multiple regex passes and string operations/allocations even if in practice it takes a few milliseconds to run (if even that) every hour
3
u/rosuav 1d ago
That's fair! It's often the wrong tradeoff to make, but I definitely understand the mindset. Personally, I tend to prefer languages with richer data types (lacking support for first-class arrays can seriously hamper a language), but there are a lot of conveniences to the simplicity of shell languages.
1
u/-Redstoneboi- 1d ago
i also have some uh, opinions regarding regex and vim's default keybinds
so many things that "work and work well but aren't perfect for my specific definition of perfect"
i feel like the new kid walking into the scene going like "damn y'all live like this?" and being basically the only one in the room to (outwardly) think this way while everybody is busy doing their actual job
i'll probably look around for "regex with macros" and other text editors like kakoune and emacs before i make another competing standard
2
u/rosuav 1d ago
Oh look, everyone has opinions about regex. Most of them have at least some merit. The minilanguage is so extremely compact and then has to get extended in so many directions. Ugh. Don't worry, you are not the only one to think that way.
TBH I wouldn't reach for a regex for most parsing, unless it's the only real option available in the context I'm working in. Whenever I can, I prefer sscanf parsing instead. The main reason is to avoid backtracking (yes, occasionally that means sscanf is a poor choice, but OTOH you never have the catastrophic performance that a regex can suffer from), but also I prefer the syntax.
15
u/Banes_Addiction 1d ago
The fun thing about the "stringy"ness is it's really quick and simple. You can just build up a pipeline in real time looking at the output of each thing, and not really worry about anything (or even really look anything up).
No API, just a very simple set of operations with easily human readable output every step of the way.
If you look at that,
journalctlis the only tool that does something specific/uncommon. Everything else is the equivalent of a standard library function.This is what I'd consider an "aeroplane skill", ie easily doable without an internet connection.
0
u/-Redstoneboi- 1d ago
from my perspective, this is just a repl but with only one type
correct me if i'm wrong but isn't that basically what bash is
it's awesome that they figured out this kind of workflow from a long long time ago, but things are absolutely not optimal the way they are now. they are simply the most backwards compatible, universal, and thus generally least headache-prone ways of doing things.
1
u/Banes_Addiction 23h ago
I mean, yeah? A terminal is a REPL loop.
The thing about a shell is that it's designed to be something different than a "real" programming languange, right? It's a way to interact with the OS, and all that stuff is front and centre. Strings and files are the natural "units".
Of course you can do all this stuff in a Python interpreter if you want, it just takes way more typing.
A shell one line is a neat little "here's a thing that needs doing, it needs a few simple steps, just get them out the way". I guess the python equivalent would be a list comprehension.
1
u/-Redstoneboi- 23h ago edited 23h ago
i guess the difference is that in python, the syntax is
command, arg2, opt=val)while in bash it'scommand arg1 arg2 --opt valand you can pipe things.very convenient, with the catch that you have only one type to work with. someone suggested i take a look at nushell and that's pretty much what i envisioned. just a language with real types, a repl, and convenient default parse/tostring implementations for every type.
user readability doesn't clobber the exact values of the data. you don't have to lose information or re-parse whatever the last program outputted, if it's compliant. the number "10,552 bytes" can show as "10kb" since both are just the same mumber displayed differently.
6
5
u/SirBanananana 1d ago
all these linux cli tools are so stringy, would definitely much rather have standardized apis for them
Then you'll love nushell
2
1
u/gregorydgraham 12h ago
This is a humour subreddit, porn is not allowed.
Use r/ProgrammerPorn instead
2
u/Ok-Dimension-5429 22h ago
I mean you can go use PowerShell if you want. Commands return objects. It's a pain in the ass though. Strings work fine.
6
9
9
u/snarkofagen 1d ago
Beats having to write shit like that by hand like we had to do in the olden days.
6
13
u/gsaelzbaer 1d ago
That’s not even a crazy command with basic UNIX/Linux knowledge.
I’d be more worried about you, if you vibe code stuff in a domain that requires this command, and don’t understand it.
5
u/Cobracrystal 1d ago
tbf i think you can compress it? surely you can just get both results at the same time and censor data in the output instead of running two journalctl commands
9
u/gsaelzbaer 1d ago
Not saying it’s not overly verbose 😄 LLMs usually don’t come up with the most compact solution. But that command‘s intent is not _that_ hard to parse
10
u/coffeeicefox 1d ago
Okay mate, everyone knows your a big bad coder, chill out.
Of course every command is simple, and if you take the time to read it you can make sense of it, It's the construction of the whole script in a nano second using tools you've not used for that project or in a while and it's moved onto the next task producing a similar output before you can even process what happened in the first one that causes the shock to your current mental model of what you're working on.
e.g, The agent is running a basic SQL command and parsing into another data structure to run sed with a mad regex on it rather than writing a decent SQL query which you would have done previously.
2
5
1
1
u/explodedcheek 1d ago
This is what I thought regex final boss would look like...but it's just code for monitoring logs lol.
1
u/Express-Acanthaceae9 1d ago
Claude finds interesting ways to reduce filling context with output from these kind of commands
1
1
1
u/20220912 23h ago
I'm an SRE, and this is, like, a typical Tuesday morning, not anything exotic. It's not even 'code', it's just a series of log dumps and filtering. No conditionals or looping anywhere.
1
u/chickey23 22h ago
I told you we should have put a no robots at the start of the crontab. Now they are stealing all of our pipes!
1
1
1
1
1
1
1
u/burnttoast12321 1d ago edited 1d ago
It's using bash to it's peak. Love to see it. This is why AI has an advantage.
Not even kidding. The most productive I've ever felt was when using bash in Unix. Don't even get me started on how great it feels to write Regex without looking up the syntax! Wish I still could. Been a good 10 years since I've touched it.
People probably think I am kidding but AI using bash to configure systems to deploy to AI is a huge deal.
There have even been a few new Linux distros that have come out from this in the past few weeks.
We know AI is decent at coding. If it can configure systems or even bigger networks we are in for some big changes...
I wish DraftKings had a bet to say that system integration AI is the winner. Once integrated it has full control. (Not saying we can't it shut) but at this point it has system controls, coding abilities and can just keep improving.
More hardware tech may be required but this is all happening pretty fast.
0
u/iamfab0 1d ago
Is this really best practice or can they sell more tokens by generating inflated code?
10
u/dcondor07uk 1d ago
This is most likely just a quick one-liner for Claude to run when troubleshooting a system. It identifies which services are generating the most errors, normalizes variable values (like replacing hex values with <hex> and long IDs with <id>) so similar errors can be grouped together, then displays the five most common error patterns.
So regarding your point about “selling more tokens,” I’d actually argue the opposite. This is an extremely compact and efficient way to accomplish the task. Rather than having Claude break the process into multiple steps, inspect logs individually, or write a more elaborate Bash script following some arbitrary coding conventions, it can do most of the work in a single command.
All those extra steps would take more time and, more importantly, more tokens. If anything, this is an example of minimizing token usage, not inflating it.
1
u/E-M-C 1d ago
I hate that I can recognize ChatGPT's style in this comment
2
u/dcondor07uk 23h ago
You are absolutely right to push back on that. It was an oversight on my part and I apologise for the inconvenience.😂
1
u/E-M-C 23h ago
I wasn't calling you a bot, just saying that, even if accurate, you comment was written by ChatGPT :p
1
u/dcondor07uk 23h ago
I know, second language issues
I used gpt to make it clear and meant as a satire😂
3
u/Ok-Dimension-5429 22h ago
Claude is going to read the results of this command. It's better to have a complicated command which gives a short output than a simple command which gives a long output, if you want to reduce tokens.
1.3k
u/Welcome-To-NBA-Jam 1d ago
What I love about Claude-generated code is that it finds a way to usefully use that one function in your language you never knew existed and have never seen code that ever uses it in your 20 year career, but someone out there made that function 40 years ago, and Claude decided today was the day for it to shine.