The Recommended Way To Clean The Package Cache In Arch Linux

Finally I’ve found a comprehensive post of how to clean the package cache in Arch! Thanks SK!

And before you go for a cache trim, maybe you want to check what packages you have installed and their size:

pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB | less
Advertisement

Installing Matlab on Archlinux

Download the Linux package from Mathworks.

  1. Before installing I’ve checked the Archlinux wiki:

https://wiki.archlinux.org/index.php/MATLAB

2. Just trying to execute the install script I was getting this error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to launch the MATLABWindow application

3. I decided to install Matlab using the AUR package:

https://aur.archlinux.org/packages/matlab#comment-735882

4. Installed all dependencies from the AUR package

5. Still some problems…. So checking the comments from the AUR package, I found this comment:

While trying to install r2020a I had this error after executing ./install:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to launch the MATLABWindow application

I solved this by installing libselinux (in AUR).

For the record: I found the missing dependency by executing ./bin/glnxa64/MATLABWindow.

Besides, it works without gtk2 (perhaps it now depends on gtk3).

https://aur.archlinux.org/packages/matlab#comment-735882

6. After installing libselinux I could execute the install script.

Copying local files and folders with rsync

To copy the contents of one local folder into another, replacing the files in the destination folder. The parameter -a also makes the copy recursive and preserve the modification times, but additionally it copies the symlinks that it encounters as symlinks, preserve the permissions, preserve the owner and group information, and preserve device and special files. This is useful if you are copying the entire home folder of a user, or if you are copying system folders somewhere else.

rsync -rtav source/ destination/

From jveweb.net

Trailing Whitespaces in VIM

Trailing whitespaces don’t bother me in general, let’s be clear, I don’t like them but there are other thousands things that bother me more. Although I hate (with hate, I mean it) when someone sends me a patch and I can’t apply it cleanly because of the trailing whitespaces… in this moment I understand this guy and this other trailing whitespaces hater.

Since I use Vim I leave here some solutions to remove and highlight them automatically.

Add to your .vimrc

Remove:

autocmd FileType c,cpp,vhd,h,sv,svh autocmd BufWritePre <buffer> %s/\s\+$//e

 

Highlight:

highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()

 

Got it from:

http://vim.wikia.com/wiki/Remove_unwanted_spaces#Automatically_removing_all_trailing_whitespace

https://stackoverflow.com/questions/356126/how-can-you-automatically-remove-trailing-whitespace-in-vim#356130

Moving The Ctrl Key

Two years ago I spent some weeks debugging a VME bus VHDL core using a logic analyzer. Looking for the probes in the logic analyzer suitcase I found “Happy Hacking Keyboard Lite 2”. It makes sense to ship a logic analyzer with such a compact keyboard, and since I’ve used and I’m in love with the keyboard. There was only a “problem”, the Ctrl Key and Caps key were swapped. After  a couples of ours I got used to typing with this layout. Since then anytime that I’m using a different keyboard, I swap immediately the keys:

Happy Hacking Keyboard Lite 2

1-25-07-hhkblite2_black

http://ergoemacs.org/emacs/swap_CapsLock_Ctrl.html

/usr/bin/setxkbmap -option ctrl:swapcaps

If you want the changes persistent you can use xmodmap, it is an utility for modifying keymaps and pointer button mappings in Xorg. Here it is the .Xmodmap:

 ! Swap Caps_Lock and Control_L
 remove Lock = Caps_Lock
 remove Control = Control_L
 keysym Control_L = Caps_Lock
 keysym Caps_Lock = Control_L
 add Lock = Caps_Lock
 add Control = Control_L

I got the idea from this super user post

Yet, I should add a udev rule to swap the keys when I connect a keyboard to the laptop, I will post the rule and post

For Windows

Remap Caps-Lock key to Ctrl in Windows 7/8

  • Press Windows key + R and type regedit.exe
  • Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
  • Create new entry with type Binary value named: Scancode Map
  • Modify value to:
    02 00 00 00 1D 00 3A 00
    00 00 00 00```
    
  • Restart computer


Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00

https://www.lifewire.com/remap-keyboard-in-windows-10-5181178

https://support.microsoft.com/en-us/topic/how-do-i-reassign-hot-keys-for-my-keyboard-703f897c-ad72-db5d-8e64-0928873d712f

http://xahlee.info/emacs/emacs/swap_CapsLock_Ctrl.html

http://xahlee.info/mswin/autohotkey_swap_capslock.html