0% found this document useful (0 votes)
15 views

Python Everyday

Uploaded by

namng000666
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Python Everyday

Uploaded by

namng000666
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 99

Python For Everyday,

Everyone, Every Task


Abdur-Rahmaan Janhangeer
This book is for sale at http://leanpub.com/python-everyday

This version was published on 2024-03-30

This is a Leanpub book. Leanpub empowers authors and


publishers with the Lean Publishing process. Lean Publishing is
the act of publishing an in-progress ebook using lightweight tools
and many iterations to get reader feedback, pivot until you have
the right book and build traction once you do.

© 2024 Abdur-Rahmaan Janhangeer


Contents

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

Organizing boxes with QR codes . . . . . . . . . . . . . . 10


Organizing NSFW materials . . . . . . . . . . . . . . . . . 10
Batch extraction of Zip files . . . . . . . . . . . . . . . . . 11
Coffee making and alarm . . . . . . . . . . . . . . . . . . 11
Sending wife an email daily . . . . . . . . . . . . . . . . . 12
Length from coordinate . . . . . . . . . . . . . . . . . . . . 12
Time remaining for next episode . . . . . . . . . . . . . . 12
u/2q2RS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

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

Dialling until i got through . . . . . . . . . . . . . . . . . . 24

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

• Flask Masterclass2 - Free


• SQLite Internals3 - Free
• Cracking Python4

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.

Helping in the kichen


My mom had a difficult time remembering when she opened
certain things in the fride. I suggested, she should use a pen and
write the date down. She somehow didn’t like that idea.
Since she didn’t like that idea i frankensteined together a raspberry
pi, a label printer, a few physical push buttons and some leds.
Now she can simply press a button to print a perfectly sized sticky
label with the current date and time on it. Somehow she likes this
solution and uses it daily.
In the background there runs a python script waiting for inputs.
Once it detects that the print button is pressed it fetches the local
date and time from a list of ntp servers, converts it info a printable
pdf displaying the data and sends the print command over to the
label printer. The printer then prints and cuts the label to size and
you can stick it wherever you want.
Been in daily use for about 5 to six years. Still going strong.
—u/voxcon

From garage to full script


Simple garage door state script. It was my first project and it
has evolved into a complete security system. It now incorporates
Home 3

7doors/locks, 2 motion sensors, 3 refrigerators, and 2 cars (lock-


ing/unlocking).
— u/duckredbeard

Checking Pizza prices


Not daily. But a web scraping script that looks for changes on a
pizza place menu to see ingredients and prices changes and save
it to a small SQLite database. Another companion script to select
a pizza with given ingredient and returns selection of pizzas with
same price range.
— u/mahousenshi

TLDR: I named my first-born son


with the help of a Python script.
When my kid was born I had a name in mind for him but no one
else seemed to like it. So my choice was overruled and my wife and
I stalled for a long time on what to name our kid. Time flew by and
we were a week or so from the supposed deadline to name the kid.
Being Chinese comes with its own unique set of strange cultural
practices. One of them is getting a geomancer/fortune teller to
come up with a name for children. My family didn’t do this (I’m
guessing because my dad is literate), but my wife’s family did
(which I guess is due to her mom being illiterate). I don’t believe
in that fortune telling crap, but it looked like it was the only way
to break the deadlock. Pay some guy $88, and he comes up with a
list of Chinese characters that would be suitable for my son’s name,
based on when he was born.
Home 4

A brief intro to modern Chinese names. We all have a surname or


family name passed down the paternal family that is one (rarely,
two) Chinese character(s). It is then followed by one or two more
Chinese characters, which will then make up your entire name.
The fortune teller came up with two sets of characters, one for the
first character following the surname and another for the second
character. I then wrote a Python script that spit out all permutations
of his name based on those Chinese characters, printing alongside
the hanyu pinyin “translations”. The script originally read out the
names in Chinese too, but we found the computer voices irritating
so I removed that feature.
Wife and I went through that list of 144 permutations, crossing out
all the names that look bad in English/hanyu pinyin. We then read
out the remaining names one by one and crossing out those that
sounded bad. That produced a list of about 12 names. I liked one
of them a lot, wife didn’t like any of the names. We were now days
away from the deadline.
In the end, we went with the name I picked from that list. The script
isn’t exactly clever in any technical way, but hey, I don’t know of
that many people who got named with the aid of a Python script.
— u/xorandor

Finding incomplete items for


wedding
My fiancée and I are using trello.com to plan our wedding. She
wanted to know if I could dump all of our incomplete items into
a a single text file. I looked up the trello python API but it didn’t
have an interface for checklist items. I wrote a patch that added
an interface, created the text file, and submitted a pull request that
was accepted. Now anyone who needs to do something similar can
as well :)
Home 5

— u/BioSammyj

Finding the time taken for tasting


meads
I was brewing mead, and had to take a unexpected trip out of state.
With no way to keep track of the fermentation, I did the most
logical thing. I hooked up a webcam, pointed it at the air lock and
made a python script using PIL to compare images taken with my
webcam…each image basically enumerated to a value..when that
value exceed a certain threshold, I could safely assume gas was
release causing a bubble. As soon as that happened I would mark
the Time/Delta time between the bubbles into a database (I used
HBase , why the hell not?).
I then made a small web interface in flask to query HBase for the
average delta (which slowly increased). I also made a page which
would accept an integer (http://<ip>:8080/last/<int>) and then
display all the bubble data for the past <int> seconds.
— u/monstrado

Chicken coop door control


My wife built a chicken coop, and we have four chickens. I devised
a motorized coop door connected to a netbook via a USB-enabled
microcontroller. I then wrote some python to send the proper bits
to the microcontroller to open / close / stop the door.
At first, I had this in a cron job… but being in a fairly northern
latitude of North America the length of the days changes fairly
rapidly about this time of year. So, I discovered the PyEphem
library, which allows the coop to compute sunrise and sunset times
accurately given the local lat / long coordinates.
Home 6

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

Reading codes on all PCs


I like to download and read other peoples github code on my comps
editor. Best way to learn I think, but it sucks to have to go into
each of those directories and git pull updates. Having multiple
computers meant doing that twice.
So I wrote a script. I list github username or particular repos that
I want to follow in a dotfile. I linked that dotfile to my dropbox
so it syncs on all my comps. Now my script reads that dotfile and
checks and update/deletes repos for my reading pleasure. Peeping
just becamse so much more pleasurable.
— u/happysri
Home 7

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

Learn a new word everyday


I configured my terminal to teach me a new word everyday! Every
time I open a new terminal window, I have a python script that
scrapes dictionary.com and gives me the word of the day. On top
of that, I have a motivational quote displayed as well :)
— u/ImportantDesk

Desktop background based on


weather
I wrote a desktop manager. It got the weather from the internet, and
then made my desktop background related to the current weather
in my area.
— u/Pseudoboss11
Home 9

Disabling my network during dinner


