If you need to replace all newline characters with a comma, or perhaps some other delimiter, then using the build-in tr utility will work very… Read More »How to replace newlines with commas in CLI
You have a directory with a lot of files, and you want to delete only the files that don’t match a specific extension. This is… Read More »How to remove files without a certain extension?
Let’s say that you have an array or a list, or logs. Each of these logs is a space-delimited string of words. For example: logs… Read More »How to Reorder Data in Log Files using Python
A common programming interview question, and for a change, one that you will actually be able to use in the job, is that of implementing… Read More »How to implement a Queue using Stacks in Python
The question Take a string S of lowercase letters. These letters form consecutive groupings of like characters. Find groups with 3 or more like characters… Read More »Find positions of largest groups of characters in a String with Python
You can ignore certain files and folders from being committed to Git by means of including a .gitignore file. Unfortunately, you may have forgotten to… Read More »How to make Git “forget” about a file that was tracked but is now in .gitignore?
If you see lots of disk space quickly disappearing on your MySQL or MariaDB server, then you may want to look into the BinLog directory,… Read More »How to Purge the BinLog for MySQL and MariaDB
Google Colab is a fantastic environment to write Python code using Jupyter Notebooks, hosted for free by Google. If you’ve ever used Jupyter Notebooks before,… Read More »How to Measure Execution Time in Google Colab
So you have a table where you want to delete a bunch of rows, based on a particular column being matched in another table. This… Read More »How to Delete from a Table where rows match in Another Table – MySQL
There are many occasions where you need to INSERT a record into a MySQL database table, but the record already exists. INSERT INTO queue_domains (domain)… Read More »REPLACE INTO instead of INSERT INTO – MySQL
Using Operating System Commands in Python Use the Linux/Mac tail command to provide the data: Creating a Python Only Script Read the whole file into… Read More »Read the bottom n lines of a file in Python
If you’ve ever typed date into your Ubuntu Server and seen a different time or timezone appear than you expected, then it probably means that… Read More »How to Change the Timezone on Ubuntu Server
As Python developers, we’ve all used pip to install applications, but speaking to other Python developers, it’s not always clear how to make your own… Read More »How to make a Python script Pip-installable
Sending emails using Python and AWS’ SES service is really easy. They provide an SMTP server that you can authenticate against and send email programmatically… Read More »How to send emails using Python and AWS SES SMTP
Why a Password Manager? Password managers exist for two main reasons. Firstly, to generate strong passwords and secondly so that you don’t end up using… Read More »Why Password Managers are Not the Solution
Sometimes you may need to read the top n lines of a file using Python. We start by opening the file for reading and then… Read More »Read the top n lines of a file in Python