Python Everyday
Python Everyday
Intro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Other writings . . . . . . . . . . . . . . . . . . . . . . . . . 1
Home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Helping in the kichen . . . . . . . . . . . . . . . . . . . . . 2
From garage to full script . . . . . . . . . . . . . . . . . . . 2
Checking Pizza prices . . . . . . . . . . . . . . . . . . . . . 3
TLDR: I named my first-born son with the help of a
Python script. . . . . . . . . . . . . . . . . . . . . . . 3
Finding incomplete items for wedding . . . . . . . . . . . 4
Finding the time taken for tasting meads . . . . . . . . . . 5
Chicken coop door control . . . . . . . . . . . . . . . . . . 5
House-hunting . . . . . . . . . . . . . . . . . . . . . . . . . 6
Reading codes on all PCs . . . . . . . . . . . . . . . . . . . 6
Wedding RSVP . . . . . . . . . . . . . . . . . . . . . . . . . 6
Tracking inbox 0 . . . . . . . . . . . . . . . . . . . . . . . . 7
Custom haveibeenpwned . . . . . . . . . . . . . . . . . . . 7
Chatlogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Learn a new word everyday . . . . . . . . . . . . . . . . . 8
Desktop background based on weather . . . . . . . . . . . 8
Disabling my network during dinner time . . . . . . . . . 8
Saves some time opening websites . . . . . . . . . . . . . 9
Choosing the right housing unit . . . . . . . . . . . . . . . 9
Medication reminder . . . . . . . . . . . . . . . . . . . . . 9
Adjusting IKEA blinds . . . . . . . . . . . . . . . . . . . . 10
CONTENTS
Appearing Busy . . . . . . . . . . . . . . . . . . . . . . . . . 14
Moving the mouse . . . . . . . . . . . . . . . . . . . . . . . 14
Ticking volume . . . . . . . . . . . . . . . . . . . . . . . . 14
Apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
ASCII editor . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Color picker . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Own IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Quote app . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Multi-protocol app . . . . . . . . . . . . . . . . . . . . . . 17
Pictures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Sending pictures to Google frame photos . . . . . . . . . . 18
Emailing a random picture to my mom everyday . . . . . 18
Desktop wallpapers . . . . . . . . . . . . . . . . . . . . . . 18
iPhone backups . . . . . . . . . . . . . . . . . . . . . . . . 19
Scraping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
File with links . . . . . . . . . . . . . . . . . . . . . . . . . 20
tvdb scraper . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Soundcloud . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Aggregating news . . . . . . . . . . . . . . . . . . . . . . . 21
Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Data hoarding . . . . . . . . . . . . . . . . . . . . . . . . . 22
Flights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Checking for airfare prices . . . . . . . . . . . . . . . . . . 24
CONTENTS
Money . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Scanning bank transactions . . . . . . . . . . . . . . . . . 25
Investment calculations . . . . . . . . . . . . . . . . . . . . 25
Credit-card transfers . . . . . . . . . . . . . . . . . . . . . 25
Lottery check automation . . . . . . . . . . . . . . . . . . 26
Tracking bills . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Tracking portfolio . . . . . . . . . . . . . . . . . . . . . . . 27
Crypto earnings . . . . . . . . . . . . . . . . . . . . . . . . 27
Credit card statement aggregator for the entire family . . 27
Bank Python . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Forensic accounting . . . . . . . . . . . . . . . . . . . . . . 28
Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Checking for active ports on switches . . . . . . . . . . . 30
Updating DNS . . . . . . . . . . . . . . . . . . . . . . . . . 30
Re-login on session expiry . . . . . . . . . . . . . . . . . . 30
Notified when networks fixed . . . . . . . . . . . . . . . . 31
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Redacting specific data fields . . . . . . . . . . . . . . . . 32
Manipulating DSLR files . . . . . . . . . . . . . . . . . . . 32
Seeing duplicates . . . . . . . . . . . . . . . . . . . . . . . 32
Moving files from GDrive to BunnyCDN . . . . . . . . . 33
File sorting report . . . . . . . . . . . . . . . . . . . . . . . 33
Choosing daycare . . . . . . . . . . . . . . . . . . . . . . . 33
The nuke command . . . . . . . . . . . . . . . . . . . . . . 34
Reverse engineering file . . . . . . . . . . . . . . . . . . . 34
Parallelize Pb of data . . . . . . . . . . . . . . . . . . . . . 35
Social Media . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Rejoin subreddits . . . . . . . . . . . . . . . . . . . . . . . 36
Spotify wrapped ahead of time . . . . . . . . . . . . . . . 36
Crossposting to FB and Twitter . . . . . . . . . . . . . . . 36
Twitter bot . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
CONTENTS
Correcting votes . . . . . . . . . . . . . . . . . . . . . . . . 37
Deleting all content of my Facebook profile . . . . . . . . 37
Posting to subreddit . . . . . . . . . . . . . . . . . . . . . . 38
Instagram comments . . . . . . . . . . . . . . . . . . . . . 38
Responding to fb wall . . . . . . . . . . . . . . . . . . . . . 38
Twitch bot . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Mumble bot . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Detect when sound mode changes . . . . . . . . . . . . . 41
Edit podcast recording . . . . . . . . . . . . . . . . . . . . 41
itune playlist to CD . . . . . . . . . . . . . . . . . . . . . . 41
Vynyl recording . . . . . . . . . . . . . . . . . . . . . . . . 42
Stocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Stockstir tracker . . . . . . . . . . . . . . . . . . . . . . . . 43
Downswing and upswing . . . . . . . . . . . . . . . . . . 43
Driving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Should i leave early? . . . . . . . . . . . . . . . . . . . . . 44
Deer strikes . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Remote control . . . . . . . . . . . . . . . . . . . . . . . . . . 45
TV remote . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Console for Minecraft servers . . . . . . . . . . . . . . . . 45
Legal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Stopping stalking accusations dead in it’s track . . . . . . 46
Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Sharing Stardew Valley screenshots . . . . . . . . . . . . . 49
Hunting for shiny Pokemons . . . . . . . . . . . . . . . . . 50
Making EVE online money . . . . . . . . . . . . . . . . . . 50
Dungeon name generator . . . . . . . . . . . . . . . . . . 50
Better hero draft . . . . . . . . . . . . . . . . . . . . . . . . 51
Picking game from steam . . . . . . . . . . . . . . . . . . . 52
CONTENTS
FFR ranks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Coding an autosave feature . . . . . . . . . . . . . . . . . 52
Dependency tree . . . . . . . . . . . . . . . . . . . . . . . . 53
Mystery game by email . . . . . . . . . . . . . . . . . . . . 53
Stops mining to play game . . . . . . . . . . . . . . . . . . 53
Managing my baseball team . . . . . . . . . . . . . . . . . 54
Ultima online skill gains . . . . . . . . . . . . . . . . . . . 54
Bookkeeping for tabletop RPG game . . . . . . . . . . . . 55
Notify Me . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Is my media server down? . . . . . . . . . . . . . . . . . . 56
My renders are complete . . . . . . . . . . . . . . . . . . . 56
When there is an opportunity . . . . . . . . . . . . . . . . 56
Package status . . . . . . . . . . . . . . . . . . . . . . . . . 57
Cheap rentals . . . . . . . . . . . . . . . . . . . . . . . . . 57
School . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Bisection method securing an A+ . . . . . . . . . . . . . . 58
My college had no waitlist . . . . . . . . . . . . . . . . . . 58
Securing an A in photography test . . . . . . . . . . . . . 58
Simulating ecology homework . . . . . . . . . . . . . . . 59
Counting words . . . . . . . . . . . . . . . . . . . . . . . . 59
Perfect scores on Open long exams . . . . . . . . . . . . . 60
Computational Physics . . . . . . . . . . . . . . . . . . . . 60
Nuclear missiles . . . . . . . . . . . . . . . . . . . . . . . . 61
Help with formatting . . . . . . . . . . . . . . . . . . . . . 62
Reference gathering . . . . . . . . . . . . . . . . . . . . . . 62
Shopping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Gumtree deals . . . . . . . . . . . . . . . . . . . . . . . . . 64
Sysadmin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Recovering usernames and passwords for crashed server 65
IP analyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Managing 8000 machines . . . . . . . . . . . . . . . . . . . 66
Distributed phone system . . . . . . . . . . . . . . . . . . 66
CONTENTS
IoT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Table fan . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Helping in the kichen . . . . . . . . . . . . . . . . . . . . . 68
From garage to full script . . . . . . . . . . . . . . . . . . . 68
Chicken coop door control . . . . . . . . . . . . . . . . . . 69
Control radio transmitters . . . . . . . . . . . . . . . . . . 69
Controlling cocktail machine . . . . . . . . . . . . . . . . 70
Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Tacking tasks . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Writing NASA launch GUIs . . . . . . . . . . . . . . . . . 71
Python saves . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Controlling industrial robot . . . . . . . . . . . . . . . . . 73
Tell me when i should go home . . . . . . . . . . . . . . . 73
LaunchCode . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Asterisk phone system . . . . . . . . . . . . . . . . . . . . 74
Work mix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Analysis app . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Update pricing lists . . . . . . . . . . . . . . . . . . . . . . 76
The road to peak promotion . . . . . . . . . . . . . . . . . 76
Saving 2D artists a lot of time . . . . . . . . . . . . . . . . 77
Saving a couple of $$$ for a small market TV station . . . 78
Startup language of choice . . . . . . . . . . . . . . . . . . 79
Printers status . . . . . . . . . . . . . . . . . . . . . . . . . 79
Finding abnormal orders . . . . . . . . . . . . . . . . . . . 80
Picking where to lunch . . . . . . . . . . . . . . . . . . . . 80
Best settings for 3D forming machine . . . . . . . . . . . 80
Aggregating GIS data for state gov . . . . . . . . . . . . . 81
Ready-to-sign doc . . . . . . . . . . . . . . . . . . . . . . . 82
Million dollars sales . . . . . . . . . . . . . . . . . . . . . . 82
Checking if broadcast chain has failed . . . . . . . . . . . 82
Radar images into video for weather show . . . . . . . . . 83
Fixing problem to deliver mails . . . . . . . . . . . . . . . 83
Watching craiglist for jobs . . . . . . . . . . . . . . . . . . 83
Chemical plant script diplayed in kiosk mode . . . . . . . 84
WFH status . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Circuitry on paper . . . . . . . . . . . . . . . . . . . . . . . 85
Recording neuron spikes . . . . . . . . . . . . . . . . . . . 85
At the ATLAS experiment . . . . . . . . . . . . . . . . . . 86
Mass spectrometry data . . . . . . . . . . . . . . . . . . . 86
Work for chip desgning company . . . . . . . . . . . . . . 87
Onboarding and offboarding employees . . . . . . . . . . 88
Migrating from one accounting system to another . . . . 88
Answering questions . . . . . . . . . . . . . . . . . . . . . 88
Migrating university lectures . . . . . . . . . . . . . . . . 89
DevOps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Intro
Routinely teaching Python and organize our local usergroup1 , i
always lack ideas when wanting to illustrate the uses of Python
in daily life.
So i decided to embark on a project to collect interesting testimo-
nials of people using Python to help themselves. Many times, the
use case is surprising and inspiring.
I hope this project will help when teaching Python, but most
importantly, be a delightful read for Python fans.
— u/appinv (Abdur-Rahmaan Janhangeer, Mauritius)
Note: I hope to release a version 2 soon.
Other writings
1 https://pymug.com
2 https://leanpub.com/c/flask-masterclass
3 https://leanpub.com/sqlite-internals
4 https://leanpub.com/cracking-python
Home
The home is where Python shines.
— u/BioSammyj
So now, the coop door automatically opens after sunrise and closes
just after sunset. Thanks, Python!
— u/phreakmonkey
House-hunting
When I was house hunting the website to list houses was barely
useful. The worst was there was no means of identifying new
listings, you just had to look at the map and guess which were
new. I wrote a script that downloaded the listing data, filtered it
for criteria I was interested in, compared it to the previous day’s
listings, and e-mailed the results to myself each day. Saved me
many hours of searching.
— deleted
Wedding RSVP
I built an RSVP app for my wedding. An hour of writing Python
saved us and our guests a lot of time.
— u/badthingfactory
Tracking inbox 0
I have a Python script that checks my various email accounts hourly
and stores incoming mail counts (total mail, total size, new items,
unread items, etc) so that, over time, I can judge how effective I am
at keeping my inbox at zero.
It also sends me a text if it sees a massive influx of email, which
is usually indicative of a problem at work that needs addressing
ASAP.
— u/pytechd
Custom haveibeenpwned
I have a Python script that checks my various email accounts hourly
and stores incoming mail counts (total mail, total size, new items,
unread items, etc) so that, over time, I can judge how effective I am
at keeping my inbox at zero.
It also sends me a text if it sees a massive influx of email, which
is usually indicative of a problem at work that needs addressing
ASAP.
— deleted
Home 8
Chatlogs
When I was on windows I used messenger plus to keep all my
chatlogs. I didn’t like the idea that I couldn’t access my logs
online so I wrote a python script to parse all the chatlogs and
converted them to emails formatted like gmail chatlogs. I then used
thunderbird to import the emails into my gmail. So now I can use
the power of gmail to search through years of chat history.
Later on when I moved to a mac, I wrote another script that did the
same thing except for adium. After playing around with ruby for a
while, I wrote a ruby port which I’ve hosted on github
https://github.com/johnjiang/adium2gmail
— u/PCBEEF
Medication reminder
Medication reminder app for the whole family send a text using
Twilio app that then sends data to a MySQL server that stores who
what and when/if a repeat is required it then sends a text when it’s
time to have it and if you do not respond within 10 mins saying
that meds have been given it will keep following up
— u/Iammiddow1991
— u/Snoopy_snoopy_snoopy
u/2q2RS
My SO is doing a board year for a student basketball club, and is
responsible for making the schedules of when which team has to
train. There are a few fields available where different teams can
train simultaneously. Next to that the schedule should be made so
that the coaches of a team either trains before or after the coaching
themselves (in a higher level team). They used to figure this out by
hand, making these training schemes optimal. I figured this takes
ages and you probably don’t find the optimal scheme. So I made a
program that fills in the schedule for them. I have yet to optimize it,
since I have written it so it uses “brute force” since I was on a time
clock to make it. The schedule gets filled in randomly with teams,
and by a point system I keep the top scored schemes. She chose one
of those. When I have time I want to write in into a tkinter script,
optimized, so they can use it for the following years.
Appearing Busy
Let Python cover your tracks
Ticking volume
I wrote a like 6 line script that uses pyautogui to tick the volume
up, wait 2.5 minutes, tick it down, wait 2.5 minutes, etc until you
kill it. Keeps my laptop awake and Teams online.
Anyway I made it a package and tweeted it like 3 years ago and a
bunch of people liked it. I still use it every day at work so I can step
away without worrying about it.
Please do not reply telling me about mouse jigglers or that my org
will definitely catch on and send me to jail. I’ve been doing this for
years at two different companies.
— u/JambaJuiceIsAverage
Apps
Python articfacts save time
ASCII editor
https://github.com/cmang/durdraw is an ascii art editor I made that
started out in 2009 as a 193-line Python 2 script. It could do some
very primitive editing and saving, nothing else. Not even load. I
was very much a “play with curses, learning python” project.
I soon added animation, because the other editors I was using did
not have that feature, and color. Eventually ported it to Python
3, added more features, more colors, got other people using and
contributing to it.
15 years and many incremental changes later, it’s doing pretty good
now, for its niche (ANSI art editors). I still use it daily.
— u/IndianaJoenz
Color picker
A color picker using Tkinter. At my job there are a few colors that
I use frequently, so I can also pin the ones I want to use later.
I know tools exactly like this already exist, but it was a great
learning experience and I got to add a few very specific features
tailored to my use.
— u/AlpacaDC
Apps 16
Own IDE
One of my first large programs was my very own python editor
I used it for years an had it tailored to my needs It had syntax
coloring, auto backups while you where programming (my power
sucked it was unreliable ) it would auto search your folders and
have all the docs it could in a drop down on the menu bar. You
could launch your current script with a button click and run it as is
our allow you to add any cmdline args if needed. If your program
crashed it didn’t kill/ freeze your editor. It even had a button that
would let you compile your current script to an exe I am sure none
of this is revolutionary it was just great fun and a great way to learn
how GUI frameworks work and interface design edit: fixed words
that were mangled and auto corrected by my phone.
— u/Baconoligist
Quote app
I just started learning Python 2 months ago as well. The coolest
thing I’ve done is the only thing I’ve done with Python so far but I
am very proud of it. I made an app for my work to generate quotes
for our customers. Before the app, each engineer would have to
go and do a lot of tedious work to generate the quote. We would
have to go to different places in our network to get the customer’s
name, quote number, company name, contact information. Then
we would have to calculate a price using an excel price sheet. Then
go back online again to grab some details about what kind of service
is a part of the quote. Then enter quote assumptions, lead times,
sample requirements and so on.
The app I wrote consolidate all those steps into one single user
interface using PYQT. It does all the webscraping, price calcuation,
assumptions and sample requirements in one place. Then the app
Apps 17
Multi-protocol app
i assembled, over the course of a week, a hulking beast of an
application that can communicate between the computer it’s on and
just about any peripheral over telnet, ethernet, GPIB, USB, serial,
and a few other protocols. it’s even got standardized ‘drivers’ to
communicate with new equipment. it can compile and process data
from the equipment as well.
it’s not that portable but it IS built around being
expandable/update-friendly. everything’s built around
specification files that it pulls from. they follow a simple to
parse format that feeds the master application everything it needs
to talk to them without needing to add any new code.
i’m actually adding some stuff where it can talk to things like
arduino and flash them to re-configure for a given job, and some
fun things for SPI and I2C based programming of target equipment
this week.
— u/buttery_shame_cave
Pictures
Python helps with a file format very common nowadays.
Desktop wallpapers
A script I use daily? I have it click on a spot on my desktop and
then type ‘n’ so I get a new wallpaper on Win7. Source here
Another I have is a Imgur Album downloader, so it just grabs the
top images from r/ScarlettJohansson on imgur, and then I use them
as my wallpaper. Scroll to the bottom for the code
— u/TankorSmash
iPhone backups
My iPhone didn’t want to (for some reason) restore photos from
a recent backup. After around an hour of Googling, I decided to
whip something together in Python.
The script successfully recovered all photos from the iTunes backup,
and copied them to a folder on the desktop. I was amazed that it
worked.
All of this in under 15 lines of code. <3 Python.
— u/Cyph0n
Scraping
Get those data.
tvdb scraper
Scraper for thetvdb.com, nothing too fancy. Scrapes episode titles
for tv-shows in two languages at once.
Unfortunately you can’t just switch the language of the episode list.
That only works on episode level. So it has to scrape every episode
page to get the translated titles.
The part I’m proudest of is that it does this actually in parallel which
sped up scraping immensely! (Like factor 100 immensely.)
— u/robin_888
Scraping 21
Soundcloud
soundcloud scraper for liked songs, keeps track of the last liked
song so I can run it routinely and it detects if there’s anything
that looks like a download link to avoid downloading the stream.
Additionally I have a script that runs in right click context menu
that auto tags, embed track description, and pulls artwork from the
soundcloud track while also asks if a to-be-overwritten existing tag
should be overwritten. And if the source file is a .wav, it converts
to a flac before auto-tagging. It’s great for archiving music from
artists that don’t want to sell the song on a platform.
— u/chazzeromus
Aggregating news
Last year, I spent about 2 months to write a long script. It can
automatically scrap the new options of some newspapers from their
website for every day. And put them on a forum. So some authors
who write the options for the newspapers could see their works.
Later, the script could automatically put the options on a blog.
Now, every day, about 200 authors will read the blog to find their
own options.
The best thing for me is that those authors admire me a lot. _^
— u/jiangauthor
Jobs
It would be complicated to explain without going into a lot of
tedious detail, but at work we use an awful software called Control-
M which has an awful web portal that we use unfortunately that
Scraping 22
Data hoarding
I am data hoarder. I do gather my torrents using Selenium and
Jupyter Notebooks. Some sites i scrap for magnet links, others
for Torrents. After all sites are scrapped - all content goes to my
seedbox and is loaded into QBittorrent. QBitttorrent allows me to
call scripts when torrents are ready, so every downloaded torrent
automaticly comming back to my NAS.
I do gather Hackernews, Thingiverse, Reddit and some shops. I
track prices of my favorite products and every kind of potatoes,
so i know when to buy them for best prices. Few Rasbperry Pis
are taking picture every second and send it back to home server,
then every day short 86400 frames video is sent to people, who are
interested in topics photographed (yeah, growing potatoes can be
exciting, i know! And Ants too!).
Thingiverse is scapped into 1000k pieces, which are compressed
into 7z and made into torrent. Then at night torrents are moved
to crude site with torrents for people to share. I keep my personal
archive in tar.xz too with hope, that some day i will make 7z with
that.
Scraping 23
Did i mentioned that i have few machines? They all are backuped
by borg and borgmatic - python tools.
My databases, scrappers and all that is automated using ansible,
which uses Python to automate things. So all steps are automated
by just Python.
— u/nikowek
Flights
Prevent pocket hits.
Investment calculations
Other program I often use, is one where you input your future
investment plans (amount of months + monthly deposit) and it
calculates and outputs all possible outcomes in a big excel file (each
row is a different average year over year return)
— u/Robinsane
Money 26
Credit-card transfers
I wrote a script that makes sense of my online credit-card transfers
and automatically creates a report with pie charts and stuff with
info on how I use my money (earnings vs food, clothes, bus fares,
games etc). It was quite “interesting” for me as a student to get a
better overview of how much I waste on useless shit…
— u/sloooth
Tracking bills
I kept track of my bills in college with a Python script. I was in
charge of all of the money, so the bills split 4-ways would come to
me. I always paid the bills on time, but being college students not
Money 27
Tracking portfolio
I use a script to get data for mutual fund and etfs; I run it at the end
of the year.
See, I keep an excel chart to track portfolio %s–particularly some
data at the end of the year, and so this script gets this data so I can
put it into my spreadsheet and make better investment decisions.
Cuts down the effort a whole lot.
— u/drdeadringer
Crypto earnings
I purchase a tiny bit of crypto every week, and I have a script that
runs every evening and texts me if what I’ve invested has made or
lost me money. I’m currently about 20% down
— u/addictedtoamps
Bank Python
Forensic accounting
Wrote a small program a while ago with tkinter to help with
forensic accounting. Optimized it, and moved it online so anyone
can access it. Spent today getting it to work with a few cases that I
missed, such as negative numbers.
1 https://calpaterson.com/bank-python.html
Money 29
Updating DNS
A script that checks the my public IP address and automatically
updates all my DNS records if it’s changed
— u/linuxfarmer
— u/kawaiibeans101
Seeing duplicates
First useful python script i ever wrote was a little program to scan
my downloads folder each night, snag all the .jpg, .png and .gif’s
from the day, check for duplicates, and then move them to a dated
folder on my fileserver. Definitely not as cool as some of the
programs people write, but damn it’s useful.
— u/Adhock_hk
Choosing daycare
When we were looking for daycare, I scraped the county and state
registries of day care providers. They both let you look up by zip
code. Our house is on the boundary of 3 zip codes and like 4 more
are nearby.
We wanted someplace that was relatively close to our house. The
problem is that due to several large creeks, a place can be only a
half mile away, but take 20 minutes to drive to.
So I got a Google maps API key and ran the addresses through
Google maps to get the driving distances and time estimates. We
looked at the closest 5 or so and picked our day care for our son.
— u/c_is_4_cookie
and struct is not what you use when files are that big (numpy is
better).
Then I took that and build a 3D GUI around it using PyQt/PySide
and VTK.
— u/billsil
Parallelize Pb of data
I wrote a python script which iterated through a directory structure
and, every x files or y bytes, added the list of files to a worker queue,
which was served by a bunch of threads running rsync. This was
to parallelise the transfer, to optimise bandwidth and reduce the
effects of I/O latency. This was for doing an ad-hoc copy of just
under a petabyte of research data
— u/frymaster
Social Media
Enhance your digital life!
Rejoin subreddits
Script to rejoin all my subreddits on a fresh account, without the
Reddit API from a master account that contains all the subreddits.
— u/tuck-in-an-ide
Twitter bot
I run this Twitter bot script every hour from a webhost.
https://twitter.com/#!/YHobosHaveDogs
It finds people generally talking about or asking, “Why do homeless
people have dogs?” and responds to them, “Homeless people have
dogs because a dog will love you even if you are homeless.”
It’s my finest piece of software I have ever created, or (I’m con-
vinced) will create.
— u/AlSweigart
Correcting votes
Recently I found that one of a website (news) in our country cheat
the voting by swap two vote.
I wrote a python script that fetch the captcha, crack it using
tesseract, then build a POST message and make the vote did like
they designed to.
— u/Funnnny
But it was basically waiting for certain texts to appear because there
is almost nothing in the DOM that would be predictable in structure
or attribute names.
— u/radeklat
Posting to subreddit
Instagram comments
I made an instagram bot. All it does right now is it goes to the
explore page on instagram, clicks on the first video, goes through all
comments, responds to people that use the word “the” in a sentence
and responds to them with “that’s kinda funny”, and then goes to
the next video
— u/Bigdaddydamdam
Responding to fb wall
Wrote a bot that responded to all the birthday messages on my
Facebook wall. I was insanely bored that summer and decided to
have a little fun, since I don’t like the idea of a one-size-fits-all thank
you message, but per person responses are very tedious. The bot
used a simple bag of words natural language classifier to determine
if the post was a birthday message or no (worked phenomenally,
Occam’s razor FTW) and then respond to the message with the
Social Media 39
Twitch bot
My biggest thing is a program for twitch.tv, in essence it reads
the chat and looks for keywords and responds if it see’s something
starting with that keyword (command), it can do stuff like say hello,
bad-mouth you, play a guessing number game, etc.
I’m actually in the same boat as you and completely self taught,
my suggestion is to make a schedule, and stick to it. Everyone
has days, weeks, or even months where they feel unmotivated, if
I only coded when I was motivated I wouldn’t have made half the
things I have or learned nearly as much. It’s a habit as much as it is
motivation, for me I made it so I’m always sitting down after dinner
and coding for a couple hours, it’s just what I do now! I still work on
projects (like something I recently made which pings ip addresses
then writes out data and averages to a google spreadsheet) and it
makes me learn every day.
I will mention I took the extremely slow way around, while you’re
learning the basics I definitely recommend sticking with a class or
at least going through it while you work on your projects
— u/a_bad_programmer
Mumble bot
I wrote a python bot for Mumble (a low-latentcy voice chat app)
that listened in one channel and spawned a bunch of clones of all
the people into another channel that retransmitted what everyone
Social Media 40
said on a delay. This was so you could e.g. spectate a TF2 or CSGO
game (spectating has a delay on it to stop spectators helping the
team) and listen in on the team comms as if it were realtime
— u/frymaster
Sound
Yeah, let’s hear what they are saying.
itune playlist to CD
I keep all my music in AAC format in iTunes as they’re smaller than
MP3 and I can therefore fit more on my iPhone/shuffle. I created
Sound 42
Vynyl recording
My late father in law had a bunch of out of print country and
bluegrass records. I took someone else’s vinyl recording splitter,
one you feed a Discogs entry to, and added PyDub silence detection.
Feed the script a Discogs entry and a .wav and it correlates the track
lengths in the Discogs entry and the PyDub results, and it spits out
a file that Audacity can use for track beginning and end points. I sit
and let it churn through a recording and 99% of the tedious tagging
is already done; just cinch up the endpoints.
— u/regeya
Stocks
The rise and fall of empires.
Stockstir tracker
For Stockstir, I run a script through crontab that runs five times
a day. It checks for the validity of Stockstir’s main functioning
components, and each time it sends me a notification to my devices
via ntfy.sh notifying me of the status.
— u/patzedi
Deer strikes
At one point, I wrote a Twitter bot that would scrape the data on
traffic accidents provided by the state, filter out deer strikes, and
tweet it if it was within a particular area. I probably don’t have the
code for that anymore though.
— u/haljohn
Remote control
Great ideas.
TV remote
A discord bot that sends a message with buttons that control the
mouse and keyboard in different ways, for whenever I’m watching
something on my computer that’s played onto my TV but don’t
want to get up to full screen the video or fast forward or pause
etcetera, basically peak laziness
— u/LionZ_RDS
instance.
— u/be_bo_i_am_robot
Games
Get an edge.
— u/Lokili
— u/sli
— u/happybanditman
FFR ranks
I have been playing FFR for a long time (it’s like DDR but on the
keyboard). There is something called “average rank” which I’ve
decided is not only a decent ranking of how well you’re doing, but
the funnest rank to improve. Problem is, there’s no way to know
which song to play next. If 500,000 people have played a song and
I ranked 1000, that’s fine. However if 2000 played it and I ranked
1000 from years ago, I can drop my rank by a lot with just one play
through.
The data is not easily accessible, so I scraped the song list pages for
my rank and number of players on each song. The script outputs an
up to date list of songs I should play next, along with the expected
change in my rank if I play once - it’s surprisingly accurate.
— u/zulban
Games 53
Dependency tree
I made a dependency tree to return what items I am missing from
a craft for the new path of exile league. I also made a comparison
tool to calculate the amount of juicyness a choice would give me
in last epochs monolith. It takes a screenshot and uses Py tesseract
to do the OCR then it’s just some calcs on drops Vs how long that
mod stays around to give a score. Saved me from doing it manually
when I want to just go onto the next map
— u/jfp1992
— u/Or4ng3m4n
The current skill level The difficulty of the item to craft (determined
by two values, a min skill to make and a max skill to guarantee an
exceptional item) The total number of skill points you have
Using this data, I made a python script to determine exactly what
items were best to make every 0.1 point. Particularly it was the
probability of gaining skill over the total number of resources it
took to make (iron ingots). Also, it ran a Monte Carlo simulation
to tell me how many resources I needed to max out that skill
(95% probability, 99.7% probability). All the data ended up being
normally distributed.
This was super exciting to do because it gave me a real advantage
when it came to effectiveness of training and it was one of the first
times I had done real data analysis and file parsing in Python. It
also served as one of my first real projects in Python as well as a
project that solved a real problem.
— deleted
— u/jjeaton
Package status
I just recently wrote a script that checks the status of a package that
has been mailed to me and sends me an sms when I can go and pick
it up at local store.
The service itself sends me an sms but it has ridiculous delay of 30
minutes or so. Did I tell you I’m a bit impatient once in a while?
Both services have only web interface so I wrapped them up in
simple Python classes using BeutifulSoup and requests libraries. :)
— deleted
Cheap rentals
In the area I live the cost of living is pretty high so I wanted to
write a program to notify myself of new rentals as they appear. I
used task scheduler to run the program everyday at noon and the
program notifies my desktop if the current date matches the date
of the post.
— u/Huemann-bing
School
Who said school can’t be automated?
Counting words
I once had a research paper assignment where my teacher told us
ofit had to be at least 1500 words, not including quotes. Since MS
Word’s wordcount couldn’t handle that, I wrote a script in a couple
of minutes that counted the words outside quotation marks for me.
— u/joseph346
Computational Physics
I’m currently enrolled in a computational physics class, where we
have to do a total of five projects. Most other students are using
Matlab, but I chose Python because object oriented programming
just makes everything so much easier (plus Numpy >> Matlab imo).
So far, I’ve built
A program that solves the radial Schrödinger equation for an
arbitrary potential energy function - basically, determine the ab-
sorbtion spectrum of a quantum system from first principles
School 61
Nuclear missiles
I learned Python by taking a course called Computational Physics.
At the end of the class, we had to do a project.
I made a program to launch a ballistic missile from one city to
another. The program looked up the coordinates of both cities on
Wikipedia, determined which type of missile/warhead to use based
on distance and the country it was launching from, calculated the
flight path, then showed the flight path on a global map with the
blast radius and estimated the amount of deaths.
School 62
I went well beyond what was expected for the project and put a
bunch of Easter eggs in there like responses in the language of the
country you launch from. Pretty sure I’m on a list somewhere for
all of the research I did on nuclear missiles, though.
— u/2hundred20
Reference gathering
I built a Wikipedia-reference-scraper when I was writing my
project thesis. As a Physiology student, this phase of a final year
project is not easy because there is usually scarcity of materials.
It made the thesis writing easy got because I didn’t have to go
looking for research literature and their references. Here is a link
to the GitHub page of the project.
https://github.com/iyanuashiri/wikipedia-reference-scraper
— u/ashiri12
Shopping
Keep the costs down.
Gumtree deals
A script to find good deals early on Gumtree (a craigslist for
London) so I could buy a cheap road bike
— u/lamby
Sysadmin
Python’s home.
IP analyzer
Ignoring stuff that later on turned into full programs, I think it was
a script to clean iptables. I a huge list of IP ranges per country. I
had to:
See which countries are blocked from the server.
Block some country we got constant attacks from.
Unblock a country that we had clients from and some #$(%$
blocked.
Sysadmin 66
Table fan
I’ve used Python to automate my table fan, so that it automatically
turns on if the room temperature exceeds 24C.
— u/Decker108
1 https://imgur.com/a/Ow600
Work
Keep the cash, make the machine work!
Tacking tasks
My boss tracks the total amount of tasks he has assigned to his
employees, the status of each task, etc. Since he’s off I have to
do it, and instead of going through each employee and counting
manually I automated it in an hour or two.
I had to use Selenium to navigate to the site and use the correct
filters, since a lot of other teams work on it and the filters aren’t
passed as query parameters but I guess are dynamically imple-
mented by JS client-side. After scraping the data it exports it to
a csv file and I can copy-paste the numbers into my boss’s file
Since there’s also some pagination and you need to scroll down all
the way to the bottom of the container to load the remaining tasks
and I couldn’t figure it out in Selenium, I just gave myself 5 seconds
to manually scroll down to the bottom. Not a programmatic
solution but a solution nevertheless
— u/Deeziy77
Python saves
So this just happened today. I’ve been learning Python on and off
for a long time. I had to take a couple of classes for my undergrad
a couple years back, and after that, I never really needed to apply
it in my job.
Fast forward to today, my manager was complaining about how
many requests for test data the business team was giving him.
He tasked me with helping him generate the data using Excel and
advanced SQL logic.
I decided to dust off my rusty Python scripting knowledge and
created a script that automated the entire process. It took many
hours, a lot of googling and 2 mugs of coffee, but I accomplished
what I set out to do. My script was able to generate nearly 5000
queries in less than a minute.
Needless to say, my boss was impressed by my initiative, and I’ve
found out first hand how useful knowing Python is. I want to thank
this subreddit for being so supportive and always promoting new
learning resources. Automate the Boring Stuff is a gold mine of
info and I am more motivated than ever before to expand my skills
and knowledge!
Edit: … To those people who are worried about my boss’ reaction,
don’t be. I am extremely lucky to have a boss who cares for all his
employees (even me, the part timer with very little IT experience).
To give a bit of background, he and my father are friends, so he’s
taken me under his wing, teaching me how to handle myself in a
professional environment and helping my career by exposing me to
new opportunities within the project we ’re working on. Needless
to say, over the past few months, I’ve been assigned many different
tasks on both the business and engineering side, learning a lot in
the process that will be invaluable to my career in the future.
Regarding an increase in pay, I’ve put in the paperwork to go full
Work 73
time, and I gained his approval a few weeks back because of how
much effort I put in to making sure I completed my tasks to the best
of my abilities. I think this ensured that he would back me up 100%
if anyone tried to object. Hopefully by the beginning of October,
I’ll be billing for 40 hours instead of 24. …
— u/BoomerangJack
LaunchCode
Coolest thing I did with Python was get me a job. I did a
program called LaunchCode. It’s a 100% free bootcamp that did
job placement after you’re done. 6 months of that, and 1 month of
them looking for a job for me and I’m now a data scientist making 5
Work 74
Work mix
I’ve written 6 or 7 different scripts/programs for work…. Some of
them just sort out data that I have to manually enter at the end
of every month and puts it in an order that makes it much easier
to enter. Another one can use an employee number or name and
output their name (if you used number), number (if you used name),
job title, phone number, and seat location.
The one that took the longest to get working correctly is a meter
reader. I have to collect meter readings from copiers all over the
country remotely… It would take hours to do every month, it takes
two minutes and four seconds now. This one I played with a
lot also… The first version, I used some if statements to decide
variables, then I rewrote it using a dict, and again using classes.
The project I call ‘my baby’ is kinda simple but it was my first
project that I just started from a blank file and wrote it and got
it working. When printing books, they have to be set up to print
double sided correctly, this does it for me… It counts the pages in
an individual file and inserts a blank page behind it if the number
Work 75
of pages are odd, then creates a combined PDF of all the files in a
specific folder in the same folder…
— u/JMB2k
Analysis app
I started as (and still am technically) a data analyst. My position
technically just revolves around SQL and Excel.
I knew some R from grad school and got better with that which
helped me automate many analyses easily making me 10x more
efficient than colleagues. For example, there was initially a report
that would take hours to run in SQL and then would take time to
put into Excel, taking half my day. With R I would just get to work
and have a notification email that the file was emailed to whomever
needed it.
However, the I still had to handle requests from people to analyses
and got tired of it. I tried to make a self-service web app in R (using
Rook) but it was murder. Then I thought to use Python (I briefly
learned basic syntax for it a few years ago) and started with Bottle.
However, that’s not so well supported and I decided to switch to
Flask which was a brilliant decision.
So now I have an app that has all my analyses stored, users can
look up certain products with certain info for each. People ask for
metrics and I get to say “go to the site”. Now I have more time to
learn new technologies to add to the site which my colleagues like
because they get cooler features.
The other way this was life changing is that even though I’m not
a developer, my colleagues consider me a developer and I can
put all this on a resume. I actually left the job I have now for a
programming job (all stuff learned while making this site) but later
went back to my old job after a few months for a few reasons: the
Work 76
It worked really well; saved several man-hours per day and elimi-
nated those transposition errors. It even made us aware of missing
inventory (accidentally deleted or just not arrived yet) before all the
Sales people went home for the day because the playlist program
would flag those. I also made a companion script so that if you
saved the playlist and transferred it back, you could get a pretty
detailed missing inventory report based on those flags.
Not super impressive looking back on it now, but anything saving
money and time in the real world is pretty good for a kid who
was hired to push buttons on a control panel and was just learning
Python. Got a few hundred $$$ bonus out of it too. Pretty good
deal for them, really.
— deleted
Printers status
First Python project was at the school I was working at. I built
a printer scanner daemon that would go out to all the printers on
campus and scrape their webpages to find out Print Count, paper
levels in the draws, toner levels, drum condition, and any error
messages. It would do this once every 10 minutes and store it
in a MySQL DB. Then I wrote a PHP web front end to read the
tables and spit out the data in tables for each printer. I kept history
information so I could use google charts and graph it. It looked
horrible, but it was functional. I ended up extending it to scan all
Work 80
printers that school had for student use. Making modules for each
printer. They could then easily be added to the config file and used
for the printer.
https://github.com/RIEI/printerStats
— u/pferland
my PC. It sure beats requesting a DVD-R every year, plus our data
is always up-to-date.
— u/oblommer
Ready-to-sign doc
50 line script records my time on the job and creates a ready-to-sign
.doc at the end of the month.
— u/pipedings
It was the final “full path” check to ensure the channel was still
going to air.
— u/nikniuq
of work and means I can find something that fits me almost any day.
Lately I have been creating a web app with cherrypy I use cherrypy
for the interface and handle the utility portion with a thread that
shuts down when CherryPy does. I like that I can distribute python
webapps as a standalone exe or scale them up and deploy them on
app engine or ec2.
— u/LightBright32
specs the specs are also displayed and any pseudo element cal-
culations are done at this point and it is also added in the web
page. There are also additions calculations for the production
staff that help guide them to the proper chemistry needed the
calculated additions are displayed at the bottom of the web page.
yield strength is calculated from a set of regression formulas that is
retrieved from an excel file on a mapped drive and displayed also.
The web page is shown on computer screens throughout the plant
in kiosk mode so it’s full screen Also all the JavaScript and HTML
are generated by the software from templates. Sounds complex but
it works and is reliable
— u/baconoligist
WFH status
I have a Raspberry Pi connected to an LED strip, which changes
colors around my door when in meetings, so my kids do not
interrupt me. They turn red while I’m in meetings, yellow when
it is safe to knock on the door to get my attention, and pink (my
daughter’s request) when I’m done working for the day.
— u/addictedtoamp
Circuitry on paper
I have one that uses electric utility GIS data to create PDF maps of
each circuit to use when the field crews need a paper map at job
sites.
— u/shakeweight4000
Work 86
— u/IamImposter
Answering questions
Clients pay me to answer questions. The source data is text,
often CLI output and is very difficult to collate manually but the
answer would potentially enable the client to make some informed
decision.
For example, I recently answered the question of how many differ-
ent manufacturers GBICs are in the network (+30K network hosts)
and the numbers of each part number.
Another client, recently assimilated four different enterprises into
a single network, each using RFC1918 address space. Combined
routing tables were about 30K routes. I was able to show that
by enabling CIDR compression, we could drop the number of
advertised routes below 8,000. They also had no idea how many
DNS/DHCP servers were in their enterprise. By the time the
requester made it back to his desktop I had an answer in his email.
— u/NohPhD
DevOps
I am a devops engineer. I am using python to automate every
boring job I can find. I wrote a riots for an utomated a ci/cd pipeline
that pulls docker images and deploys them on test, does integration
tests and moves them to acceptation. Just finished scripting that
generates kubernetes config from templates where app version and
registry are filled in and committed to git. Wrote a dashboard in
flask that shows which versions of containers are running where.
— u/krav_mark