It's weird how the circle of life progresses for a developer or whatever. - When I was a fresh engineer I used a pretty vanilla shell environment - When I got a year or two of experience, I wrote tons of scripts and bash aliases and had a 1k+ line .bashrc the same as OP - Now, as a more tenured engineer (15 years of experience), I basically just want a vanilla shell with zero distractions, aliases or scripts and use…
Given the nature of current operating systems and applications, do you think the idea of “one tool doing one job well” has been abandoned? If so, do you think a return to this model would help bring some innovation back to software development? Rob Pike: Those days are dead and gone and the eulogy was delivered by Perl.
Scripts I wrote that I use all the time
301–310 of 408 posts
Re: Scripts I wrote that I use all the time
#302It's weird how the circle of life progresses for a developer or whatever. - When I was a fresh engineer I used a pretty vanilla shell environment - When I got a year or two of experience, I wrote tons of scripts and bash aliases and had a 1k+ line .bashrc the same as OP - Now, as a more tenured engineer (15 years of experience), I basically just want a vanilla shell with zero distractions, aliases or scripts and use…
The moment of true enlightenment is when you finally decide to once and for all memorize all the arguments and their order for those command line utilities that you use at an interval that's just at the edge of your memory: xargs, find, curl, rsync, etc. That, plus knowing how to parse a man file to actually understand how to use a command (a skill that takes years to master) pretty much removes the need for most ali…
Re: Scripts I wrote that I use all the time
#303Earlier quoted context omitted.
I need this *so* often that I programmed my shell to execute 'cd ..' every time I press KP/ i.e. '/' on the keypad, without having to hit Return. Other single-key bindings I use often are: KP* executes 'ls' KP- executes 'cd -' KP+ executes 'make -j `nproc`'
How? Readline macros?
Re: Scripts I wrote that I use all the time
#304Re: Scripts I wrote that I use all the time
#305I've written on this before, but I have an extensive collection of "at" scripts. This started 25+ years ago when I dragged a PC tower running BSD to a friend's house, and their network differed from mine. So I wrote an @friend script which did a bunch of ifconfig foo. Over time that's grown to an @foo script for every project I work on, every place I frequent that has some kind of specific setup. They are prefixed wi…
Slightly related but mise, a tool you can use instead of eg make, has “on enter directory” hooks that can reconfigure your system quite a bit whenever you enter the project directory in the terminal. Initially I was horrified by this idea but I have to admit it’s been quite nice to enter into a directory and everything is set up just right, also for new people joining. It has built in version management of just about…
MISE_ENV=testing bun run test
(“testing” in this example can be whatever you like)
Re: Scripts I wrote that I use all the time
#306> alphabet just prints the English alphabet in upper and lowercase. I use this surprisingly often (probably about once a month) I genuinely wonder, why would anyone want to use this, often?
var alpha_lu = "abcdefghijklmnopqrstuvwxyz";
Typing it out by hand is error prone as it's not easy to see if you've swapped the order or missed a character.I've needed the alphabet string or lookup rarely, but I have needed it before. Some applications could include making your own UUID function, making a small random naming scheme, associating small categorical numbers to letters, etc.
The author of article mentioned they do web development, so it's not hard to imagine they've had to create a URL shortener, maybe more than once. So, for example, creating a small name could look like:
function small_name(len) {
let a = "abcdefghijklmnopqrstuvwxyz",
v = [];
for (let i=0; i
Dealing with strings, dealing with hashes, random names, etc., one could imagine needing to do functions like this, or functions that are adjacent to these types of tasks, at least once a month.Just a guess on my part though.
Re: Scripts I wrote that I use all the time
#307Earlier quoted context omitted.
Other examples where native features are better than these self-made scripts... > vim [...] I select a region and then run :' !markdownquote Just select the first column with ctrl-v, then "i> " then escape. That's 4 keys after the selection, instead of 20. > u+ 2025 returns ñ, LATIN SMALL LETTER N WITH TILDE `unicode` is widely available, has a good default search, and many options. BTW, I wonder why "2025" matched "…
> `unicode` is widely available It's not installed by default on macOS or Ubuntu, for me.
$ unicode
Command 'unicode' not found, but can be installed with:
sudo apt install unicode
and it did. So it really was available. That's Debian 11.Re: Scripts I wrote that I use all the time
#308Regarding the `line` script, just a note that sed can print an arbitrary line from a file, no need to invoke a pipeline of cat, head, and tail: sed -n 2p file prints the second line of file. The advantage sed has over this line script is it can also print more than one line, should you need to: sed -n 2,4p file prints lines 2 through 4, inclusive.
Re: Scripts I wrote that I use all the time
#309It's weird how the circle of life progresses for a developer or whatever. - When I was a fresh engineer I used a pretty vanilla shell environment - When I got a year or two of experience, I wrote tons of scripts and bash aliases and had a 1k+ line .bashrc the same as OP - Now, as a more tenured engineer (15 years of experience), I basically just want a vanilla shell with zero distractions, aliases or scripts and use…
man, i couldn't live without alias ..='cd ..' or alias ...='cd ../..' to this day, i still get tripped up when using a shell for the first time without those as they're muscle memory now.
Re: Scripts I wrote that I use all the time
#310I have used it to build an "escmd" tool for interacting with Elasticsearch. It makes the available commands much more discoverable, the output it formats in tables, and gets rid of sending JSON to a curl command.
A variety of small tools that interact with Jira (list my tickets, show tickets that are tagged as needing ops interaction in the current release).
A tool to interact with our docker registry to list available tags and to modify tags, including colorizing them based on the sha hash of the image so it's obvious which ones are the same. We manage docker container deploys based on tags so if we "cptag stg prod" on a project, that releases the staging artifact to production, but we also tag them by build date and git commit hash, so we're often working with 5-7 tags.
Script to send a "Software has successfully been released" message via gmail from the command-line.
A program to "waituntil" a certain time to run a command: "waituntil 20:00 && run_release", with nice display of a countdown.
I have a problem with working on too many things at once and then committing unrelated things tagged with a particular Jira case. So I had it write me a commit program that lists my tickets, shows the changed files, and lets me select which ones go with that ticket.
All these are things I could have built before, but would have taken me hours each. With the GenAI, they take 5-15 minutes of my attention to build something like this. And Gen AI seems really, really great at building these small, independent tools.