Hacker News new | comments | show | ask | jobs | submit login
Ask HN: What is the most amazing python script you ever wrote to save your time?
20 points by santudey 11 months ago | hide | past | web | favorite | 14 comments
I am researching about the scripts that save time. If you did something amazing it's time to tell the HN.

Many moons ago, when I was young and working as a lowly IT service monkey, the client (a huge corporation) decided to migrate from their prehistoric, image-deployed Win95 setup to a centrally managed WinXP setup. This went about as terribly as you can expect and we ended up with a long checklist of things that needed fixing manually, on each of the 1200 computers we were responsible for.

So I stayed an hour or two longer every couple days and each time picked one task from the checklist and wrote a Python script that would do that job for me (such as making sure some .INI file were having the right settings, or some registry settings were set, or some installer was run).

Soon enough, the script was doing enough of my work so that my time could be spent working on the script instead of mindnumbingly editing the same INI file over and over again, and eventually the script did everything. I shared it with my colleagues and soon the 40-point checklist was reduced to: 1. Run the script.

It also provided me with excellent job security and a route into later software development jobs :)

I wrote a script that allows me to acquire videos from a very popular video providing site (YOU mighT have Used it BEfore) from channels on said site, and converts them into mp3's, tags them with metadata from eyed3 and then adds them to my music library for use when I DJ over the weekends. This script has saved me possibly more than 4 hours a week of manually hunting down music, plus if I need to get a specifically popular (stupid) song (despacito), I can always buy that on gmusic and just manually add it.

A rebel just for kicks.

I bought a business in 2014 and needed to migrate customers from the previous owner's stripe account into ours. At the time, stripe didn't have an easy way of doing it and I wrote a python script to handle that.


I built git-browse: https://github.com/albertyw/git-browse

After getting tired of constantly searching github and phabricator, I built a small tool that would open git repositories, files, branches, and commits in the browser.

I have data-collection systems that bring in readings around a solar power plant. It all comes in as CSV files. So I use Python to collect that data and archive the data with files named by the day's data, at midnight. Then another Python program collects all the archived files from each system and brings it into another hard-drive-based system where all the files named by the same date are collected together. It then runs gnuplot for .png representations of each, and then calls Imagemagick to make montages for each day which include data from each kind of sensor. Love Python.

I wrote a script to move automatically parse and move laboratory data off of instruments

Wrote a script to generate json for data-driven testing. The script looks at a table and transforms that data into json describing the values in each row/column of the table.

I wrote a Python script to aid with converting database backups into CSV files. The script takes a folder of encrypted .zip files (each containing a database backup), decrypts the .zip, converts the SQL data to CSV, and renames the output file according to my desired format. Turned a ~1-minute process I had to follow for each individual file, into an automated one-click step that I can run on an entire batch, all while I'm working on something else

I wrote one that parses the help desk tickets for IDs and spits out the SQL, bash, and vi commands that I use to resolve them. That way I only have to deal with the hiccups and typos.

I wrote one to rename my 300 DBVisualizer connections so I could get to them by typing the initials of the server and database. It also put the department number on the end. I wasn't good enough to parse the XML so I just went through line by line.

I wrote a script generated Java dto objects by filling in templates. Essentially the same stuff lombok gives for free. But this was a Big Dumb Corp on an ancient version of java. And due to their requirement had to have nearly the same dtos in five different areas of the code. Saved me carpal tunnel typing all that bs.

Do you specifically want it to be about Python scripts or also other languages?

Yes why only Python?

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact