Copy SSH id
ssh-copy-id -i ~/.ssh/id_rsa firstname.lastname@example.org:~/.ssh/
Installing node js and npm on debian
curl -sL https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs
Installing Go on debian
Instructions followed of Linode worked well. The latest version has to be noted and replaced below from Go’s download page.
cd ~/temp curl -O https://storage.googleapis.com/golang/go1.12.7.linux-amd64.tar.gz
Verifying the sign
Change ownership of the file
sudo chown -R ~/temp/go sudo mv go /usr/local
Change the .profile file
cat >> ~/.profile << EOF # Adding go to the path export GOPATH=$HOME/go export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin EOF [/sourcecode] <p> Re-read the profile </p> source ~/.profile
Setting hostname on debian
hostnamectl set-hostname example_hostname
Setting 256 colors in the terminal while using tmux
Add this to the ~/.tmux.conf file. This may have to be created if unavailable.
touch ~/.tmux.conf cat >> ~/.tmux.conf << EOF set -g default-terminal "tmux-256color" EOF [/sourcecode] </div> </div> <div id="outline-container-org1f9eb51" class="outline-2"> <h2 id="org1f9eb51">tmux notes and resources</h2> <div class="outline-text-2" id="text-org1f9eb51"> <p> <span class="timestamp-wrapper"><span class="timestamp">[2019-08-03 Sat] </span></span> I have recently started using tmux to manage my VPS, which hosts my website and hopefully many more convenient things down the line. </p> <p> A good prefix could be <code>C-/</code>. Some of the commands are not totally intuitive like in Emacs. However, there are a number of plugins that can make life easier. </p> <p> This <a href="https://jdhao.github.io/2019/01/17/tmux_plugin_management/">blog post</a> outlines a good good approach, that starts with installing hte tmux plugin manager, which makes it easy to install plugins. I will reproduce the steps here for convenient reference. This is a part of converting my entire configuration into org source blocks, which can be tangled into configuration files. In this way, it also becomes easier to maintain. </p> git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm # Append the following configuration to the .tmux.conf file cat >> ~/.tmux.conf << EOF # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-copycat' set -g @plugin 'tmux-plugins/tmux-pain-control' # .... maybe more plugins here # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run -b '~/.tmux/plugins/tpm/tpm' EOF [/sourcecode] <p> Detach the tmux process and return to the server's shell. The configuration of the server will have to be refreshed. It does not appear that the server has to be shut down, atleast for the changes above. </p> tmux source ~/.tmux.conf
- Close a tmux window : Prefix + &
Process control: background and foreground
- see this SO discussion link
- C-c for ending a process running in the foreground.
- C-z – suspend current program
jobs: to find a list of the suspended programs, with number tags.
- subsequently use bg % 1 to background a suspended process
- fg % 1 to bring a process to th e foreground.
Installing the Iosevka font
On Debian distros
There appear to be no packages for iosevka for debian. The prescribed method is to add the fonts to the fonts folder. The github issues point towards a PPA which can be added. However, this did not work for me, and I had to resort to manual means.
Downloading the specified font version from github into a temp folder
Extracting the contents of the downloaded zip file to a folder named iosevka.
cd ~/temp unzip -u 01-iosevka-2.2.1.zip -d iosevka
For system wide recognition, the ttf files have to be placed in
usr/share/fonts as per the debian wiki. Sudo permission is required for writing to this location. Optionally, the font folder can also be copied to
~/.local/share/fonts/, for a user specific setting.
sudo cp -r ~/temp/iosevka /usr/share/fonts/
Finally, it is a good idea to refresh the font cache
To set the font in Emacs:
(set-face-attribute 'default nil :family "ttf-iosevka" :height 140)
Note: The file permissions for the ttf files have to be set to
644 to be usable. This should be checked if the above does not work.
The font files have to be downloaded and placed in to the location
/usr/local/share/Fonts for system wide access.
On Arch / Antergos
Use AUR to install iosevka in Antergos / Arch as the package is already available.
yay -S ttf-iosevka
Setting the font in Emacs. This should be added to the init. The font height could vary based on the monitor size.
(set-face-attribute 'default nil :family "ttf-iosevka" :height 120)
Setup gpg-agent to be running whenever gpg is called
For some reason, it appears though the gpg-agent is shown to be running, this configuration is required to make sure that the entered keys are stored in the keyring.
cat >> ~/.gnupg/gpg.conf <<EOF no-greeting no-permission-warning lock-never keyserver-options timeout=10 use-agent EOF [/sourcecode] </div> </div> <div id="outline-container-org2c17aaa" class="outline-2"> <h2 id="org2c17aaa">Install tk especially for being able to select the CRAN mirrors in R</h2> <div class="outline-text-2" id="text-org2c17aaa"> <p> This is pertinent to Arch based distros. </p> sudo pacman -S tk
Git global config
git config --global user.email "email@example.com" git config --global user.name "Mad Max"
scp : tranfer a folder to the server
The command will look like:
Transferring a single file does not require the -r switch.
Upgrading a debian distro
sudo apt-get update sudo apt-get dist-upgrade
App installation in debian using flatpak
Some apps are not available in the so called stable debian software archives. Therefore alternative sources have to be established for the same.
Installing flatpak on debian and adding the flatpak repository:
sudo apt-get install flatpak sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Reboot after the above commands.
Note: Calling a flatpak based app is rather verbose, and is better served by defining appropriate aliases.
Franz: Multi-network messenger
This app covers Slack and Whatsap and other networks. It still takes up about 1GB of RAM and the app itself is about 500MB, but it atleast covers all the platforms in one go and should be useful in the office.
In addition, the
org.freedesktop.Platform package has to be installed. The latter gets installed automatically, when executed in the terminal.
Pre-requisites for debian/ubuntu
sudo apt install libx11-dev libxext-dev libxss-dev libxkbfile-dev
flatpak install flathub com.meetfranz.Franz
The Slack app takes up a lot of memory.
flatpak install flathub com.slack.Slack
Swapping control and Capslock
Creating xmodmap script : Swapping control and capslock keys Source: link
cat > ~/.xmodmap <<EOF ! ! 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 EOF [/sourcecode] <p> Executing xmodmap on the configuration above </p> xmodmap ~/.xmodmap
The above command should be added as the last command in the autostart option of ~/.config
cat > ~/.config/
Installing Firefox developer edition
The developer edition of Firefox contains interesting features, and it appears to perform better. The developer edition is available as a package on Arch Linux (AUR). For Debian, the procedure is a little round-about.
The following procedure using flatpak is picked up from the Debian wiki page.
Unofficial builds are provided by Fedora at https://firefox-flatpak.mojefedora.cz/
sudo apt install flatpak sudo flatpak remote-add --from gnome https://sdk.gnome.org/gnome.flatpakrepo sudo flatpak remote-add --from org.mozilla.FirefoxRepo https://firefox-flatpak.mojefedora.cz/org.mozilla.FirefoxRepo.flatpakrepo
Then for “developer edition” (aka “Beta”):
flatpak install org.mozilla.FirefoxRepo org.mozilla.FirefoxDevEdition
flatpak run org.mozilla.FirefoxRepo org.mozilla.FirefoxNightly
The Debian wiki also describes a method to add the flatpak installations to the Path. However, this is a newer feature and is unavailable at the moment on my machine.
echo 'export PATH=$PATH:/var/lib/flatpak/exports/bin' >> ~/.zshrc
Emacs can be installed via Conda
- Note taken on
One issue with using Emacs from Conda is that emacs is then no longer available as a program in the command line when you switch to another virtual environment.
The advantage of using conda is being able to quickly install reasonably recent versions of Emacs quickly on Debian type OS’s which often reference older (stable) versions of software packages by default. Using conda would avoid adding PPA’s or hunting for binaries or even compiling from source. Another advantage is that this approach can be used cross platform.
One disadvantage of this method is that the package is installed into the miniconda / anaconda package installation path. Though the instillation script of miniconda adds the path for bash, it has to be manually set for any other shell like zsh. However, once this is done – there appear to be no issues in using Emacs.
conda install -c conda-forge emacs
Virtualbox: resizing virtual disk image – vdi
It does not appear to be possible to expand the size of a fixed format vdi. The floating format has a disadvantage of a read-write overhead for expanding the disk image as it is utilised.
However, as per the documentation, after the hard disk size reaches a stable stage, this overhead becomes negligible on an average.
Therefore the vdi has to be copied (or cloned), and the floating format has to be selected. This is done using the copy option in the virtualbox media manager. Once copied, the expanded vdi image has to be attached to the guest OS.
When the attachment is complete, the hardisk will show up in the virtualbox media manager app. Now the vdi size can be adjusted to the desired value.
The next step is to download the live iso of gparted. This should be loaded as a storage device with the live CD option selected. With this loaded, the existing partitions have to be changed appropriately1. This step has to be done to enable Linux to recognise the expanded harddisk.
Once this has been, the gparted iso can be removed and the guest OS can be booted as usual. However, the UUID of the paritions have to be changed appropriately. If not changed, there will be delay during boot, especially if the swap partition has been modified.
The actual partition setup and the UUIDs can be viewed with:
The appropriate UUID has to be replaced in the file
/etc/fstab. Technically, the fstab file is generated by the command
mkinitcpio, but sometimes a manual change is necessary.
Downgrading a single package in Arch linux
From the Arch linux wiki : archive : downgrading via downloading the Package from URL. Find the package you want under /packages and let pacman fetch it for installation. For example:
pacman -U https://archive.archlinux.org/packages/ ... packagename.pkg.tar.xz
Downgrading via local cache
pacman -U /var/cache/pacman/pkg/<package-name>
It seems to be a very good idea to maintain a few older versions of packages in the cache, even at the expense of Harddisk space.
Further options are provided at this Unix stack exchange discussion.
It is likely that the swap partition is the last partition, and the previous partition is the root which has to be extended. In this case, the swap has to be deleted and the root partiion should be expanded to the desired size, leaving behind room for the swap partition. The final unallocated space has to be used for a new extension partition and then a logical partition to create the linux-swap. For some reason, there is a space of 1MB preceding the swap partition.