tar (child) xz Cannot exec No such file or directory

The error: 1 tar (child): xz: Cannot exec: No such file or directory Is majorly an issue with the xz command not found on the host machine. To verify, run: 1 whereis xz Fix To fix, use the installation command for your Linux distribution: 1 2 3 4 sudo apt-get install xz-utils # Debian / Ubuntu sudo yum install xz # RHEL / CentOS sudo zypper in xz # OpenSuSE sudo pacman -S xz # Arch Linux Then untar again with: ...

July 10, 2023 · 1 min · Aleem Isiaka

Change files extension in a directory

A onliner 1 for f in *.old; do mv "$f" "${f%.old}.new"; done How??? To change the name of a file on Linux/Unix use the mv command 1 mv currentfilename newfilename If there is a file named aleemisiaka.old and want to rename to aleemisiaka.new We can store the filename to a variable with export FILENAME=aleemisiaka And use the variable name in the mv command 1 mv "$FILENAME"$ "$FILENAME.new" This renames the file from aleem-isiaka.old to aleemisiaka.old.new ...

June 22, 2023 · 1 min · Aleem Isiaka

Optimizing Merge Sort

Going through Chapter 2 of CLRS, I was introduced to the concept of divide and conquer, which is a very interesting algorithm technique, and a popular example of the divide and conquer algorithm is merge sort. Merge sort has an Θ(nlgn) run time, which is very good for large inputs. When the input is sufficiently small enough, the algorithm has a worse run time compared to a sorting algorithm that completes in Θ(n^2) time. One of the exercises is to create an optimized version of the merge sort that runs the original merge sort algorithm for sufficiently larger inputs where it shines and to run insertion sort [ Θ(n^2) ] when the input size is sufficiently small enough. I have a solution for it on my Clio website, this post walks through the process for the solution. ...

June 20, 2023 · 1 min · Aleem Isiaka

Searching for a pattern in the man pages

To search through the man pages for some keywords, use the -k option. man -k [keyword] This shows a result of the commands, and routines that match the keyword with a one-line description of what they are about. man -k passwd shows all the possible entries for passwd in the manual pages. The apropos The man -k [keyword] command is similar to a help utility called apropos which is available both on Unix and Linux. See it as a shortcut. ...

June 20, 2023 · 1 min · Aleem Isiaka

Know the man(nual) pages

There are many ways to get help as a Linux administrator, manual pages are one of them as they are always close - accessible via the terminal. The manual pages, called “man pages” is a local documentation and description of software packages, drivers, routines, and libraries on a Linux machine. To use it run man [command|library|routine|driver] and replace the command with the name of a command to find a manual. ...

June 18, 2023 · 1 min · Aleem Isiaka

Send message from a service worker

Communication between service workers and the clients browser window can be achieved by simply doing: 1 2 3 self.clients.matchAll().then((clients) => { clients.forEach((client) => client.postMessage({ msg: "Hello from SW" })) }) The variable self is a reserved keyword in a service worker context. It references the global scope of the current worker execution scope and has some useful properties. It is like the window object of a JavaScript browser context. In the above snippet, all the clients that run the service worker are loaded, then the .postMessage is called to send message directly to the original javascript runtime of the service worker. ...

January 22, 2023 · 3 min · Aleem Isiaka

Autocompile Go

First, install CompileDaemon: 1 $ go get github.com/githubnemo/CompileDaemon && go install github.com/githubnemo/CompileDaemon Then, from the root of the project, create a Make file: 1 $ touch Makefile And add the below content: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 GOCMD ?= go GOBUILD = $(GOCMD) build GOCLEAN = $(GOCMD) clean GOTEST = $(GOCMD) test GOGET = $(GOCMD) get BINARY_NAME = project_name BINARY_UNIX = $(BINARY_NAME)_unix default: all all: test build build: $(GOBUILD) -o ../$(BINARY_NAME) -v -ldflags="-X main.VERSION=$(TAG)" test: $(GOTEST) -v ./... clean: $(GOCLEAN) rm -f $(BINARY_NAME) rm -f $(BINARY_UNIX) run: build ./$(BINARY_NAME) dev: CompileDaemon -build="$(GOBUILD) -o ../$(BINARY_NAME)" -command="../$(BINARY_NAME)" -color="true" -exclude-dir=.git -exclude=".#*" Finally, from the root of your project: ...

August 21, 2021 · 1 min · Aleem Isiaka

Erlang Functions

When programming Erlang, you should think like you are writing an English essay. In Erlang, functions are not very different to what a traditional programming language offers, but they are written very differently in Erlang. To declare a function in the Erlang Repl, you will have to use the fun keyword. 1 Name = fun(X) -> X. The above code will store the the declaration of a function called Name and would receive an argument called X. ...

June 21, 2021 · 3 min · Aleem Isiaka

Erlang Pattern Matching

If you come from a conventional programming language background, the way Erlang handles assignment is expected to look wonky, but it is not. There is nothing like an assignment in Erlang programming language; there is a different approach to accessing values in memory, which is the pattern-matching operations. With Java, PHP, Python, C, C++, and likes, the = symbol implies take the values from the right, and store it into the memory, then give me the reference of the location in memory and store it in the expression at the left. ...

June 15, 2021 · 4 min · Aleem Isiaka

Erlang Variables

If you have worked with other languages like JavaScript, Java, Python etc, you would be surprised by what Erlang understands as variable. In Erlang, variables starts with uppercase letter, thus, C, X, Ape, Ant are all valid identifiers for Erlang variables. Variables can not start with lowercase letter or begin with a number. Erlang variables can include can alphanumeric characters, an underscore and @ symbol. 1 2 3 X = 1. %% Valid y = 2. %% Invalid 1X = 2. %% Invalid When assigning to a variable - as we do call it in other languages, Erlang actually does something called pattern matching. Comparing the values on the right to the values on the left. ...

June 14, 2021 · 2 min · Aleem Isiaka