Understanding the stack data structure
Stack is an ADT (Abstract Data Structure) which follows the LIFO (Last In First Out) order. It might be easier to understand this concept by imagining an actual stack of books.
When working with stacks, you can use mainly two operations. push() to add an element to the top of a stack and pop() to literally pop out or remove an element of a stack. As it is considered an ADT (Abstract Data Structure) you can implement it in many ways with other basic data structures such as arrays or linked lists.
Understanding signals in Linux
What is a process ID? A process ID a.k.a. PID is literally what the name says, it is a number to uniquely identify a running process. You can print your program’s PID in C using the getpid() function included on the header file unistd.h.
int main(void) { while (1) { printf("PID: %d\n", getpid()); sleep(1); } } output: “ PID: 12345 ”
note: “12345” is a PID for an arbitrary process.
Introduction to Vim
Vim is one of the most powerful text editors you can think of. In this article, I will introduce you some basic and useful Vim commands.
Vim modes There are two main modes in Vim. Normal Mode and Insert Mode. In Insert Mode you can type on the document as in any other text editor. In Normal Mode you can execute commands to navigate though the file or modify it.
How to enable image preview on Ranger using Kitty
Getting Started First, create a config file for Ranger in ~/.config/ranger called rc.conf
cd ~/.config/ranger && touch rc.config Open the config file and add the following lines to it:
set preview_images true set preview_images_method kitty Install the Pillow library using pip (Python’s package installer)
pip install Pillow The image preview feature should be working now. If you’re getting an error, try following the steps below.
ERROR: Image previews in kitty require PIL (pillow) First, check where Python is located on your computer using the which command.
Introduction to pointers in C
When we declare a variable in C, we generally do something like this:
int num = 1; As you might know, variables get stored in memory, and the size of each variable will differ depending on its data type.
For instance, an integer variable like num declared above is 4 bytes long on my Mac, but the size could vary depending on the machine.
You can always check the size of a particular data type by using the sizeof() operator.