ASUS Router Firmware Upgrade Notification

I have written this pice of code to let me know when there is a new firmware upgrade of my router. This should work on most of the ASUS Routers. I’ve tested only on RT-AX86U. I’ve scheduled this from my PC to run once a day. I’m using Pushover to get the notifications on my … Read more

How much memory does my Python code use? Memory Profiler!

Memory Profiler is an open-source module that uses the psutil module, to monitor the memory consumption of Python functions. It performs a line-by-line memory consumption analysis. Installation: Install Memory Profiler from PyPl using: pip install -U memory_profiler After you have configured memory_profiler, you can use a decorator to track the memory consumption of the function. The @profile decorator can … Read more

Python – How long does my code take to run?

Recently, I wanted to do some performance of my code. The following is what I’ve used to get some performance timing. The following is the code I’ve used. Run the code with the following: As we can see, the code took 8.3 seconds to run and the following is a breakdown of each module which … Read more

RMAN Backup with Python

I want to start using Python to perform my backups. Here is a simple script to perform it. Insde both the Incremental_backup.cmd and Full_backup.cmd, you can put any rman commands you like. Archive log backup archivelog all delete all input; backup current controlfile; delete noprompt expired archivelog all; delete noprompt obsolete; Incremental level 0 backup … Read more

Calculate OS Size with Python

df.py #! /usr/bin/python # my first python attempt. # Mark Young 14 July 2016 import sys import os import subprocess def reportUsage(label, total, free): used = total – free print “%s=%dG, used=%dG (%d%%)” % (label, free, used, used*100/total) p = subprocess.Popen([“df”, “-k”, “.”], stdout=subprocess.PIPE) print p.stdout.read() rc = p.wait() stat = os.statvfs(“.”) total = (stat.f_bsize … Read more