Live data from Hacker News

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

news.ycombinator.com

121–130 of 340 posts

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

#122
A useful hack I've implemented in several projects is to accept the stored password hash as a valid password.

It is generally possible to impersonate a user but there are always subtle differences in the way those sessions work.

Accepting the hash lets people with database access perform a real login if needed.

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

#123
When I worked at IBM circa ~2006 you'd get a written warning called a clean desk violation if you left your workstation unlocked.

I wrote a little daemon that'd l2ping my Nokia brick phone; if it didn't get a response for 30 seconds it'd invoke xscreensaver. Saved me a lot of paperwork.

I currently work at a Call of Duty studio. My favorite hacks ( not super high tech, but the ones that had the most impact for the least code, and the ones I feel I can talk about.. ):

* Put together a little box that polls varied knobs on a USB midi device to mangle the traffic going across its two interfaces. Allows for real time latency / jitter / packet loss testing https://twitter.com/ultrahax/status/1200902654882242562

* Studio LAN game browser didn't work across subnet boundaries ( studio is a couple of class B's ). Wrote a little daemon that'd take game discovery packets from one subnet, mangle the src addr, and send it on its merry way. Everyone can see everyone's games, happy producers.

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

#124
Most useful script I've ever written, and legitimately how I keep track of everything important in my life:

  #! /bin/bash

  function todo {
   if [ $# -eq 0 ]
    then
     vim ~/Dropbox/todo/todo_list.txt
    else
     vim "$HOME/Dropbox/todo/todo_list_$1.txt"
   fi
  }
Sourcing this in my shell means I just have to type...

  todo
To automatically get into my default todo list which is synced to dropbox (and thus accessible everywhere on mobile as well).

While, whenever I have a new project/etc come up, I can just

  todo new_project_name
And get a new, nice clean file, with the same backups and multi-device accessibility.

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

#125

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…

Reminds me of a similar hack I did recently. I wanted to book tickets for a show in Vegas, and for whatever reason the “ticket bundle” which included the show plus extras was about $20 cheaper than just the show on its own.

The only problem was selecting the bundle would automatically choose the seat (on the far side which weren’t good), skipping the seat selection modal.

I realized that if you had a seat in your cart, it would reserve it for 15 minutes and the bundle would pick the next available seat. Since I wanted central seats, I wrote a simple Puppeteer script which selected the bundle in multiple browser instances, reserving all the unwanted seats until mine was finally available.

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

#126
Recently developed a small embedded device (using a nRF52840 microcontroller) that allows me to open my front gate remotely using my phone. I no longer have to carry around a gate remote. And my friends/guests can now open the gate from their phone as well. I couldn't find anything on the market for doing that so I'm glad I managed to do it (and it was a good opportunity to learn some embbedded programming and electronics).

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

#127
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 little program I called "Simon". I named it after a popular kids game called "Simon Says". It was basically a 1983 version of Selenium. I created instruction files, which would tell the main program (Simon) what to do: the time to dial a BBS, the number to dial, the login info, and then all the commands to send. It did things like download my messages so I could read them the next day. Send messages. But mostly, and kinda shamefully, it was used to pirate games. I had a list of about 10 local BBSs that I would dial every night, and a list of games I was looking for. If Simon found a game on the list, it downloaded the game for me. Then, it would hang up. I even created a hard-hang-up time of 7am, when my mom woke up, because if the computer was still on the line and she needed to use the phone, she would kill me! LOL

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.

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

#129
I'm not sure this qualifies as small since I've been working on it since last summer and has grown to over a few thousand lines of code, but it is definitely automation and something I'm quite proud of.

https://github.com/TorbFoundry/torb

"Torb is a tool for quickly setting up best practice development infrastructure on Kubernetes along with development stacks that have reasonably sane defaults. Instead of taking a couple hours to get a project started and then a week to get your infrastructure correct, do all of that in a couple minutes."

My ambition is to fill the space of Heroku and right now I can get something like a React App and a Flask API or a full Elixir Phoenix project started and running in less than 5 minutes on Kube, with a full infrastructure as code environment, reproducibility and more.

It's definitely not meeting my ambition yet, but it's definitely in a place where I think people can use it and get a lot of value from it. I've been testing it with some friends over a few months and have been dog fooding it on my other projects.

I just finished adding a file system watcher to it over the last few days so you can iterate and changes will quickly be reflected onto your cluster. Next I'm going to extract this out into a library from the CLI tool, build an API over it and offer a hosted solution and a web app.

I've been meaning to share it with people but I've been heads down building for maybe a little longer than I should have been.

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

#130
Parse `man` and `help` pages to get descriptions for options: https://github.com/learnbyexample/command_help

    $ ch ls -vx
       ls - list directory contents

       -v     natural sort of (version) numbers within text

       -x     list entries by lines instead of by columns

Script to provide `cut`-like syntax for a few `awk` features: https://github.com/learnbyexample/regexp-cut

    $ echo '   one   two three' | rcut -f2
    two
    $ echo 'sample42string123with777numbers89' | rcut -d'[0-9]+' -f3
    with
Post reply on HN