Git offers many hooks to use for various tasks that need to be run pre/post commits, merges and many other events. To utilise them one simply n
Mon Jun 07 2021
Mohammad Kefah
The package manager in Fedora Linux can sometimes be slow (mainly when updating repositories and metadata). Beyond that there are some tricks t
Thu Jun 24 2021
Mohammad Kefah
Sometimes, one would like to specify when a task should be run. It is easy to do so via the `when:` field as such:
Thu Jun 24 2021
Mohammad Kefah
View arp cache | Sysadmin
Using the `ip` utility one can easily view the arp cache, which is under the `neighbor` option. It can be used to view some of the machines on
Fri Jul 23 2021
Mohammad Kefah
Generate password | Openldap
There is already a utility to generate hashed passwords for openldap via the `slappasswd` utility as such:
Tue Jun 29 2021
Mohammad Kefah
Add package to system | Nixos
One way to add packages to NixOS is to add the required packages to the pkgs list in the `/etc/nixos/configuration.nix` as follows:
Mon Jun 28 2021
Mohammad Kefah
Get copr api keys | Sysadmin
If one wishes to use the `copr-cli` tool to manage their copr repos then most likely they will need to generate API keys. To do so, one simply
Mon Jul 12 2021
Mohammad Kefah
A way to make it simpler to add new parameters to structures without having to edit the constructor every time.
Mon Jun 07 2021
Mohammad Kefah
In sql, one can easily find results that are present (or not) in a subquery via the exists statement.
Tue Jun 15 2021
Mohammad Kefah
Create copr project | Sysadmin
Using the `copr-cli` tool, one can easily create a project and even specify the default arches to build against as follows:
Mon Jul 12 2021
Mohammad Kefah
Create unix socket | Sysadmin
Sometimes in order to debug some issues, one needs to create a unix socket. Thankfully, this can be done easily with netcat as follows:
Thu Aug 05 2021
Mohammad Kefah
Exit edit command mode | Bash
When writing complex commands in the shell, sometimes one needs to drop into their editor to ease the process. In bash this is done by either `
Mon Jul 12 2021
Mohammad Kefah
Grep something from history | Git
It is often the case that one wants to make sure that he removed some key, or if they ever commited a secret to their repo. This and other anal
Fri Jul 23 2021
Mohammad Kefah
List user installed packages | Sysadmin
It is quite helpful to list the packages I installed manually on my machine, especially before perfomring a fresh install, so that I know what
Thu Jun 24 2021
Mohammad Kefah
Perform authorised search | Openldap
One can easily search openldap via the `ldapsearch` command as follows:
Mon Jul 12 2021
Mohammad Kefah
Force refresh dns cache | Sysadmin
In Fedora (and other Linux based distros using the same DNS cache service), most likely systemd-resolved is the DNS cache. Sometimes, one would
Thu Jun 24 2021
Mohammad Kefah
Register task output | Ansible
When running Ansible tasks, sometimes it is needed to store the output as it can determine what to do in other proceeding tasks. One can do so
Thu Jun 24 2021
Mohammad Kefah
Sync folder to vagrant box | Vagrant
Vagrant provides many ways to exchange folders/files with the virtual machine. Rsync is a simple one and is done as follow:
Mon Jun 28 2021
Mohammad Kefah
Add clear mode for vi bash | Bash
Unfortunately, by default the vi mode in bash does not have a binding to clean the screen while in insert mode. In order to add it one needs to
Mon Jul 12 2021
Mohammad Kefah
Remove file from repo | Git
If in the history of a git repo, by mistake, one commited a private API Key, or whatever secret token into the repo, then history rewriting is
Fri Jul 23 2021
Mohammad Kefah
Check if socket file exists | Bash
In bash, one can check if a socket file exists with `-S` as follows:
Mount google drive on colab | Python
To simply mount your google drive into a google colab session, use the builtin `google.colab` library as follows:
Sun Jun 20 2021
Mohammad Kefah
Memoize function with cache | Python
In python one can memoize a function with a single directive.
Sat Jun 05 2021
Mohammad Kefah
Forward port to host | Vagrant
Forwarding ports is easy in vagrant and can be done as follows:
Mon Jul 12 2021
Mohammad Kefah
Bypass cors in cloud functions | Firebase
To bypass CORS errors (but one needs to understand it first rather than falling into the tar pit of immediacy like me) in a cloud function one
Sun Jul 04 2021
Mohammad Kefah
Upload src rpm to copr | Sysadmin
Using the `copr-cli` tool, one can easily upload an srpm they prepared to one of their copr repos as such.
Mon Jul 12 2021
Mohammad Kefah
Convert between different mesh formats | Photogrammetry
There are many formats for 3D assets such as OBJ, VFX, GLTF/GLB, USDZ, PLY and many others. Many times it is quite important to switch between
Fri May 28 2021
Mohammad Kefah
Dictionary from brace expansion | Bash
I've been playing around with brace expansion in Bash lately and I noticed an interesting thing. The below seems to expand to `a{a..z} b{a..z}
Tue Jul 20 2021
Mohammad Kefah
Access project storage in cloud function | Firebase
There might be a more "correct" way of doing it but that's what I found for now:
Sun Jul 04 2021
Mohammad Kefah
Generate shadow compatible passwd hash | Sysadmin
Turns out there are many ways to do so, the one I felt was the simplest is to use openssl as follows:
Tue Jun 29 2021
Mohammad Kefah
Convert virtualbox box to libvirt box | Vagrant
When using vagrant, sometimes the box one needs to use does not support the providers available on the system. In order to solve this issue, a
Mon Jun 28 2021
Mohammad Kefah
Reactivly push element to array | Javascript
Sometimes when using a reactive frontend framework (`svelte`, `vuejs`), pushing elements to arrays using the `.push` method does not trigger re
Sun Jul 04 2021
Mohammad Kefah