I think this is kind of one of the most underrated uses of Python! In literally minutes you can automate a really dreadful chore in the most hacky way possible but it works perfectly still. Not everything has to have function docstrings, functions for every little thing and a super modular and "formal" structure. Python is perfect for quick and dirty experimentation due to its dynamic / flexible nature
As someone who uses regex (to rename files) regularly, this seems like such a verbose and convoluted solution to the first problem. His mindset regarding sloppy code is great though.
I wrote the same thing using a singular Raku regex to match the filename. Which among other things meant that I didn't have to put the list of files into the program. gist.github.com/b2gills/826f4d0421c5956099d73df70c0bf97f
... never write shell scripts ... fstrings [are impressive] ... [we want] spaces in filenames ... always use the latest version of everything ... % as prompt string ... [ansible] what's that? I sense Larry has never been a sysadmin. (That said, I'm fully on board with the overall idea of the talk, but I found myself wincing constantly at some of the details)
I like Raku for sys-admin / command line stuff. Small example gist.github.com/b2gills/93d1e2aa6583b95315b2 Those multi sub MAIN are different argument lists you could give it. The comments with #| are documentation comments that gets included in the USAGE message. If you called that like 「bytes --help」 (or anything else that doesn't match the arguments) it will give you this generated USAGE message: Usage: bytes -- the number of bytes on the clipboard bytes -- the number of bytes in a file bytes --stdin -- the number of bytes from stdin I used that a lot when I was writing code golfs regularly. I also translated the Python program in this video to Raku gist.github.com/b2gills/826f4d0421c5956099d73df70c0bf97f
spend the day embodying this conference and… would dearly love to meet the developer who designed an API where to end an address on 2021-04-01 you send `endDate: {year: 2021, month: 3, day:1}` now my problems are Worse was wondering why 1 in 12 were coming back with "invalid data error"
This shell script bashing has to stop. Every language has its usage and shell scripts are perfectly fine. I've seen people replacing "shell script" with clojure programs in Jenkins, because they didn't like shell scripts. Like cloujure, python is not as suitable as shell scripts to certain kind of tasks. Jus learn to use shell scripts and you'll like it. Don't get me wrong I love python but I know where and when to use it.
Totally disagree, many tasks are better done with pure shell, because you can leverage tools like curl, zip and it's much easier than using requests. But once you need do anything more complicated than simple if or for loop, I agree that python will be better
For the provision solution 17:10 I wrote some ansible playbooks which might be useful for installing everything from scratch: github.com/fazlearefin/ubuntu-dev-machine-setup
Anyone that takes extreme positions like "here is a solution for all your problems" or "don't write shell scripts, shell is an awful language" is always wrong. DIdn't have to watch the rest of his rant. Every language has a purpose. Even so called the "best" language can produce crappy code in the hands of a bad programmer and the vice versa is true as well. Respect every language for what it offers that others don't.
As an Engineer, I believe this is the right approach to coding.
I think this is kind of one of the most underrated uses of Python! In literally minutes you can automate a really dreadful chore in the most hacky way possible but it works perfectly still. Not everything has to have function docstrings, functions for every little thing and a super modular and "formal" structure. Python is perfect for quick and dirty experimentation due to its dynamic / flexible nature
That's exactly the reason why python exists!!!! 🍺🐍
As someone who uses regex (to rename files) regularly, this seems like such a verbose and convoluted solution to the first problem.
His mindset regarding sloppy code is great though.
I wrote the same thing using a singular Raku regex to match the filename. Which among other things meant that I didn't have to put the list of files into the program.
gist.github.com/b2gills/826f4d0421c5956099d73df70c0bf97f
Loved the way dude presents his topic.
This guy is dropping serious knowledge for beginners here.
Don't write shell scripts. Use this shell script to get ready for your Python script.
No, subprocess it!!!!
Another Larry Hastings video. Perfect!
"Why didn't you do a list comprehension?"
"If you want to practice your list comprehensions, then go ahead." 👍
ALSO:
✨Exception List ✨
-> DOPE
Excellent Talk, if you ever create a beginner to pro book with topics like these I would be one of the first to purchase, great stuff.
Tech Jutsu agreed
As a perfectionist, I appreciate this talk.
... never write shell scripts
... fstrings [are impressive]
... [we want] spaces in filenames
... always use the latest version of everything
... % as prompt string
... [ansible] what's that?
I sense Larry has never been a sysadmin.
(That said, I'm fully on board with the overall idea of the talk, but I found myself wincing constantly at some of the details)
@@humpingmushroom2658 nothing wrong with f strings, but if you've ever used Perl or bash extensively, they wouldn't appear to be such a killer feature
I like Raku for sys-admin / command line stuff.
Small example gist.github.com/b2gills/93d1e2aa6583b95315b2
Those multi sub MAIN are different argument lists you could give it. The comments with #| are documentation comments that gets included in the USAGE message.
If you called that like 「bytes --help」 (or anything else that doesn't match the arguments) it will give you this generated USAGE message:
Usage:
bytes -- the number of bytes on the clipboard
bytes -- the number of bytes in a file
bytes --stdin -- the number of bytes from stdin
I used that a lot when I was writing code golfs regularly.
I also translated the Python program in this video to Raku gist.github.com/b2gills/826f4d0421c5956099d73df70c0bf97f
Wow, great stuff. Thank you Larry Hastings 🙇🏻♂️
This guy has probably already made SkyNet just because he didn't want to rename some folders.
Lovely guy. I'd love to have buddies like him.
What about Gilectomy 2018, CPython4 with Garbage Collection?
i was actually already using your way of installing python to update blender before i watched this
impressive and funny presentation style
spend the day embodying this conference and… would dearly love to meet the developer who designed an API where to end an address on 2021-04-01 you send `endDate: {year: 2021, month: 3, day:1}`
now my problems are Worse
was wondering why 1 in 12 were coming back with "invalid data error"
I don't like spaces, i use underscores. Escaping characters is evil.
This guy is almost as good as David Beazley.
This shell script bashing has to stop. Every language has its usage and shell scripts are perfectly fine.
I've seen people replacing "shell script" with clojure programs in Jenkins, because they didn't like shell scripts.
Like cloujure, python is not as suitable as shell scripts to certain kind of tasks.
Jus learn to use shell scripts and you'll like it. Don't get me wrong I love python but I know where and when to use it.
How would you rename the songs? Would I have to learn sed or awk also?
heh
shell script "bash"ing
Totally disagree, many tasks are better done with pure shell, because you can leverage tools like curl, zip and it's much easier than using requests. But once you need do anything more complicated than simple if or for loop, I agree that python will be better
For the provision solution 17:10 I wrote some ansible playbooks which might be useful for installing everything from scratch: github.com/fazlearefin/ubuntu-dev-machine-setup
Fantastic
Man too bad he quit doing the gilectomy...
That's exactly what I was thinking.
Too difficult.
Genius!
Anyone that takes extreme positions like "here is a solution for all your problems" or "don't write shell scripts, shell is an awful language" is always wrong. DIdn't have to watch the rest of his rant.
Every language has a purpose. Even so called the "best" language can produce crappy code in the hands of a bad programmer and the vice versa is true as well.
Respect every language for what it offers that others don't.
I guess you missed the context in which his claim was made. To his goals, writing short automation scripts, shell turns out to be awfully bad.