I sometimes think back fondly of the small automation scripts I wrote over the years, so I wanted to ask you: Which scripts, hacks & automations did you create that your're proud of? Personally, I e.g. built a bot to automatically answer apartment ads [1], a small script to run Borg backup once per day [2], and a small automation to track the temperature in my aquarium [3].
1: https://gist.github.com/adewes/c9b2a71457c6c6f01f2f
2: https://gist.github.com/adewes/02e8a1f662d100a7ed80627801d0a...
3: https://gist.github.com/adewes/7a4c20a5a7379e19d78ba54521d3d...
I'm still super proud of that because it was so much fun to create. I recall "releasing" the program to a handful of friends, and they all seemed to like it, but it never really went anywhere.
Deleted Comment
I'd never written a line of code in my life, so going through the iterative process of getting it functioning and fixing bugs was pretty invigorating. I could see where the generated code was going awry and describe it in natural language, and chatGPT would turn that into syntax and explain why it worked. Definitely a fun way to learn.
I'm sure it's ugly/inefficient, but here's the script:
https://pastebin.com/raw/DuAVAikD
Damn right it is! Writing scrapers is definitely the gateway drug of programming. It's such an exciting feeling to step across the boundaries from "passive user at the mercy of the UI" to "I can do anything if I can conceptualise it (and break it up into steps)".
I used to freelance when I learnt to code in college and I wrote many such small automation scripts for quite a few people. Looks like the AI is already taking away some jobs ;)
Dead Comment
[1]: http://karolis.koncevicius.lt/posts/fast_navigation_in_the_c...
It sure took me ages to figure it was CDPATH, but CDPATH it is. I won't retry without making that "cd @" thing a subfunction (that might involve making its own completion, but that's easy compared to debugging make... I still don't know WHY it broke, just that it's CDPATH that broke it -- it decided to duplicate the subdir arg when invoking a submake so make was now left with a weird unknown target, but it obviously wouldn't say that and just failed weirdly)
If all these causes the build to fail then the maintainers of that build should be informed.
This is useful for two things - 1) avoiding clashes with existing directories, 2) having a quick command to list all the bookmarks: cd @<tab>
[0] https://johnnydecimal.com/
I gave up on bookmarking so I now use an alias to quickly find what I am looking for with fzf and fd:
Deleted Comment
https://til.hashrocket.com/posts/xsavbhlrz4-shortcuts-with-h...
To my knowledge, this was the first "site-specific" browser extension, so I wrote a blog post about it:
https://www.holovaty.com/writing/all-music-guide/
Aaron Boodman saw my post and decided to generalize the idea; he created Greasemonkey, which was a single browser extension that could aggregate site-specific JS customizations. In the years since, this idea of "user scripts" has further developed, and I think some browsers even support the concept natively.
The way it would block ads is to analyze the files it was fetching for the browser and modifying found keywords, for a crude example all IMG tags with SRC containing the string ad.* would be replaced by gray images.
I also remember using it to "fix" a redesign of a site.
I'm not aware of any browsers that support it natively, although TBH there are so many random Firefox forks that any one of them could have just bundled the extension and called it native
I'm pretty sure AllMusic was my source of track lengths for albums. Back in the middle of high school (so just before that redesign maybe?), I had some java utility that (I'm sure I'm imperfectly recalling) I pasted track information into. It then generated the Wikipedia markup equivalent, and I went around editing album pages on Wikipedia adding track lengths (and total album length).
And that's why I have something over 1000 wikipedia edits made a long time ago.
While, whenever I have a new project/etc come up, I can just
And get a new, nice clean file, with the same backups and multi-device accessibility.Do you have a format in your text files to track when things are done, like a checklist?
In Org, you can give things states like "TODO", "INPROGRESS", "DONE", "CANCELLED", add checkboxes (like "[ ]" and "[x]"), have sub-tasks/lists, etc.
I have really gotten into Org, and I have found there are a few other checklist formats/programs in plain text. Just wondering how you do it.
$ cat << EOF > ~/.bash_profile
> alias lstd='ls ~/Dropbox/todo'
> EOF
Deleted Comment
Before I could register I could see most classes I wanted to take had plenty of availability except for one which was almost full. That class would make my schedule perfect (no classes before 10am, everything ending before 4PM, good teachers), so I was ready the moment my group got access. I logged into the janky Java applet and saw that my desired class was full. Dismayed, but not giving up, I refreshed the class list to see if someone might drop during the drop-add week. Nope, still full, but there was still time for someone to change their mind and for me to slip in. I was going to need an edge.
Another peculiarity of this system was that it was definitely a weird Java app based on some type of main frame. It must have been around for a decade at least. One of the signs of its age was that you had a limited amount of time per day during which you could be logged into the system, something like 90 minutes a day.
So I did what any good hacker would: I made _really_ good use of that limited time. I wrote an AutoHotkey script which would automatically log in, traverse all the menus and attempt to sign me up for that class. It was much faster than a human, so each run barely put a dent in my logged-in time allotment. As a cherry on top, I wired it up to a python script to push notify me if it succeeded.
After letting it run for two days, some false alarms, and tweaking, I got a delightful "You're registered!" notification on my phone and found that it had successfully gotten me the class I wanted. I'm still chasing that high to this day.
The problem was that it was essentially always used at the maximum because most people had such small jobs to run + other queues were not as efficient. Because of the inner "fighting", the HPC admin essentially blocked the possibility to have jobs pending. So first come first serve.
So basically I've set up a cron job to look prepare my jobs and look for empty slots during the night. I remember looking at results in the morning while sipping on coffee and the head of the lab congratulating me for my "dedication" as she saw I submitted jobs at 3AM!! :)
At the end of the internship, I basically had a script "assistant" that I would use to prepare the calculation jobs, unite them so I could use them on "bigger" queues, do most of the post-calculation analysis (essentially producing CSVs and graph for me).
And I am too, chasing that high to this day.
How do you use it? I don't see any PDF file paths?
We had great AP density so by the 2nd night I started working on an Expect script that would log in and boot 1 AP at a time per floor-building combo (multiple areas simultaneously), wait for them to come back, wait about 30 seconds, and move to the next AP on each floor. At first I did a dry run where the reboot was commented out and the "is it back yet" was delayed by a short timer to simulate a reboot delay + make sure the script would really run without a login timeout or something stupid. This would take a couple hours but it was better than taking everything down as clients under the specific AP being cycled would just roam and have a weaker signal for a minute (assuming the system had been booted the night before). We ran it the 3rd night in place of the mass reboot and watched it carefully. It went great so we left it to run every night. We had the nightly notice from an outage to a potential outage and stopped getting complaints because, except for a particularly unlucky laptop in a corner for 1 minute, nothing was really out of the ordinary. At this point we knew we were buying a brand new wireless system that fiscal year (already in the budget) so we ended up just riding the year out with this script.
In all it was a lame reboot script shorter than the table containing the lists of APs to boot 1 by 1 but it probably had more real impact than any fancier scripts/tools I made while I was there.