elvinguti.dev

Writing my personal experiences about GNU/Linux and development.

Xargs command

xargs is a great command that can help us to run commands from the output of another command. From tldr xargs: Execute a command with piped arguments coming from another command, a file, etc. The input is treated as a single block of text and split into separate pieces on spaces, tabs, newlines and end-of-file. For the examples we’re going to use the seq command: # Print 3 numbers seq 3 # 1 # 2 # 3 # xorgs wil print the numbers "inline" seq 3 | xargs # 1 2 3 # -n will use a max number of arguments per command line seq 3 | xargs -n 2 # 1 2 # 3 # -I is used to replace {} with the argument from the previous command seq 3 | xargs -I {} echo 'number {} printed' # number 1 printed # number 2 printed # number 3 printed # Create 1, 2, 3 folders seq 3 | xargs mkdir # Remove 1, 2, 3 folders seq 3 | xargs rm -rf

July 3, 2024 · 1 min · Elvin Guti

Map array in server side Google tag manager

Sometimes you need to send to a third party service a different array structure than the one specified on Google Analytics 4 (GA4). So, in case you don’t want to create a new event only for this service and you want to reuse as much as posible a GA4 event like add_to_cart, then you need to map the GA4 built in array on GTM. This sounds pretty easy if you have used GTM (no server side) before, basically you create a new custom javascript variable and return the mapped array....

May 8, 2024 · 2 min · Elvin Guti

Fix "xbacklight no output have properties" on Arch Linux

The Xbacklight no output have properties message can happen if your hardware has poor support or it can’t be detected properly by the xbacklight utility. This might be fixed by using an xbacklight wrapper called acpilight. acpilight can also be used to control the display and keyboard backlight on modern laptops. First, install the acpilight package: sudo pacman -Syu acpilight Add a udev rule to give access to users in the video group, this is needed because users don’t have permissions to alter sys files by default:...

April 30, 2024 · 1 min · Elvin Guti

How to install and upgrade packages on Arch Linux

Arch Linux uses a package manager called pacman, as you may know this is pretty standard on any linux distro, however, I’ve seen that not all the people use the same way to install or upgrade packages. The simpler way you can install a package with pacman is: pacman -S package_name But, this will only install the package on your system and nothing else. You may say but that’s what I want basically, but due to the rolling release nature and since partial upgrades are not supported on Arch Linux this might not be the best approach in the long term and could even break your system....

April 19, 2024 · 2 min · Elvin Guti

Show full branch name on powerlevel10k theme

powerlevel10k is a popular zsh theme and my favorite one. However, branch names are truncated if these are pretty long. Although, you can remove this limitation by updating its config file: vim ~/.p10k.zsh Search for the branch name and comment the line that’s doing the truncation: # Tip: To always show local branch name in full without truncation, delete the next line. # (( $#branch > 32 )) && branch[13,-13]="…" # <-- this line You might need to restart zsh...

April 16, 2024 · 1 min · Elvin Guti