time
Disabling my network during dinner time by placing my phone on
a hockey puck. No Xbox, Netflix, Facebook, Roblox.
I pull the phone off the puck after all the kids have their dinner and
after dinner chores done.

Saves some time opening websites


Every morning I would visit 7 different websites for news, emails,
reddit update, etc. I wrote a 9 lines of code Python script to open
the web pages using the webbrowser module; save me at least the
hassle to manually open the pages by hand.
— u/jiejenn

Choosing the right housing unit


I transferred between units at my apartment complex in October.
In order to find my new unit, I wrote a notebook that I ran daily.
It would scrape the complex website for available units and their
prices. I hard-coded criteria like the buildings and floors I was
interested in, rent price range, etc. I stored the data in SQLite so
I could watch pricing trends. I never finished it fully (notebook to
script, cron job, push notifications) but it helped me find my current
unit, which I love, and helped me choose the right day to jump on
it based on pricing trends.
— u/BrewingtonCreek
Home 10

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

Adjusting IKEA blinds


Am a contributor to an open source project, Home Assistant, so me
and my son created a Python script that changes the height of our
IKEA blinds in the kitchen according to the time of day (unless it’s
cloudy according to the weather report, in which case it opens then
fully), is the height of the sun; then at sun down it lowers them until
sunrise.
— u/MrHarcombe

Organizing boxes with QR codes


I organized my moving using flask, QR codes and SQLite to keep
track of where each box was and what it contained.
— u/varisleny

Organizing NSFW materials


I wrote a multiprocessing Python script to automate downloading
… um… work-safe-questionable material from certain websites.
Home 11

It was really overengineered, using multiprocessing queues, retry


& backoff algos, and lots of … other stuff.
Also wrote a very fast script that can identify duplicate files. Took
only 1 minute to scan a nearly-full 512 GB SSD. And yeah the dupes
were related to the first script
Ah the duplicate scan I can easily share. It’s … not incriminating

Here it is: https://gist.github.com/pepoluan/a97409d1f2b838460aac9aa46df43c08


(Please note there’s a requirements.txt file in that there gist…)
ETA: So basically, I ‘cheat’ a bit. For large files, I only check the
‘heads’ and ‘tails’ first. Only if their heads & tails are identical will
then I do a fast hash (using xxHash) of the whole file. Small files
whose heads & tails overlap got whole-hashed the first pass.
I do believe some optimizations can still be done on my
“dupefinder” code. Feel free! (It’s also released with MPL-
2.0 license so you’re free to include it even in proprietary software)
— u/pepoluan

Batch extraction of Zip files


Batch extraction for zip files in my plex library. Sometimes large
packs have individually zipped files. Script watches the folder and
extracts accordingly. It was the first personal piece of code i wrote
probably 5 years ago. Still appreciate it today
— u/Scolli03

Coffee making and alarm


Coffee alarm clock automation, alarm is defined by alarm MQTT
app and once I dismissed the alarm clock (time to wakeup)
Home 12

it will activate the coffee machine which is connected to the


Raspberry Pi: https://www.reddit.com/r/raspberry_pi/com-
ments/t2ljcq/raspberry_pi_cm4_automated_morning_coffee_-
alarm/
— u/Zontexo

Sending wife an email daily


I send my wife an email daily. It selects a random photo of me or
our dog and has a sweet “good morning, I love you” type message.
Check a db to see if it’s a special day (birthday, anniversary, holiday,
etc), which changes the message and uses a specific photo.
I have running on a raspberry pi, but I’m working on migrating to
the cloud.
— u/curiousNarwhal69

Length from coordinate


I had to measure a somewhat skewed corner of my apartment for
some custom shelves. I made a script that generates coordinates
from side- and diagonal lengths.
— u/Xelaxander
Note from ARJ: Should give this one an award

Time remaining for next episode


I wrote a script which tells me the time remaining for the next ep,
can be anime/show , I made it into a bot and it’s on my discord
server
Home 13

— 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

Moving the mouse


I have one that it took me 5-10 mins to build and I have it running
24/7 on task scheduler since early 2022. It’s a laptop mouse shaker,
it slightly moves every 10 mins.I work for a finance company that’s
is a big brother.
Our internal system flags gets flagged every 15 mins that there’s
no interaction with the pc while you are logged in. And when that
happens, managers get an automated email to check in with that
person since we’re wfh.
— u/Wallstreetbettss

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

automatically store the quote onto an SQL database within our


network so we can look it up later. I made a little search engine
that allow these quotes to be looked up using engineer’s name or
company name and hopefully when I get enough data, we can do
some number crunching to determine price increase/decreases as
appropriate to be competitive. Everyone I’ve shown the app to has
loved it so far and our managers are looking to implement in to our
entire engineering team in north america.
— u/polysynth

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.

Sending pictures to Google frame


photos
It’s really basic but my mom has a digital picture frame that you
can email pictures to. Once a week I grab pics I want to send to her
frame from Google Photos (not automatically because the Google
Photo API sucks ass) and download them.
Then I use the script to email them to the frame; the only “business
logic” there is that I need to split it up into chunks of 25 MB each.
— u/lagerbaer

Emailing a random picture to my


mom everyday
My mom wanted me to send her pictures of my son every day. I
didn’t trust myself to remember to send a picture every day, so I
wrote a script that picked a random picture out of a directory and
e-mailed it to her. That directory is in a dropbox folder, so I could
take pictures with my phone and upload to that directory with a
few taps. That way I could build up a few days buffer, and not
have to remember every day.
— u/AusIV
Pictures 19

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.

File with links


Mine is a web scraper. It’s only like 50 lines of code.
It takes in a link, pulls all the hyperlinks and then does some basic
regex to pull out the info I want. Then it spits out a file with all the
links.
Took me like 20 minutes to code, but I feel like I use it every other
week to pull a bunch of links for files I might want to download
quickly or to pull data from sites to model.
— u/HiT3Kvoyivoda

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

makes it very hard/slow to extract information about jobs (jobs are


essentially just small programs that run on a set schedule defined
by the user). But Control-M lets you extract jobs in XML format.
So here’s where python comes in. I created a personal use python
script to extract all the relevant info I need from the XML file and
spit it out to me in plain text, neatly organized. It takes less than
a second to process and saves me at least 10-20 minutes of manual
work every time I use it, depending on how big the job is in terms
of number of prerequisites (in-conditions) and out-conditions.
— u/pendulumpendulum

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.

Checking for airfare prices


Web scraping for me too. I fly a lot. Checking southwest on the
app for price changes used to be easy, but when you have 8 flights
booked at once it becomes cumbersome. So I built a script to check
flight prices for my currently booked flights and notify me if the
price has decreased more than X amount. It’s been really handy
for my use case, and thankfully hasn’t broken yet despite relying
on the southwest UI to stay the same.
— u/TobofCob

Dialling until i got through


