Entrepreneur, Hacker and Future Mad Scientist 🚀☕

Category: Coding Projects

Learning Python For Nerdy Financial Reasons

I recently finished my intro to programming class and was slightly worried that we would actually be programming using Python throughout the whole class. Turns out the class was a bit boring and gave me time to mess around on Stackoverflow and learn a bit more than the rest of the class.


I’ve kind of been a finance geek over the last few years and control my finances very carefully, but it really isn’t that complicated. I’ve been using a simple spreadsheet for spitting out numbers. All I need to do is input how much my paycheck was and it would tell me exactly how much I had for expenses/bills, saving and investing.


You can read more about the system I use here.


Our final project was coming up quickly and I needed an idea. We honestly didn’t need a program to do anything interesting, but I figured I would spend my time building a program I would actually find useful.


The command line is ok…..


Initially, the program was strictly command line based. I would run the program in my terminal, it would ask for my paycheck input and then spit out the amounts for each account I use. Simple enough and it took all of no time.


I wanted to play around a bit more with functions and classes so I made things a bit more elegant.


After running the program a few times, I knew how boring it would be to use. One night while doing so Python research I found Tkinter; a library that allowed you to create a GUI for your program.


Tkinter was a complete pain in the ass to get up and running, but eventually, I figured it out and made it work.


Monthly Financial Tool Python


Now, instead of a command line, you could run a visual program like you’re used to and problem solved…


I’ve grown to love Python and even though I’ve barely scraped the surface, I feel incredibly confident I could build something more powerful and useful.


If you want to take a look at the code or add to it, please check out my repo on Github here!

Future Additions


I want to expand on this simple program. As it stands now you have to tweak the code to change the percentage output of your income. I want to add a tabbed page that allows the user to input whatever percentage breakdown they’d like.


I’ve already added a simple label at the bottom that shows the user how much their investment amount would be in 30 years based on a 5% return per year. I’d really like to expand upon this with visual graphs in some fashion.


I would love to hear what your thoughts are and some tweaks I can add to make this simple program better than it currently is.

How To Delete 8,000+ Emails Using Ruby+Watir

I recently got stuck working on a small browser automation project and needed to continue to build something, so I looked at a few problems I was having. I have an older Yahoo Mail account and although I don’t use it anymore, I still wanted to find a way to clean up the inbox that had a little over 8,000 emails. Doing this by hand would take forever!

Using the same stack from my previous project, I started coding.

I used Ruby and the gem Watir(Webdriver) for the browser automation. Essentially, when the program was run through my terminal, it would go to https://mail.yahoo.com/, log me in, highlight all emails, delete and then repeat for 100 times or until it ran out of emails to delete.

It took me a bit longer than it should have to code this, but it was a blast playing with!

Here’s the code:

require 'watir'
require 'watir-webdriver'
require 'colorize'
b = Watir::Browser.new
b.goto 'https://mail.yahoo.com'
b.text_field(:id => 'login-username').set 'USERNAME'
b.text_field(:id => 'login-passwd').set 'PASSWORD'
b.button(:name => 'signin').click

100.times do
c = b.checkbox :title => ‘Select or deselect all messages [Cmd+A]’
b.button(:id => ‘btn-delete’).click
b.button(:id => ‘okModalOverlay‘).click
puts (“Successfully Deleted 50 Emails…”).yellow

I got a little creative with my selectors, but it worked and I got it functional in no time. I have it set up so that every time it successfully runs the loop it puts “Successfully Deleted 50 Emails…” in yellow within the console so I can watch my terminal and do other things while it ran. You can change how many times it runs depending on how many emails you need to delete. I had my settings to 50 emails per page, although I noticed it would at times delete more than 50 so it didn’t make sense to do the math. Instead, just run a large amount of times until the code fails and stops running.

*I would love to see someone with more skills than mine take this code and make it better!

Here’s It In Action:


Building It Out


Although this is a super simple project, I want to test my skills a bit more by adding a few features and functions, such as: Showing how many emails are actually in your inbox in console, wrapping this within a GUI using something like Shoes so I can share this with other people. You can put in your username/password and it will clean up your email for you.


Probably not the most valuable thing I’ve ever built, but very useful when you need some inbox spring cleaning.


Someone recently said they shouldn’t learn coding because they aren’t in a technical field, but that’s the complete wrong way to look at coding/hacking. Coding is a utility/learnable skill to help make your life 10x easier. Case in point; deleting 8,000+ emails!

Powered by WordPress & Theme by Anders Norén