Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, June 23, 2025

Install PKCS#11 in Brave, Linux

As Chrome’s adoption of Manifest V3 approaches, I’ve been trying Brave more and more, even in my Android. Using it for work had me in trouble though, since unlike Firefox, it has no native support to PKCS#11 USB tokens.

After trying a few things, I gave up. But a few minutes ago I stumbled upon a website which I’ve seen before, probably when setting up Chrome, and to my surprise it worked for my Linux Mint. He uses the same SafeNet eToken 5110 I’ve got here.

modutil -dbdir sql:.pki/nssdb/ -add "eToken" -libfile /usr/lib/libeTPkcs11.so

I don’t know if it matters, but I ran the command above before installing Brave itself.

Tuesday, February 27, 2024

Linux recursive file searching

Searching recursively all files with the given extension:

find . -name "*.orig"

Searching all files containing the given text (source):

grep -Rn . -e "palavra"

Huge life saver.

Tuesday, January 9, 2024

Increase taskbar button width in Linux Mint 21

For my working VM, after ditching the sluggish Ubuntu 22 for the crazy good Mint Cinnamon 21, one of the customizations I wanted to make was the maximum width of the taskbar buttons. They seemed to narrow, while a lot of room was available.

After a couple minutes of searching, I found a direction in the Mint forums. The proposed solution is for Mint 20 – for Mint 21, it has a minor difference.

Edit, as root, the following file:

/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/constants.js

The value we’re after is MAX_BUTTON_WIDTH, which I increased from 150 to 210.

What caught my attention, though, is how all the layout building stuff is JavaScript.

Saturday, January 6, 2024

Installing dependencies of deb packages

A deb package can be installed on Linux by running:

sudo dpkg -i Package.deb

However, the installation may fail because dependencies are missing. In such cases, I found a tip which appears to work very well. After the failed dpkg command, run:

sudo apt-get -f install

This a shorthand for --fix-broken, and installs the dependencies and completes the aborted dpkg installation. Like magic.

Thursday, March 25, 2021

Displaying current Git branch in Bash prompt

I decided to show the current Git branch at my bash prompt whenever I’m at a directory which contains a repository. I found a rather convoluted Bash-esque solution, which I adapted to myself:

gitbranch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
}
#export PS1="\u@\h \[\e[32m\]\w \[\e[91m\]\$(gitbranch)\[\e[00m\]$ "
export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\e[33m\]\$(gitbranch)\[\e[00m\]\$ "

It’s compact and it works as intended.

Friday, December 11, 2020

Cleaning up a Git repository

Sometimes, after you mess up too much with your Git repository, it ends up with a couple useless objects, which are no longer referenced anywhere.

I created this alias a while ago, collected from sources I don’t remember anymore, to perform a cleanup in the repository. It’s particularly useful right after a git fetch:

alias gitcleanrepo='git fetch origin --prune && git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now gc "$@"'

Friday, July 7, 2017

Git amend updating date and time

When commiting code on Git, very often I realize I forgot some little detail right after I end the commit operation. This is very annoying. Fortunately, we have the amend command. Recently I found a very cool trick to use with amend command: updating the date and time of the commit together with amend.

So, with those in hand, I’m now using a nice alias on my ~/.bashrc file:

alias gitamend='git commit --amend --date="$(date -R)"'

And my own memory faults are now easily addressed.