I had a flight scheduled to New York City during the blizzard in
2010. I had to reschedule my flight, but it was absolutely impossible
to get through to airline reps on the phone, and they were literally
kicking people out of the phone queue because it was full. I wrote
a python script using the twilio API to automate redialling the
American Airlines customer service line every 2 minutes until I got
through.
— u/zoomah
Money
Be informed about the juice.

Scanning bank transactions


To help with taxes this year, I wrote a small library to batch extract
all the transactions from my pdf bank statements into an indexable
database. Made it super easy to search for specific expenses across
all my accounts/credit cards so that I could dump it all into spread
sheets to itemize for taxes.
Something I’ve been wanting to do for years. Saved me hours if
not days from having to go through them all by hand manually.
Probably will expand upon it for next year.
— u/azshall

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

Lottery check automation


Some of my friends at my former place of work and I started pooling
money to play Powerball lottery. It was a buck a week per person
for a chance to win millions. We regularly forgot to play or to
check numbers and there’s the ever-present risk that someone will
not show up on Monday and later send a postcard from the Cayman
Islands after absconding with our winnings.
Anyway, I wrote something to make it easier for us to get rich. It
generated the numbers, emailed them to the members of the pool,
parsed the lottery website for the winning numbers, compared
them to our numbers and emailed the results highlighting the
number of matches we made.
Worked, but never got rich. :(
— u/ergotron

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

all of my roommates could make the deadline. So I made running


totals of what everyone owed me and stored them in a sqlite db.
It made life easier when someone would ask me how much they
owed me and I could just run the script to find out.
— u/wilywes

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

Credit card statement aggregator


for the entire family
Credit card statement aggregator for the entire family. Some
statements come in PDF format, others in CSV, so made loaders
for each bank and credit card company, to have the transaction
Money 28

in the same place, for transparency on our expenses and budget.


I’ll probably also employ some OCR to get details from photos of
receipts from supermarkets, to get details about where our money
is going to. The scope of this is to be able to translate and deduce
stuff like “If we stop buying expensive mushrooms and stick to the
cheap ones, we will be 100k richer by the time we retire”.
— u/coffeewithalex

Bank Python

Everything. The entire financial stack1 is built in Python.


We take in the data from outside sources using web services
running on Python that saves it to an object database where it is
then picked up by an automated process, in Python, that normalizes
and inserts it into the relevant relational database. The database
management scripts that run hourly, daily, weekly, whatever,
they’re all in Python. The scripts that generate client reports are in
Python. The scripts that update important risk data are in Python.
We have other services as well, like JMS for bulk message pro-
cessing and various monitoring tools, but Python is the foundation
everything sits on.
— u/treasonousToaster180

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

Basically it takes in a list of numbers (eg: different expenses)


and finds out which combination of those expenses equals a goal
number (eg: which expenses that are used for the Cost of Sales
total) and allows for some leeway incase of rounding errors.
Unfortunately any more than ~25 numbers slows it down exponen-
tially. I’m going to try find faster ways to solve it later.
— u/b_ootay_ful
Networking
Look what those packets are doing.

Checking for active ports on


switches
I have one that runs every two hours via a scheduled task to check
which ports on our network switches are active and writes to a
SQLite DB. It’s been going for at least five years now I think.
— u/routetehpacketz

Updating DNS
A script that checks the my public IP address and automatically
updates all my DNS records if it’s changed
— u/linuxfarmer

Re-login on session expiry


My network provider has this thing that every 10-20 hours the
current session expires and you’d have to go and login through
their portal again to resume your connection . It was a hassle so
i setup a service that’d keep checking if the wifi is up and if it goes
down it’ll try to login with my credentials every few seconds . Sorta
expensive processing wise , but it gets the job done . No need to
login manually anymore.
Networking 31

— u/kawaiibeans101

Notified when networks fixed


After college and before my first job, I was living at home (This was
the late ‘00s). My dad had a special work from home vpn router
and my computer had linux. For some reason these did not play to
together well, so my network access was inconsistent.
I wrote a python script that would try to ping google every 2
minutes. If it failed it would beep. If it succeeded it would quit. So
when the network failed I would start the script and do something
else until it stopped beeping.
— u/dysprog
Files
Keep them tidy.

Redacting specific data fields


A script for redacting specific data fields in PDF documents.
I used to do it by hand with a fat black sharpie. Now I do it
automagically with a python script.
They get printed and submitted on paper, so i don’t have to
worry about the fact that the “redacted” information is still in the
electronic document. That is a solvable problem, too, but I haven’t
had the need to, yet.
— u/Reinventing_Wheels

Manipulating DSLR files


I wrote a script that reads my DSLR’s memory card, finds all the
.mov, .jpg & .nef (raw) files then it checks my hard drive and copies
over only the non-existing files to separate folders based on type.
it gives a summary and ejects the card when its done.
works in concert with my google drive app that uploads them to
my account
— u/cturnr
Files 33

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

Moving files from GDrive to


BunnyCDN
I’m moving all my files from Google Drive to BunnyCDN using
their API and if file is duplicated it doesn’t upload the file. Right
now I’ve moved 3TB of data
— u/Mick877

File sorting report


my download folder gets so crowded easily with all types of files
so i wrote a script that sorts the files into folders based on the file
extension , then emails me a report. i created a cron job to run the
script at 5am every Saturday so i start my weekend knowing where
to find anything i downloaded
— u/FearIsStrongerDanluv
Files 34

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

The nuke command

A command line tool to nuke a directory called ‘nuke’. Now you


might wonder why not just do “rm -rf *”. Well, nuke has the
option of reading a .nukeignore file (similar to .gitignore) in order to
determine which files and folders should not be deleted. By passing
in a parameter, you can also print out the directory tree of all the
files that will be deleted. This way, you don’t need to worry about
accidentally deleting useful or important files.
— u/varunagrawal

Reverse engineering file


Reverse engineering a super complicated binary file and making it
read at 500 MB/second. Binary files are incredibly fast if do it right
Files 35

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

Spotify wrapped ahead of time


Script that pulls my song listening history from the Spotify API
scheduled via Airflow which gets output into a dashboard so I don’t
have to wait until Spotify wrapped gets released.
— u/snuggiemane

Crossposting to FB and Twitter


just this week, I wrote myself a script to cross-post to Twitter
and Facebook at the same time. I spend most of my time at
a commandline, I figured I should add the ability to shout my
thoughts randomly into cyberspace.
— u/neoice
Social Media 37

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

Deleting all content of my Facebook


profile
Deleting all content of my Facebook profile (photos, comments etc.)
with a Selenium script. Because that site has no such option. Even
the script took hours to delete all of that.
It was a really ugly code and it stopped working a few times even
when I used it myself because the layout of the pages has changed.
Social Media 38

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

I wrote a “today in history” type bot that posts daily to a subreddit


and send an email and txt message to me when done.
— u/wsppan

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

person’s name. In case the person was a relative, it would respond


with the correct honorific.
— u/varunagrawal

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.

Detect when sound mode changes


Every once in a while my pc switches audio from 5.1 to stereo. It
takes a while to notice when i’m in a game and there’s no sound
behind me, etc.
So I have a script on my taskbar to just play quick beep out of my
rear speakers. It’s faster than going through the menus, and i use it
daily.
They are also wireless surrounds that sometimes lose their connec-
tion. The beep also detects that.
— u/snowmyr

Edit podcast recording


I wrote a script to automatically edit our podcast recordings. It’s
decent enough that we sometimes post before even listening.
— u/Robinsane

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

a script to convert a playlist in iTunes to mp3 format, name all the


files consistently, and burn it to a CD which I can then play in the
car. It’ll estimate (badly) whether the playlist will fit and bail before
converting to MP3 or before writing to disk if the playlist is too big,
and allows me to tweak the quality/filesize.
— u/hairlesscaveman

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

Downswing and upswing


I wrote a script that checks the prices of the stocks I own everyday
and compares it to a rolling average to determine if the price is
coming out of a downswing or upswing and advises me whether
or not its a good idea to think about buying more. If it tells me to
buy i look into it myself before making a decision, I dont follow it
blindly.
— u/badalki
Driving
Nifty road hacks.

Should i leave early?


I wrote a script the check the highway driving conditions and
weather and send me a text in the morning if I need to leave earlier
than normal.
— u/cliffwarden

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

Console for Minecraft servers


I’ve been running a few Minecraft servers for 5 years. Along the
way, I needed a web-based console for them. I could have used SSH
from my phone, but designing a single console from scratch gave
me more control over everything, plus allowed me to build out a
nice interface for it. I used websocketd paired with Python to create
it.
— u/gambiter
Legal
Python can keep you out of troubles.

Stopping stalking accusations dead


in it’s track
Years ago, I was involved in some vexatious litigation, with a person
who was keen on making false accusations.
The problem with accusations, is it’s difficult to prove a negative.
So, in addition to keeping a hidden pocket audio recorder on me at
all times (in case of unexpected personal encounter), I wrote a script
that monitored my GPS location on my Google phone, saved it to a
database, and generated daily Excel and PDF summaries, with the
PDF having a map screenshot, GPS coordinates, street names and
addresses, and human-readable timestamps and time durations…
and then had that PDF emailed to my attorney every night at 12:00
AM.
My whereabouts were accounted for 24/7: that way, if she said
something like “he was stalking me and threatening me at Tar-
get, and then followed me home,” well, I had the motherfucking
receipts, e.g., “yeah, he was at home all day on Tuesday, except
between 4:21-4:57 PM, where he went to Dollar General 4.2 miles
away to buy a plastic storage bin, a Slim Jim, and an orange sugar
free Monster. Here’s the map with GPS coordinates with time
codes. And here’s the physical receipt for that purchase as well.
And here’s his printed text messages for the day, and time codes
(with messages with others, verifying his location at home), and
phone call logs, and emails he sent out that day. And here’s before
Legal 47

and after photos of his odometer, when he went to Dollar General.


8.4 miles, a 4.2 mile round-trip. Note the photos have EXIF tags
with GPS coordinates and timestamps. The GPS coordinates align
with the map printout. He didn’t stalk anybody.”
The accusations stopped.
I never had to use it in active litigation in front of a judge, thank
goodness. Having it on-hand was an insurance policy, and, when
she started a new round of accusation fits, my attorney showed op-
posing counsel just a wee bit of our preponderance of contradictory
evidence (just a taste), and then opposing counsel understood what
was up (his client was full of shit), and he scolded her in private to
cease and desist (shut the fuck up and stop hassling this guy if you
don’t want to go to jail at some point). I wanted peace more than
I wanted another “win” with just some more “gotchas” for court (I
had plenty of evidence regardless, and I eventually won my cases
anyway), and this helped make that peace and quiet happen. It
was worth it to let the attorneys have a conversation, so opposing
counsel could shut down the accusations and threats on his end.
I never wanted litigation in the first place. But, if someone declares
war, the peaceful farmer has to put down his plow and pick up a
sword anyway, with an aim to win, if he hopes to ever return to a
peaceful life.
As for the Python bit, it didn’t live on my phone. Google has APIs
for accessing all your data sent to them, including GPS location
tracking data. So I decided to go “anti-privacy” and track and
document myself as much as possible. You can turn up location
tracking to full-throttle, and then query the API for that info
(coordinates and timestamps), then run those coordinates through
an API to get street names and addresses, then run that through
Google Maps API to generate a plotted map and routes, and so on.
And a bit of Python magic to run the API calls, store the data in
SQL, generate a nice PDF for the day, and email it to attorney. So
that’s what I did. Just some cron jobs running on an AWS Linux
Legal 48

instance.
— u/be_bo_i_am_robot
Games
Get an edge.

Sharing Stardew Valley screenshots


For me, the biggest project came from playing Stardew Valley and
realising there was no way to share screenshots of my whole farm
with my friend.
Together we wrote a tool to generate the screenshots from the
savegame (using defusedxml and Pillow), and developed it into a
website (using Flask, requests, and psycopg2) so that anyone could
use it. Server-side it’s 100% Python. I used it mainly as a way to
learn Flask and SQL, which I’d never used before.
Anyway, we built on the site and developed an automatic uploader
tool to sit in the system tray and watch the game’s saves for updates,
then automatically upload them to the site. The GUI was built
using PySide, later rewritten in PyQt5. This was my first real use
of freezing scripts (cx_Freeze for Windows and Pyinstaller for the
Mac version) to build .py files into a “normal” executable. It was
pretty good fun, and a great way to learn the packages.
The site became quite popular within the Stardew Valley commu-
nity on Reddit, which helped to push me to complete things where
I’d probably have abandoned them before. Building something
actually useful to people really pushed us not to give up, and coding
with a friend was also really helpful - having someone who is as
focused on a project as you are yourself means you’ve got someone
to discuss issues with. The project came up in my friend’s most
recent job interview and he was ultimately hired, which was a cool
side-effect of it too.
Games 50

— u/Lokili

Hunting for shiny Pokemons


I developed a script for pokemon fire red shiny starter hunting.
It basically clicks same keys in order and checks the color of the
charmender and resets if it is not shiny. I start it when I go to sleep
and hopefully one day I will wake to a shiny charmender.
— u/coolworm

Making EVE online money


I used to play a videogame called EVE Online. It was different than
other MMOs in the sense that you can buy gametime with in game
money if you make enough. The market is also completely player
driven. If you select an item in the game and click Export, it saves
the price information from that region as a text file.
I wrote a Python script that would take those files, calculate which
ones would be the most profitable to trade, and export it to a
spreadsheet. It worked surprisingly well, making me enough in
game money to play for another month. And it only took about an
hour or two per week.
— u/smew

Dungeon name generator


I wrote a very silly dungeon name generator for a little roguelike I
was working on. It works as a module, but also spits out ten random
names if you run it from the command line. It generates some very
hilarious names, as well as amazing appropriate ones:
Games 51

Firetethe, Prison of the Jealous Robots Leechcorrie,


Mines of the Embarrassed Otaku Windlewan, Crypt
of the Terrible Unknowns Spleendal, Necropolis of the
Unsightly Hippies Dalwithy, Mines of the Amorous
Degenerates Cliffegate, Cave of the Feminist Kings
Woodwithy, Crypt of the Repulsive Ninjas Cobfire,
Dungeon of the Sparkling Robots Hornewold, Tomb of
the Moronic Unknowns Bentarvale, Reformatory of the
Perverted Titans

— u/sli

Better hero draft


It was kind of dumb but I play dota2 and wanted to see if I could
make a program that would pick the best hero draft versus another
team. I wrote a program that would pull all the ranked games from
dota’s api and then give me the winner and loser as well as the
heros they picked. I broke down all the heros into a common 20ish
different traits (which took forever) based on their skill set,position,
and role on the team. So now I had this big database of winning
team compositions vs losing team compositions. When I started
the draft I would input our picks and the enemy team picks and the
program would go through the database looking for losing teams
with similar compositions based off of the traits I had given the
hero’s. Then it would look at the heros my team had picked so
far and try to fill it in with heros that would best fill the required
composition traits to beat the enemy team. It got much more
accurate as more heros were picked, allowing it to narrow down
the pool of games to choose from. It gave me pretty good results,
some I would have picked and others I wouldn’t have considered
until I saw them pop up. I dont think I explained this program very
well just now, but it was my first project ever and I did it over this
past summer and I enjoyed it a lot
Games 52

— u/happybanditman

Picking game from steam


I have about 300 games on Steam and an inability to pick one to
play so I wrote a script to pick a random (installed) game. It finds
the Steam install location from the registry, reads a config that’s
nearly JSON (so I patch it to be JSON), then it figures a couple of
things out and picks me a game.
I’ll probably turn it into a exe for general consumption and might
support Desura and general dirs too if I get bored :-)
— u/ahri

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

