Tag Archives: scripting

Handy tips for bash scripting: screen reminder and logging

Often I find myself writing simple wrapper scripts for long-running tasks, like migrating a database or performing some repair or optimization process. I mainly want to ensure proper logging is kept in order to determine how long each step takes … Continue reading

Posted in CLI | Tagged , , , | 7 Comments

Running MySQL queries in Python

Being able to access MySQL databases in Python opens up quite a wide range of possibilities. It’s essential for a number of tasks such as connecting disparate datasources, performing maintenance, running regular updates, and more. While there are a number … Continue reading

Posted in MySQL, Programming | Tagged , , , , | 5 Comments

Simple and effective Python logging

I have been using the quite capable logging module for all of my logging in Python programs for some time. After trying a number of different options and formats, I have stabilized my setup into what I will describe below. … Continue reading

Posted in Programming | Tagged , , , | 7 Comments

Elegant option checking with optparse

A fair amount of the Python code that I write is in the form of scripts designed for command line use. In support of sysadmin activities, data massaging, or other tasks, they often call for options to be passed and … Continue reading

Posted in CLI, Programming | Tagged , , , , , | Leave a comment

Run vim without being there…

Say you have a text file. You need to alter it in some regular way before sending it on somewhere else. Instead of editing by hand, there is a neat option you can use to edit the file with familiar … Continue reading

Posted in CLI | Tagged , | 2 Comments