Live data from Hacker News

Ask HN: Small scripts, hacks and automations you're proud of?

news.ycombinator.com

181–190 of 340 posts

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#181

Maybe this already exists somewhere and I don't know about it ... Anyway, when working on feature branches I wanted a quick way to switch to master, pull, switch back and finally rebase. So I made a little script ( https://gist.github.com/lelanthran/6c9bd1125f89e7621364878d1... ) that pushes the current branch name onto a stack before switching to a new branch, and allows me to switch back to the topmost branch on th…

   g co master
   g fetch
   g rebase
   g co -
   g rebase -
Where ’alias g=git’ and ’g config alias.co=checkout’

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#182
In college we had a class registration system that was first come first serve and enrollment started at 6am or something. I created a small script in selenium to automate this so all I had to do was have my laptop running and at 6am it would sign into the portal and grab up my classes as fast as possible.

This ended up always making sure I got into the section I wanted.

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#184

Earlier quoted context omitted.

Was the hotel in NZ? And do you work on a three headed beast?

No, and - not sure I understand the question - but most likely, also no.

I think it's a reference to New Zealand's Managed Isolation and Quarantine system during the pandemic. Demand was far higher than availability (and quarantine was mandatory to return home from overseas), so at some point someone wrote a script to book rather than just hitting refresh. Soon, everyone was using it and they were forced to move to a lottery system instead.

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#185

Earlier quoted context omitted.

Was the hotel in NZ? And do you work on a three headed beast?

No, and - not sure I understand the question - but most likely, also no.

A colleague of mine built almost the exact same hack to reserve a hotel in nz mid last year, I was wondering if you were him

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#186
One sillier one I look back fondly on was an undersea themed email signature generator I wrote maybe 20 years ago or so.

I think it was a Perl script connected to a named pipe or similar, so whenever my mutt client read it I got a new sig.

It generated 4 lines of an ASCII art underwater scene, containing a randomised selection of different fish, sharks, boats, seaweed, crabs, rocks, shells, treasure chests, etc.

There was a bunch of code to ensure no overlap, and more natural looking scenes.

There were also certain things that only triggered on certain special days of the year (Christmas etc.), and others that only appeared in conversations with people I'd exchanged more than N emails with.

Sadly it went away when my email client moved to be primarily web based.

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#187
I once hacked a daily retail data polling script to simply make it carry out retries on failed polls. It succeeded about 80% of the time on retry.

This saved me on avg about an hour a day of manually remoting into retail store systems to gather sales and stock data for the central system processing.

That was a good feeling, and was so simple.

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#188
Back in the modem days, I tapped into the pins between my modem and computer’s serial port and put a speaker between RX and GND, with a switch of course so I could turn it on and off.

When on, it would make data noises at a reasonable volume indicating the current bandwidth usage. If a download got stalled, it was obvious even if I didn’t have that window in the foreground, or wasn’t even sitting at the computer.

Also, different kinds of data had different sounds and cadences, and I got used to many of them. It was fun to hear an email coming in before my sound card officially announced it.

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#189
I used to run a site for tutorial screencasts. My "video workflow" involved recording, adding an intro and outro, transcoding to multiple formats and finally uploading the videos to the Internet Archive.

I automated everything except the actual recording using a Makefile that's over here https://gist.github.com/nibrahim/2466292. I think I added some sox commands to clean up audio too in a later version but lost the file.

Another one I did was a small script to create ruling sheets for calligraphy. It's a tedious process by hand and having a script create a PDF based on nib width is a great time saver https://github.com/nibrahim/Calligraphic-Rulings

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#190
post #23

So certainly not impressive, and morally ambiguous, but when chatGPT first released, I worked with it to create a python script that crawled The New Yorker sitemaps, found articles with embedded audio versions, downloaded the mp3 by reconstructing the file url using the article ID in the page source, and then renamed the file to match the page title and saved it to a well structured Google Drive directory. Now when I…

"going through the iterative process of getting it functioning and fixing bugs was pretty invigorating." 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)".

Completely agree. It's often the first "real program" I give to my students when I teach coding and all of them love the high of doing it.
Post reply on HN