Coding an autosave feature


I played a game wich hasn’t an autosave option, however a quick-
save via the button F5. So I coded a Script to press F5 every 5
minutes
— u/XxChrisBizkitxX

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

Mystery game by email

A script to randomly pick a “murderer” for a (remote) murder


mystery party. It sends emails to the participants stating if they
are the murderer or not!
— u/hawkes

Stops mining to play game


Script that automatically stops mining ethereum, if I start playing
a demanding game
Games 54

— u/Or4ng3m4n

Managing my baseball team


Every year I draft 25 fantasy baseball teams. I wrote code in Python
that manages my teams for me throughout the season. It adds
and drops players for me, makes waiver claims, and sets my daily
lineup.
The code saves me hours of time every week. And it’s very good
at managing the teams.
Last year, I ended the season with the 3 top teams on ESPN. I also
had 7 of the top 10 teams and 15 of the top 35.
This year, I wrote code that automates the draft room, too. I do
auction drafts that normally take about 3 hours each. My code
drafted my teams for me. It used real-time linear programming to
optimize my bids.
I use python every day at work, usually for web scraping, data
wrangling, and building predictive models.
— u/tinycorkscrew

Ultima online skill gains


Some years ago, I used to play an MMO called Ultima Online. I
only ever played some of the free/private servers and stuck to the
old school version. The server software was open source so I dug
through to figure out how skill gain works. Skills can be between
0 and 100, and you can raise a skill anywhere between 0.0 and 0.4
points in one action. You can have a maximum of 700 skill points.
I focused on maximizing crafting skills. There are several factors
in determining how likely you are to gain skill:
Games 55

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

