Live data from Hacker News

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

news.ycombinator.com

71–80 of 340 posts

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

#73
I wrote a quick integration to the GPT-3 API to Emacs [0]. Although it's a very simple implementation, it's made many small things I would've previously done manually much quicker (ie - one-off calls to convert a hyperlink in X format to markdown; abbreviate first names of author lists of papers; convert some "text message speak" messages into a paragraph).

[0] https://github.com/samrawal/gpt-emacs-macro

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

#74

I have a script listed in package.json for my site. Often I don't really care about commit messages here, not because I don't find them valuable, but because so often its from editing and publishing articles. I don't really want to think of messages all the time so often end up typing random crap. I use this now: import { execSync } from 'child_process'; execSync('git add -A'); const modifiedFiles = execSync('git sta…

Ooo that's nasty... I love it! Much better than "Changes", "Update" or "WIP".

This is exactly why I made it, in fact a lot of commits in there are wfwefewf, frefrregre, stuff, wefewfwwefew

Every time I'm tempted to figure out how to squash/collapse the entire history down to a single commit and then always use that script.

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

#75
Have a few little scripts in my public [1] dotfiles repository. One of my favourites is

    git-clean-squashed
Which finds all squash-merged branches in the current Git repo, and warns you before deleting!

https://github.com/benwinding/dotfiles/blob/master/bin/git-d...

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

#76
post #64
post #41

If you add a .CMD file as the first entry in a .ZIP, with compression set to "none", you can rename and run the .ZIP as a .CMD, because the PK header will be treated as a nonexistent command and execution will continue after that. With a little imagination and some PowerShell I've made that into a self-extracting archive. It's a dirty hack, but I've had it working in production for years now. I want to see if I can m…

If you run a "cls" as first command in the batch file no one would notice the invalid command of the PK header either (and not get possibly confused).

Right now I'm just using the PowerShell part to move the cursor up and to the left and delete it. You can still see the PK$#@($!!!1 for a nanosecond, but that just gives it character in my opinion.

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

#77
Just grokked a couple of hours and pushed out a script that does very limited yaml to dbt "transpiling". Basically we are moving from a yaml based Airflow solution to another with dbt support. There are a hundred of jobs to migrate so I figured some automation is needed. It doesn't cover every situation but I estimate it can save 50% of efforts at least.

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

#79
post #7

All of my favorite things are little AutoHotkey shortcuts. I have several that basically just execute a Regex replace on whatever text is currently highlighted. It's ridiculously convenient to just have those functions ready to go any time. But I started accumulating so many of them, it got to be a problem just remembering all the ones I had and how to trigger them. I had to start finding new ways of keeping them all…

I'm approaching your threshold of "I started accumulating so many of them, it got to be a problem just remembering all the ones I had and how to trigger them" Can you share a repo with your "custom right-click menus and Emacs-style keychords" to save me some time? Love hacker news!

Sure, here's a Gist for each one:

- Key chords: https://gist.github.com/CFiggers/ccb6bc911ee87f423f558368128...

- Right-click menus: https://gist.github.com/CFiggers/96bc37ca468909c9ec83252144c...

Let me know if you have questions. Enjoy!

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

#80
One of my favorite spa/hotels for a weekend retreat for my wife and I has absurd waitlists — takes a few months typically to reserve 2 nights. However, they have a 7 day cancellation policy that leads to a U shaped availability curve for rooms.

The hotel website itself is inordinately difficult to search more than 1-2 nights (each day takes 6-8 clicks to search), but it’s all queryable through an undocumented API, so I wrote a small CLI tool in Crystal that can scan the next 60-90 days (configurable, of course) to see if there have been any sudden openings.

It does it all in parallel, so I can find out within about 10 seconds if there are any rooms available within a 30 (or longer) day range.

It’s already helped booked one wedding anniversary trip and one special getaway for 2 friends. I don’t use it often, but it’s wonderful to have around.

Post reply on HN