Development

List of some self hosted services you can setup on your homelab

March 9, 2024

Nextcloud: A suite for file hosting, collaboration, and more. It’s like having your own private cloud for storage and office applications. Plex: A popular media server that organizes and streams your movies, TV shows, music, and photos. Home Assistant: An open-source home automation platform that allows you to control smart home devices. GitLab: A web-based DevOps lifecycle tool that provides a Git repository manager for source code, CI/CD, and more. ...

How to reduce the file size of a pdf file in linux cli

March 8, 2024

Install Ghostscript: If it’s not already installed, you can install Ghostscript using your distribution’s package manager. For Debian-based systems like Ubuntu, use: sudo apt-get update sudo apt-get install ghostscript For Red Hat-based systems like Fedora, use: sudo dnf install ghostscript Compress the PDF: Once Ghostscript is installed, you can compress your PDF file using the following command: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf In this command: ...

Shutdown Proxmox VM using CLI

October 17, 2023

If you’re looking to shut down a virtual machine running on a Proxmox Virtual Environment (PVE), you can use the Proxmox command-line interface (CLI) to accomplish this task quite effectively. The command for shutting down a VM in Proxmox is qm shutdown, followed by the ID of the virtual machine you’d like to shut down. Here’s how to do it: Access the Server: First, log in to your Proxmox server via SSH. ...

Mastering Ansible: A Step-by-Step Tutorial

September 8, 2023

We’ll be diving straight into the core concepts and components that will help you become proficient in Ansible. This tutorial assumes that you have already installed Ansible on your system and have a basic understanding of what Ansible is. Setting Up the Environment # SSH Key Generation # If you haven’t already, generate an SSH key pair on your Ansible control node. ssh-keygen -t rsa SSH Key Distribution # Copy the SSH public key to all your target nodes. ...

How to count number of words in a pdf file from Linux cli

September 5, 2023

Using pdftotext: # Installation: If it’s not installed, you’ll need to install the poppler-utils package which includes pdftotext. sudo apt install poppler-utils or yum install poppler-utils depending on your distribution. Usage: Once installed, you can convert a PDF to text and then count the words as follows: pdftotext input.pdf - | wc -w Here, input.pdf is your source PDF file, and wc -w counts the number of words. The - in pdftotext specifies that the output should be sent to stdout, which is then piped into wc. ...

How to install Postgresql Client using Homebrew

July 26, 2023

Psql is a command-line interface for interacting with PostgreSQL, a powerful and open source relational database system. Brew is a package manager for macOS that makes it easy to install and manage software. Here are the steps to install psql with brew: First, install the brew package manager if you don’t have it already. You can do this by running the following command in your terminal: /bin/bash -c "$(curl -fsSL https://raw. ...

How to avoid other pods from being scheduled on your node in Kubernetes

July 13, 2023

Kubernetes is a powerful platform for managing containerized applications across a cluster of nodes. However, sometimes you may want to have more control over which pods are scheduled on which nodes, for various reasons such as performance, security, or cost. What are taints and tolerations? # Taints and tolerations are a feature of Kubernetes that allow you to mark nodes with certain attributes or conditions, and then specify which pods can or cannot be scheduled on those nodes based on those attributes or conditions. ...

Kubernetes Tolerations

July 11, 2023

Kubernetes tolerations are a way of allowing pods to be scheduled on nodes that have taints, which are markers that repel pods by default. Tolerations let you control which pods can run on which nodes, based on the pod’s requirements and the node’s characteristics. What are Kubernetes tolerations? # Kubernetes tolerations are a pod property that allow a pod to be scheduled on a node with a matching taint. Taints are the opposite of node affinity, which is a way of attracting pods to a set of nodes. ...

How to erase line in files containing string recursively in Linux

April 27, 2023

find . -name "*.md" -type f -exec sed -i '/line of text/d' {} \; This command uses find to locate all .md files in the current directory and its subdirectories recursively. The -exec option is used to execute the sed command on each file found. The {} is replaced by the name of each file found, and the \; is used to terminate the -exec option. The sed command removes any line containing the string “line of text” from each file found. ...

How to install PhantomJS on Ubuntu 22.10

April 27, 2023

PhantomJS is a headless web browser for automating web page interactions. To install PhantomJS on Ubuntu 22.10, you can follow these steps: Update your system packages with sudo apt update && sudo apt upgrade Install the required packages with sudo apt install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev Download the PhantomJS binary file from its official website with wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 Extract the file to /usr/local/share/ with sudo tar xvjf phantomjs-2. ...