Bookkeeping for tabletop RPG game


I’m currently working on a Discord bot that can handle all the book-
keeping for a tabletop RPG, à la D&D: initiative, health, locations
(both tactical and worldmap), attacks/checks/saves, journal entries,
descriptions and items, even background music is being handled by
it.
— u/Pseudoboss11
Notify Me
is it finished?

Is my media server down?


I have a script that pings my media server and sends me a notifica-
tion on Discord if it’s down every time I turn on my PC.
— u/BlackHumour

My renders are complete


I used to have a simple script that would send a text message to my
phone whenever renders were complete.
— u/Breyker4711

When there is an opportunity


Back in school, I couldn’t afford a smartphone data plan, but I did
have unlimited SMS. Especially while I was interviewing for jobs,
I wanted to know ASAP when a company or the University career
services office sent me an email, so a wrote up a Python script that
scraped my gmail account on my laptop every 5 minutes, checking
for senders that matched a whitelist, and sent me a text with the
sender and the first 25 characters of the email subject.
Most people wouldn’t have any use for a script like this now, but it
was invaluable for a cheap college student.
Notify Me 57

— 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?

Bisection method securing an A+


For a calculus class, I wrote a script that calculated the bisection
method, it took about 10 minutes, nothing too complicated. I
printed the output in terminal and handed it in, getting an A+. It
took other students around an hour to do it by hand.
I printed the source code and handed that in as well. I said
something like, “Trust me, understanding the bisection method and
turning it into this was much more of a challenge than using a
calculator and robotically doing it by hand” to which he responded,
“…I suppose you’re right. This will do!” Hahaha
— u/aflashyrhetoric

My college had no waitlist


My college had no waitlist program so when a class was full the
only way to get in was to wait until someone dropped and then be
the first to take the newly open spot.
I wrote a python program that checked the webpage every 2
minutes to see if there were any open spots and sent me a text
message if there were any. Got me into all the classes I needed.
— u/spinnelein
School 59

Securing an A in photography test


I actually had a similar experience. This one isn’t that impressive,
but it was pretty good for a simple script and it worked really well.
I was taking a photography class, and was studying for a test on
exposures (basically, as you adjust one aspect of an exposure you
have to compensate with the other, but the measurements you use
aren’t 100% intuitive). It wasn’t going to be that hard, but the thing
is that our book didn’t have very many examples, so I was afraid of
making a stupid mistake due to lack of practice. So I made a script
that would generate random exposure problems. It would give an
exposure (say, f/4 @ 1/125), and either ask for an equivalent or an
exposure with more/less light, then give the closest answers (all of
these have more than one answer, like asking for a fraction equal
to 1/2, but it gave the nearest answers). I ended up getting an A on
the test.
— u/StaticDuo

Simulating ecology homework


One time in high school, in an ecology class of some sort, for
homework we had to do this experiment where we tossed pieces
of paper on a grid and where they landed determined how many
foxes or rabbits to kill off or something like that.
We had to do this 100 times or something, and naturally I wasn’t
having that. So, still being a relatively inexperienced programmer,
I spent about six hours writing a Python program to physically
simulate the game.
— deleted
School 60

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

Perfect scores on Open long exams


