Ask HN: Small scripts, hacks and automations you're proud of?
201–210 of 340 posts
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#202I got annoyed with unlocking my ebike with an app every day, so I created a car key enclosure with a Bluetooth chip to unlock it. So much work! Creating a custom PCB, writing software for the nRF52 chip, learning about BLE, security levels, GATT. Deep sleep and ultra low power usage. I use it every day and am really happy with it.
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#203Before 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.
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#204Re: Ask HN: Small scripts, hacks and automations you're proud of?
#205On Windows: - Created a folder called "shortcuts" - Copy the folder URL into the system path (Control Panel, Environment variables something something) - Create a shortcut of anything I want to hyperlink to and put in there, with descriptive names - In IE, I think the setting was to enable autocomplete. For some reason that was linked to the autocomplete of the run menu item in Windows. - For extra bonus points, add…
Re: Mac — Hammerspoon?
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#206my 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
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
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#207Re: Ask HN: Small scripts, hacks and automations you're proud of?
#208I run a clipboard logger + Window Title Logger in the background. I am able to find stuff from 10 years back. Works across all apps. Want to remember something just copy it. It might not be secure practice. I regularly encrypt the rolled over logs using 7z.
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#209A 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.
> Accepting the hash lets people with database access perform a real login if needed. ... and if anyone managed to say do an SQL injection and retrieve said hashes, then that then would give them access to your users accounts, right?
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#210* Load a playlist from spotify (including fetching the API token programatically from bash... shudder) * Search youtube for the song + artist * Download the MP3 of the song from youtube * Set up the directory structure for Rekordbox DJ * I could then manually import the song
When I was too broke to buy music for DJ'ing this satisfied my craving for new music to play.