Python

Stumbled upon a very monstrous PHP project, very old of course, the client complained that the web host refused to downgrade the server for them and this project doesn’t work anymore because it was written with bunch of mysql_* depreciated function. Now it was my job to start editing these files one after the other,…

Read More MySQL2MySQLi: A Small Program to Help Migrate from PHP mysql_* to mysqli_*

As a system admin, was stuck one day looking for a way to delete old files and it brought me to this code. This short code will delete files recursively if directory provided as the argument, if it’s a file, it just deletes the file if it matches the given time frame So with the…

Read More Recursively Delete Files Based on Time Old Using Python

In an app development I needed to use my system resolvers which is different from my ISP default resolver, and Python keeps taking my ISP resolver. I decided to put up this simple function to get resolvers for me in /etc/resolv.conf, here is it: https://github.com/donjajo/py-world/blob/master/resolvconfReader.py I hope this helps

Read More Parsing and Fetching DNS Resolvers in /etc/resolv.conf Using Python

Jumped into Python, having the urllib, urllib2 and urllib3 for Python3; Unfortunate for me as I’m using Python3 there is no urllib2 for it and POST requests in most places I’ve seen it used are used with urllib2. I had no choice than to deal with what I have, digging into Python documentary site I…

Read More How to Send POST Request Using urllib Only in Python3

Through programming languages I’ve been through, finding MIME types is not that kinda easy, the language might not have a built-in function for that or if they have it won’t be that efficient, I can recall in PHP I’d activated the finfo module to find MIME type of existing files. Now in Python, we have…

Read More Getting MIME Types on Files & Buffers in Python

Default Ubuntu Python package version is 2.7, while in my Python class I use 3.4 and everything I keep typing python3 whenever I want to run python. Want to turn 3.4 to your default? Easy, BASH made this available by providing space for aliases in the config. Aliases is not only for this function, I…

Read More Setting Python3 as your Default Shell Python in Ubuntu

Post thumbnail

Hi all, Python is a Linux based language and its more easy to use in Linux than Windows both the Django we are about to install. Now before installing your Django, make sure you already have Python 2.6.5 or higher installed in your system. Now download Django files here https://www.djangoproject.com/download/ The files are usually in…

Read More [Python] How to install Django in Windows 7