I took a class that gave REALLY long exams on tight deadlines that
were open book and open (physical and digital) notes so I wrote
solvers in python for the various problem types. I would input
the specifics and it would output the perfect solution, correctly
formatted with all of the steps. I then just had to copy it down
on my paper. It got me perfect scores without violating any rules
:-)
— u/malakh

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

A program that determintes the finite-temperature behavior of a 2D


Ising model ferromagnet, with or without external magnetic field
A quantum tunneling simulation, which can determine the current-
voltage characteristic of simple diode devices
And I’m currently working on a molecular dynamics simulation,
which should be able to determine properties of a gas of particles
for an arbitrary interaction potential.
Using Python’s object model makes my code easy to debug and
extend, and Numpy has an amazing set of tools to do easy and ef-
ficient array manipulation. Meanwhile, Matplotlib has an amazing
visualization toolbox (though I wish the API was a bit more stream-
lined at times), and some modules are just great for convenience.
At one point, the simulations were taking long enough that I just
imported tqdm to add progress bars to some loops - now I know if
I can pop off to get a cup of coffee while waiting for results!
If you’re interested, the code is here. It’s not perfect (especially
since we have deadlines every two weeks), but it’s functional :)
All in all, I’m really glad I decided to check out Python a few years
ago, honestly changed my life.
— deleted

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

Help with formatting


Probably won’t sound so cool, but it makes my life easier. Some
sidenotes, am not a programmer but a law student and because of
my extensive math/physics background (long story) I use LaTex for
all my essays and stuff (cause I ain’t no word cuck). Last point of
side notes - my uni uses super custom citation rules, there is literally
no one else who uses this style, trust me I looked. So basically
BibTex won’t cut it (I tried to make custom style but even that can’t
use all the specifications I am required)
So, the project: I made CLI “program” in python that prompts me
for all the required inputs and then creates \newcommand in my
custom LaTex package that I can later call in the document passing
it page number or § as argument and it spits the citation where I
need it.
I also write notes about the works I am citing into the package
file so I can search for the works later. I did this over the winter
break and now am waiting for another break and would love to
figure out how to “section” them, meaning that in the package file
all the works concerning intellectual property woul all be grouped
together under such section etc.
— u/PrettyMuchJudgeFudge
School 63

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.

Recovering usernames and


passwords for crashed server
Our mail server crashed and we didn’t have a backup of the
usernames and passwords. I wrote the most insecure script ever
that would check the dovecot logs, grab usernames out of it, put
them in the database, then when they tried again, grab their plain
text password, hash it and put it back in the database. Saved us a
lot of head aches. And yes, this was totally insecure, but as a 20
year old, new sys-admin, it was pretty cool and made me get into
programming.
— u/_meshy

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

Around an hour or two by hand. My boss gave me free time when


ever I saved the company time, so 10 minutes of coding, 5 minutes
of testing (running it dry) and then 40 minutes I got paid for to do
what ever I wanted.
— deleted

Managing 8000 machines


Recently I finished a python program that accepts a list of host-
names and a list of shell commands then executes the commands
on the remote computers. I have 8000 linux machines to manage.
Sometimes I need to get very specific information from them that
our other management tools can’t quickly provide.
— u/edmanet

Distributed phone system


I run I.T. operations for a manufacturer that relies heavily on
inbound phone sales, so as part of my duties I am in charge of what
I’ve developed into a distributed phone system that can interface
with in office sales staff, at home staff, 3rd part call centers, etc.
Since we have two different call center partner companies currently
in addition to our own staff, we needed a way for executive staff
to get a top level view of performance data in near real time, so we
developed a Django application for the purpose. Or partner centers
automate report drops via SFTP, which kicks off the import jobs
that can handle any file format they use. Numerous reports and
charts are then available in a simple, consolidated interface.
Once we have a few weeks of individual sales agent data we can
import data from the media team to predict call volumes by half
hour, import agent schedule data, and based on individual agent
Sysadmin 67

performance predict revenue, abandoned calls, individual agent


commissions, etc. We’ve also developed an automatic scheduling
algorithm that uses individual agent scheduling preferences and
performance and various parameters (min, max shift length, splits
allowed, etc.) to auto generate the “ideal” schedule optimized for
either max revenue (sales) or maximum call handling capacity
(customer service). Typically the algorithm schedule will yield 5%
to 25% more revenue with a 10% to 15% reduction in man hours
compared to hand created. It also is created as soon as the app has
data for both agents and media, so it just appears magically there
for the end users as compared to an hour or so each week to create
it.
All python, and not even really scratching the surface of total
python use at my company. We use it for everything.
— u/radministator
IoT
Python connects.

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

Helping in the kichen


My mom had a difficult time remembering when she opened
certain things in the fride. I suggested, she should use a pen and
write the date down. She somehow didn’t like that idea.
Since she didn’t like that idea i frankensteined together a raspberry
pi, a label printer, a few physical push buttons and some leds.
Now she can simply press a button to print a perfectly sized sticky
label with the current date and time on it. Somehow she likes this
solution and uses it daily.
In the background there runs a python script waiting for inputs.
Once it detects that the print button is pressed it fetches the local
date and time from a list of ntp servers, converts it info a printable
pdf displaying the data and sends the print command over to the
label printer. The printer then prints and cuts the label to size and
you can stick it wherever you want.
Been in daily use for about 5 to six years. Still going strong.
—u/voxcon
IoT 69

From garage to full script


Simple garage door state script. It was my first project and it
has evolved into a complete security system. It now incorporates
7doors/locks, 2 motion sensors, 3 refrigerators, and 2 cars (lock-
ing/unlocking).
— u/duckredbeard

Chicken coop door control


My wife built a chicken coop, and we have four chickens. I devised
a motorized coop door connected to a netbook via a USB-enabled
microcontroller. I then wrote some python to send the proper bits
to the microcontroller to open / close / stop the door.
At first, I had this in a cron job… but being in a fairly northern
latitude of North America the length of the days changes fairly
rapidly about this time of year. So, I discovered the PyEphem
library, which allows the coop to compute sunrise and sunset times
accurately given the local lat / long coordinates.
So now, the coop door automatically opens after sunrise and closes
just after sunset. Thanks, Python!
— u/phreakmonkey

Control radio transmitters


I designed and deployed a system using Raspberry Pi and Python
3 to control radio transmitters for broadcast stations. It changes
power at predetermined times, monitors transmitter power, and
permits an authorized person to shut it down if necessary over the
IoT 70

Web. Testing is quick, the script is practically self-documenting,


two-dimensional lists and tuples are easy to manipulate.
— u/squiregeek

Controlling cocktail machine


I got myself a raspberry pi and wrote a programm that controls a
cocktail mixing machine1 . Then I went into my dad’s woodshop
and built the whole damn thing. Took most of the weekends for
more than 6 month. Now you inly have to place a cup and press
your drink on the touchscreen and viola. Actually a pretty cool
thing.

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

Writing NASA launch GUIs


I write launch guis for NASA. We love python.
— u/corey4005
Work 72

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

Controlling industrial robot


Wrote an asynchronous driver for controlling a large industrial
robot in real time. This has been immensely useful to quite a few
people in other labs and we even got a research paper out of it.
— u/varunagrawal

Tell me when i should go home


I use TimeWarrior to track my work time. I created a python script
to calculate my overtime using holiday information, a table of my
vacation days and the tracked tasks of TimeWarrior.
I use it daily because I added it to my taskbar, to tell me when I
should go home.
— u/X99p

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

digits more than I was at my post-military electronics maintenance


job.
— u/NavaHo07

Asterisk phone system


I built an Asterisk phone system for work, and built a full soft phone
system in Python to pair with it. I used Qt for the GUI, PJSIP for
the audio.
— u/gambiter

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

new job wasn’t exactly as advertised (I could do the programming


required though) and I realized at my old job I was able to learn as
much as I wanted to give as features to my colleagues.
— u/funny_funny_business

Update pricing lists


At one company I worked for, the staff was struggling to build/up-
date pricing lists, because the catalog was tens of thousands of
items, and our backend software didn’t have any sort of interface
for it. I ended up building an interface to the backend system, and
then a UI that I could give the staff. I built in several convenience
features so they could have shortcuts for pricing categories of
products with the click of a button. Saved the company a ton of
money… and never got me a raise. (Not that I’m salty)
— u/gambiter

The road to peak promotion


In mid 2004 while working as a QA engineer at an ISP I created a
tool in python for functional QA of web applications
It had a wxWidgets UI and when you hit a “record” button on a
toolbar, it opened an HTTP proxy. Any web requests you made
through that proxy were captured and rendered in the UI as a box
on a Visio-style canvas. Clicking on one of those boxes allowed you
to adjust its values and to create assertions eg “this request should
return text matching this regex”.
Clicking another toolbar button made the visual test script render
as a PHP file (most people at that firm were PHP devs) which could
be uploaded to a web-based test harness I’d created, which used a
Work 77

technique that was later to be called COMET to display updating


progress of test scripts as they executed.
I modestly called this system “UberQA” :-)
My employer used it for a while and our testing strategy was
revolutionised. I got a promotion and serveral more after that, and
left that firm eventually as a Technical Architect, and nowadays I
work as a contractor for household name organisations - but this
was the turning point of my career.
Within a year Selenium was famous and my code was forgotten…
but I know I got there first :-)
— u/WastedTruth

Saving 2D artists a lot of time


I and a couple others automated rigging at my former job.
Rigging is the process of taking a 3D model and making it ready
for animators. Previously rigging was done mostly by hand but
we made an object oriented python rigging framework where
essentially the “rig” was a python script that built everything.
Rigging time went from months to 1-7 days. Also the job went from
70/30 repetitive/real tasks to like 20/80 repetitive/real tasks. And
the consistency allowed a suite of artists tools to be built around
the new rigs.
Later I automated the backend process, where the finished anima-
tion is applied to the high detail characters and “cached”, or turned
into pure motion data on disk, that ran on remote machines instead
of the users machine, and ran in parallel for each character in the
shot. It was hairy getting it going and it had it’s problems but it
was a big help.
3D artists who can’t code can certainly be competent at their job,
but knowing just a little python goes very far. It’s a field that can be
Work 78

automated to incredible levels which in turn gives you time to make


better looking art. Animators in particular are like 777 aircraft: any
moment they aren’t flying full speed is a waste of resources. So
saving an animator 20 minutes a day is huge.
— u/barkerart

Saving a couple of $$$ for a small


market TV station
I used to work Master Control for a small market TV station in
the early 2000s when stuff was just starting to get really automated
and lots of things were transitioning. I got there just late enough to
miss running commercials off of tape; instead we had a commercial
playback system with multiple A/V IO for ingest and playback.
Basically an expensive computer with some high grade hardware.
Unfortunately, due to management deciding not to spend some
money on software, we were building our playlists manually by
looking at the paper log for what was sold in what breaks and then
draging the appropriate number from the inventory window to the
playlist.
This took a few hours to do for a whole day’s log, and because -
everyone- is a little dyslexic when staring at numbers for hours,
there were several human errors per day necessitating “make-
goods” later on.
I was just learning Python and decided solving this would be
my first practical project. On a separate computer - because
they wouldn’t put the mission-critical commercial playback system
on the network - my tool would parse the file the logs were
printed from (kind of tough actually, they were not well formed or
consistent) and build a playlist file, which we would then sneaker-
net with a 3.5“ floppy.
Work 79

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

Startup language of choice


My current job is a startup… I’ve architected the software from the
ground up, in Python. Gotta say, I’m pretty proud of it too.
— u/gambiter

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

Finding abnormal orders


Really basic project. But i have a Zapier step there runs python to
tell me if a work order is normal or abnormal It will just check sizes
of some canvas paintings and if the size is not found in my database
it will add a abnormal tag to the order
Sometimes the small things are what hits the hardest . If i havent
made this a guy in the factory would have had to look trough 100s
of orders a week to find the abnormal once :-)
I also have another one there formats all incoming data to my
specifications. Like zip codes , phone numbers and so on
— u/StrikeBetter8520

Picking where to lunch


I worked at a company where we would decide where to eat lunch
every day by running food.py , which had some kind of memory of
which places we had eaten at recently and how much people like
places
— u/lightcatcher
Work 81

Best settings for 3D forming


machine
In 2014, at work, i made a python tkinter app used to predict the
best settings for a 3d forming machine for low to hight voltage
generators coils. Flat coils were 3d formed/bended to match the
geometry of the stator for winding. The app also offered an easy
way to compensate/adjust for “spring back” effect.
The app was using genetic algorithm to find the best combination
of settings. The resulting settings/adjustment were very counter
intuitive for our operators (sort of “alien like” settings, because it
would not try to use symmetry property of the coil and equipment
to make it easier). But the result was way more accurate than what
humen could achieve using their experience.
It made the transfer time (from one type of generator to another
type) faster (12h to 3h), cheaper (much less copper waster for trial
and error adjustment process) and safer (better matching shape
made the winding easier, faster with less quality risk).
— u/pnprog

Aggregating GIS data for state gov


I wrote a script to download parcel data from several county
engineer/auditor websites and then join and query the attribute
tables from said data to fit our GIS needs (state government). These
are shapefiles for geometry, and Access databases and flat text files
for attributes. Some counties publish their data as consumable
services, but many simply post download links that are updated on
a weekly/monthly/whenever-we-feel-like basis. I setup the script
to run as a Windows Scheduled Task every Tuesday after I login to
Work 82

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

Million dollars sales

I work at a Fortune 500, but they don’t really have “developers”


that aren’t contractors. I wrote a GUI app in QT that took a little
input from our analytics team and produced suggested orders for
our sales reps. Called it Roborep because we were using it to cover
open sales territories. Couple million dollars of sales came out of
the tool, so pretty proud of that one.
— u/androiddrew

Checking if broadcast chain has


failed
I wrote a script that grabbed a frame from a TV tuner card then
analysed the frame (and audio).
If a threshold of black/silent for multiple frames was reached it then
sent me an SMS letting me know that something in the broadcast
chain had failed.
Work 83

It was the final “full path” check to ensure the channel was still
going to air.
— u/nikniuq

Radar images into video for weather


show
Was also proud of the python script I wrote that grabbed the latest
weather radar images for the area and collated them into a directory
then made videos from them for the news/weather show. I used vlc
or ffmpeg for the heavy lifting though.
— u/nikniuq

Fixing problem to deliver mails


This one was actually a work problem. We had encountered a great
many failures to deliver mail to our clients thanks to a problem
at Postini. (They’ve since fixed the problem.) I wanted to figure
out which of our clients were using Postini and keep a list for
future reference. I fired up an iPython notebook wherein I queried
our database for domains, then made an MX query for each and
checked to see if Postini was among the host names returned. It’s
not perfect, but it gave me the information I needed.
— u/kjz

Watching craiglist for jobs


Nothing too creative I run a cron job every 15minutes that scrapes
craigslist computer gigs nation wide that gives me the jump on a lot
Work 84

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

Chemical plant script diplayed in


kiosk mode
I write lots of software at my job but the one that has the most
impact on the process I’ll describe here. I work in QA for a large
corp I’ll leave it at that.
The optical emission spectrometer we use to test our material is
difficult for production staff to interpret the results. We produce the
results and they consume them in real time and make adjustments
to the chemistry and we test again.
It’s iterative. The script runs 24/7 and has to always be running.
When it’s started up it reads a share point list and pulls in the
chemistry specs from an excel workbook. Then it starts a socket
server for the OES to send its results to after every test The server
will receive the results and decide if it is a production chemistry
or if it is a check standard. If it is a calibration check that result
is stored in an appended csv for later analysis if it is a production
chem it is converted Into a format our other in house software needs
for its database. It also stores the results in a different format as a
backup db for Use by yet another piece of software.
Now the results are checked against the specs and a web page is
created that displays all the chemistries in a nice human readable
format with color highlighting for elements above or below the
Work 85

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

Recording neuron spikes


I’m a scientist and I use Python exclusively. We record electrical
spikes from neurons, then use python to load signals from the data
files. From there, I use scikits-learn to cluster spikes from different
neurons. I wrote a catalog with SQLAlchemy to store metadata
about the recorded neurons. This allows me to easily pull out
neurons with specific properties and batch analyze them. Once
I have neurons I want to look at, I store the data in pandas data
frames and do the analysis with numpy, scipy, scikits-learn, and
matplotlib. We’re also developing an LED tracking system with
OpenCV.

At the ATLAS experiment


At the ATLAS experiment at the large hadron collider we used
Python as a scripting language to glue together modules to run
complex computations (data filtering, simulation, track reconstruc-
tion, …). At my current job I use scipy/numpy/matplotlib like many
people use matlab, in fact this works so well I cant understand why
anyone uses matlab anymore…
— u/nxpnsv

Mass spectrometry data


I’m not a developer I’m a chemist.
I use python to process mass spectrometry data, produce visualiza-
tions of large data sets, automate calculations and report genera-
tion, and am working on a program which will design experimental
procedures automatically based on user inputs.
Work 87

None of this is in my job description, I just find it fun, rewarding,


and I’m learning new things.
— u/jawnlerdoe

Work for chip desgning company


The work was for a chip designing company. That component had
a device driver using which certain debugging and data collection
parts of chip can be enabled. There was also an application that
would do the enabling part, collect data and save it some files.
There’s another tool that can read that info and draw visualizations
about how the cpu was operating, how signals were flowing. This
systems needs to be setup, the application needs to be run on tens
of devices to collect data. Doing it manually over ssh, copying data
to different server, it’s boring task. That’s where automation came
in. Our job was to detect which system is connected, get drivers
versions to select what tools to run, collect data and copy it in a
specific folder on a different server. Next time user needs to run it,
they just invoke our script, come back after an hour and see if it’s
finished or not.
Another one was - the process I described above, it generates lots of
data, like a single run can generate 800+ MB of data. So hard drives
fill up quick. If you start the visualization tool on a disk that has
less than 5GB space, it will fail after running for few hours. Then
your manager shouts at you coz you blocked that tool (it’s very
expensive) for few hours and didn’t have enough space to run it. A
mechanism is needed that reminds people to delete their old data.
So my script would scan the network paths, compute size of the
folder and if size is above certain threshold, send reminder mails to
people (email can be derived from folder’s owner name) to delete
data. That script would run daily (crontab), take around 2 hours to
finish and then send mails.
Work 88

— u/IamImposter

Onboarding and offboarding


employees
My last job was in IT, it was my job to onboard and offboard
employees and their accounts/computers. I ended up using Python
to build myself a little app with a GUI so all I needed to do was
enter the employee’s name, title, and office and accounts would
be created across various systems, and grouped as needed which
then applied the security settings from the MDM. At off boarding,
I enter their name, email, and manager’s email and all the necessary
locks would initiate on the accounts, and the manager would get an
email reminding them to collect a list of equipment. We had a lot
of turnover so this saved me at least an hour a week managing user
accounts and ensuring they got put in the proper groups and locked
when people left.
— u/Lonely__Stoner__Guy

Migrating from one accounting


system to another
I’m in financial services. A ton of our work that was previously
done in Excel is now done much faster with Python. The last project
I worked on was migrating data from one accounting system to
another - lots of cleaning and reformatting required. A colleague
has recently set up some automated alerts using Python with AWS
lamda. We also have a load of python scripts that parse CSV files
and check for errors or inconsistencies, or which reformat files so
the data been be loaded into our accounting system.
— u/KCRowan
Work 89

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

Migrating university lectures


I work for a University, and they have decided to switch to a
different lecture recording software, and I have been tasked with
transferring the lectures from the old platform to the new. I
have no access to the back end. Every file must be downloaded
then uploaded. Instead of allowing you to download the MP4
directly, the lectures are downloaded as executable media players,
and the actual video file will be stored three layers deep in a user
directory with a generic name like ‘video_1’ only when you run the
executable.
I wrote two loops. The first one runs the executable, waits thirty
seconds to allow the download to finish, then closes all of the
Work 90

windows it opened. The second finds the video file, renames it


something relevant to it’s content (pulled from the parent directory
name) and moves it to a new directory with the other videos.
6 lines of basic code did in a couple hours what the people I work
with were willing to dedicated a week. Somebody once told me
that if you ever find yourself doing the same thing over and over
again, that is an opportunity to programmatically solve a problem.
I guess my example isn’t as glamorous as some of the others, but it
is practical and could apply to anyone. Who hasn’t had to move and
rename a bunch of files? Even if it is just cataloging your music.
— deleted

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

You might also like