The Ultimate Guide to Installing Ghostscript

In this article we explore how to install Ghostscript on numerous different platforms and operating systems. What is Ghostcript? Why install it? What is Ghostscript, and why would we want to install it? To understand this we should first learn about Postscript. Postscript Postscript is a page description language geared towards desktop publishing documents. If … Read more

How to Compress PDF Files Using Python?

Problem Formulation Suppose you have a PDF file, but it’s too large and you’d like to compress it (perhaps you want to reduce its size to allow for faster transfer over the internet, or perhaps to save storage space).  Even more challenging, suppose you have multiple PDF files you’d like to compress.  Multiple online options … Read more

How to Fix “ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()”

Here’s an error I recently encountered when working with NumPy arrays: If you run the following code, you’ll experience a special ValueError: The output will be this error message: How can you fix this error? I’ll give you a short and a long answer to this question. Let’s start with the short one: Solution: Use … Read more

Python os.walk() – A Simple Illustrated Guide

According to the Python version 3.10.3 official doc, the os module provides built-in miscellaneous operating system interfaces. We can achieve many operating system dependent functionalities through it. One of the functionalities is to generate the file names in a directory tree through os.walk(). If it sounds great to you, please continue reading, and you will … Read more

PowerShell Developer – Income and Opportunity

Annual Income How much does a Powershell Developer make per year? The average annual income of a Powershell Developer is between $93,000 (25th percentile) and $170,000 (75h percentile) with top earners making $170,000 per year and more according to Ziprecruiter (source): Let’s have a look at the hourly rate of Powershell Developers next! Hourly Rate … Read more

Bash Developer – Income and Opportunity

Annual Income How much does a Bash Developer make per year? The average annual income of a Bash Unix Shell Script Developer is $74,000 according to Ziprecruiter (source). PayScale lists an even higher annual income for a bash developer of $80,000 (source). Let’s have a look at the hourly rate of Bash Developers next! Hourly … Read more

How to Make a Beep Sound in Python? [Linux/macOS/Win]

Windows: How to Make Beep in Python To make a beep sound in Python on your Windows machine: Import the library using: import winsound Call windsound.Beep(frequency, duration) for your desired frequency (in Hertz) and duration (in milliseconds). For example, winsound.Beep(2000, 1500) would make a sound with 2000 Hz for 1.5 seconds. Here’s the relevant code … Read more

How to Remove a Trailing Newline?

Use str.rstrip() to remove a trailing newline. Given a string s, create a new one without trailing newline character by calling s.rstrip(‘\n’). If you need the string stored in the original variable, simply assign the result to the original variable. Here’s an example: This actually removes all trailing newline characters: If you want to remove … Read more

Python Nested Multiple Ternary Operators

In which order does the nested ternary operator evaluate its conditions? Short Answer: The nested ternary operator ‘1’ if x else ‘2’ if y else ‘3’ evaluates the condition from left to right, i.e., ‘1’ if x else (‘2’ if y else ‘3’). In short, first condition first! Problem Formulation Given a nested ternary operator … Read more