Python Argparse Cookbook

I use Python as my go to tool for command-line scripts. So I find myself often parsing command-line arguments for these script. Since I use various programming languages I don’t remember anything, so I’m constantly looking at documentation and sadly, Python docs are a bit challenging to read. So, so similar to my Python String […]

Python Data Science

My notes, resources and examples using Python, NumPy, SciPy and Matplotlib as alternatives to R and Matlab for data science and analysis. Load Data from Text File An example loading comma delimited data using Numpy: Plotting and Graphing Log Scale Labels for Titles and Axes Saving a Graph The following will create a png image […]

Python Dates

A set of examples using Python date and time functions, including formatting dates, date calculations and other bits in datetime package, similar to my string format examples. First off, all examples use the following import, any additional imports needed will be shown with the example. Creating Date Objects Date Formats Printing dates in various formats […]

Python String Format Cookbook

Every time I use Python’s string format, version 2.7 and up, I get it wrong and for the life of me I can’t figure out their documentation, I was quite familiar with the older % method. I started this string format cookbook as a quick reference for myself when wanting format numbers or anything. Thanks […]

Use Python + Selenium to Automate Web Timing

I’ve been hearing a lot recently about the Navigation Timing spec, which sets a multitude of timing events as javascript properties. There are numerous events in the flow, from the very first navigation event, which could be when the user clicks a search result in Google, to DNS timing to Dom parsing etc. See the […]