Update Kernel

Quick guide on how to update a kernel on Gentoo Linux manually.

First copy the .config to the directory with the new kernel sources.

Next update the config. The oldconfig script will ask the user how to configure the additional options of the new kernel.

make oldconfig

Finally build the kernel and its modules, install the kernel and the modules and update grub.

make -j32 modules_prepare && make all -j32 && make modules_install && make install && grub-mkconfig -o /boot/grub/grub.cfg && emerge --ask @module-rebuild

Nikola Workflow

Planned directory structure

~/my/prj/web/            # Directory for all web projects using Nikola
~/my/prj/web/.env        # Python environment with nikola and friends
~/my/prj/web/example.com # Directory of one Nikola project
~/my/prj/web/example.org # Directory of another Nikola project

Prepare Python envinronment

cd ~/my/prj/web/
mkdir .env
python3 -m venv .env/
source nikola-env/bin/activate
pip install nikola
pip install aiohttp watchdog # Enables nikola auto build function.

Add bash alias to activate the environment

Add the following block to the bash alias file.

# Activate Python Virtualenv
# create this with mkdir .env && python3 -m venv .env
alias activate=". ../.env/bin/activate"

Monitor the website changes

Will render the page automatically when changes are saved to the nikola files.

nikola auto --browser

Bash Alias

Organize Aliases

Bash aliases are usefull, but you have to keep them organized. This can be done easily, if you use a separate file for all your aliases. Add the following block to the ~/.bashrc

# Add bash aliases.
if [ -f ~/.bash_aliases ]; then
    source ~/.bash_aliases
fi

now you can add aliases to ~/.bash_aliases

The following example adds an alias to activate python environments

echo "alias activate=". ../.env/bin/activate" >> ~/.bash_aliases

Excerpt of my alias file

# show the IPv4 IP my internet service provider assigned to me
alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
# Activate Python Virtualenv
# create this with mkdir .env && python3 -m venv .env
alias activate=". ../.env/bin/activate"
# common ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
# create a directory with the current date here
alias mkdatedir='mkdir `date --iso`'

Large screenshots

In order to create a screenshot of a program with a virtually larger resolution change the resolution with xrandr as follows

# set large screen 2560 is width and 10000 is the height
xrandr --output HDMI-1 --rate 60 --mode 2560x1440 --panning 2560x10000
# make screenshot and
# set back to normal
xrandr --output HDMI-1 --rate 60 --mode 2560x1440 --panning 2560x1440

Nikola Snippets

Nikola is a great static website generator. It converts restructured text to html pages. My favourite snippets are:

Headline level 2

Headline level 3

  1. Often we need strong text and italic formatting, or named external links such as TroLUG.

  2. Internal links to the title Nikola Snippets or Impressum

  3. literal commands are written like this @{}//.

!DANGER!

A warning.

All about danger.

!#/bin/bash
echo "Hello World."

Silent DVD Drive

DVD drives can be very noisy while watching a movie on DVD. hdparm can reduce the maximum speed of the DVD drive.

# we assume /dev/sdx is the DVD drive
hdparm -E 9 /dev/sdx