Live data from Hacker News

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

news.ycombinator.com

211–220 of 340 posts

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

#211

I ran an e-commerce business that used Australia Post for shipping. A few years ago, I was responsible for 90% of Australia Post's lost parcel/SLA refund customer service volume in one day. Before COVID, Australia Post had a "Next Day Guarantee" for parcels sent through their Express Post network. If the parcels didn't arrive the next day, customers could choose to get a prepaid satchel or their money back. To take a…

I'm not sure I understand. You submitted one year of late parcel requests in one go (presumably with the script), and then you had to manually select to 'get money back' or 'prepaid satchel'?

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

#212
post #161

Earlier quoted context omitted.

Since you have used several backup tools, I wonder which one you recommend.

Definitely Kopia. I was skeptical at first, it's a relatively new tool and not much is known about it (at least on HN) but it's uber-fast and compresses extremely well. Detection of duplicate blocks seems both more aggressive and faster compared to Borg and Restic. It's honestly a win on all fronts. It can sync to remote places -- which I don't care about as I have a local directory where it does its stuff and I then…

Thanks a lot for sharing.

I have been very happy with restic. It has worked flawlessly. The only thing missing from what I rather to have is error correction and asymmetric encryption.

I might look into Kopia when I have time. I was a bit worried that it’s newer and might be less reliable.

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

#213
I come across quips and insights that I want to remind myself of; including them in a random message of the day as a ZSH login message is the right amount of "flair" for me. But this is too noisy if it's a new random choice each time I open a shell. Using today's date as a source of randomness gives us a random choice that's the same all day long. So this is in my .zshrc:

    motd() {
        date +%D > /tmp/motd_seed
        sort -R --random-source=/tmp/motd_seed ~/Dropbox/motd.txt | head -n 1
    } 

    motd
```

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

#215
Had an ancient boiler in a poorly insulated house that would sometimes trip out until manually reset (flip the power off and back on), yielding a cold house and unhappy spouse.

Built a microcontroller driving a normally-closed relay to interrupt the power for 1 minute out of every 120. No more cold mornings. I later added temperature sensing, smarter resetting based on temperature (to prevent power cycling a working boiler), and a webserver to it: https://imgur.io/a/VM7nD74 (the graph is an SVG; everything was generated on the local ESP8266)

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

#216
I built a script that finds appointments at the citizens' office in Berlin. At first, it just collected stats. That was to test a theory that you have to check early in the morning (turn out it's false).

Finding an appointment is notoriously difficult, and people often depend on the results of those appointments to start their life here. So I built a UI for the script and put it online. Not just code on GitHub but a live website everyone can use. It uses websockets to wait for appointments from the script running on a server.

It's been live for almost a year now. Thousands of people got an appointment that way. I got the city's blessing to keep it online, albeit with a restrictive poll rate.

It's really cool to see people recommend the tool to each other, and to work directly with the city.

When I return from vacation, I want to ask the city to extend the tool, and also translate it to other languages.

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

#217
I've made 2 projects that I use everyday for several years now. Not sure if I'm proud really, but they are such useful tools in my daily life so I guess I should be!

One is a RSS feed reader (GORSS) for the terminal that I use to always be up to date with stuff that interests me. The other is a simple todo-list that I use for work, shopping etc (DoIT).

https://github.com/lallassu/gorss https://github.com/lallassu/doit

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

#218
It’s a fish function but would be easy enough to translate to bash. It opens my diary, with an optional day offset. It creates the entries with a nice file structure so it’s easy to browse without the command too. I have years of memories captured that I otherwise wouldn’t have bothered with thanks to this script.

`diary` opens the entry for today

`diary -1` opens the entry for yesterday

`diary -365` opens the entry for a year ago

https://gist.github.com/bspammer/12d6b4a8049c69c832df7c4fd1d...

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

#219
post #206

my favorite is a little command line helper called “o”. it’s a helper for copy and rename commands. If I want to edit a misspelled filename I can just type o mv mispelled.txt and it will make an interactive prompt that looks like: mv mispelled.txt mispelled.txt_ but the last word is editable, so I can use the arrow keys to alter it in place https://github.com/jes5199/o

btw there is a bash feature that you can use for this touch a_tset_file.txt mv a_t{se,es}t_file.txt it works for changing file extensions: touch foo.txt mv foo.{txt,json} or for adding or removing characters, just leave the other side of the comma empty touch foo.txt mv foo{,bar}.txt mv foo{bar,}.txt

This is a really clever use of glob expansion.

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

#220

Honestly, the script/hack/automation I'm still most proud of is from around 1983, when I was 12 years old, for my Commodore 64. Back then, all computer communications were over the phone line, and in my house, we only had one line, so I spent a lot of late nights, dialing into BBSs, often not going to sleep until the sun came up. Then, I would get in trouble at school for falling asleep in class. So I came up with a…

When you were 12? Wow.
Post reply on HN