Skip to Content

Notes

2018-06-03T1956

Ignore shellcheck error on a case-by-case basis …

Install_pkgs {
    TOOLS="tool-1 tool-2 tool-3"
    # shellcheck disable=SC2086
    apt-get -y install $TOOLS
}

Link: https://github.com/koalaman/shellcheck/wiki/Ignore

2018-05-31T1637

Virtualbox guest additions from Oracle: Download the VBoxGuestAdditions_VERSION.iso

$ wget -c http://download.virtualbox.org/virtualbox/VERSION/VBoxGuestAdditions_VERSION.iso

In the GUEST window menu, select Devices > Insert Guest Additions CD image to make the image accessible to the VM. Inside the VM: mount the image; run the install script; add user to the vboxsf group; reboot the VM, and as root …

mount /media/cdrom
sh /media/cdrom/VBoxLinuxAdditions.run
adduser USERNAME vboxsf
reboot

If the virtualbox modules need to be rebuilt for any reason for the running kernel …

$ uname -r | sudo xargs -n1 /usr/lib/dkms/dkms_autoinstaller start

2018-05-20T0929

Background colour specified by xsetroot in ~/.config/openbox/autostart was not being set. Turns out that the compositing manager that I use - compton - does not read XSetWindowBackground() used by xsetroot.

[ Fix! ] Compton reads _XROOTPMAP_ID or _XSETROOT_ID. Install hsetroot that uses these properties …

$ sudo apt install hsetroot

Add to autostart

hsetroot -solid "#000000"

Link: Compton incompatible with xsetroot

2018-05-18T0947

Network-manager and the nm-applet on Openbox: No prompt for the wireless passphrase when connecting to new access points. Confirmed that dbus, gnome-keyring, and polkit were installed and running …

589 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
13763 /usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh
22762 /usr/lib/policykit-1/polkitd --no-debug

Noticed that dunst (lightweight notification daemon) was failing to launch, command notify-send was absent, and this error message was cropping up …

Error connecting: Failed to execute child process "dbus-launch" (No such file or directory)

[ Fix! ] Installing these packages fix the issues with nm-applet and notifications …

$ sudo apt install dbus-x11 libnotify-bin

2018-05-12T1136

Openbox: Set default that will match all normal windows and maximize + remove decorations when launched. Leave things like dialog windows or panels untouched. Modify ~/.config/openbox/rc.xml

<application type="normal">
    <maximized>true</maximized><decor>no</decor>
</application>

… except for VLC …

<application class="vlc">
    <maximized>false</maximized><decor>yes</decor>
</application>

Links: Launching windows maximized; Finding parameters

2018-05-10T2212

Install the latest Firefox Stable on Debian Stretch.

Create ~/opt directory to store programs in $HOME. Download and unpack the latest binaries from the official website, and create a link to the executable in my PATH …

$ wget -c -O FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
$ tar xvf FirefoxSetup.tar.bz2 -C ~/opt/
$ sudo ln -s ~/opt/firefox/firefox /usr/local/bin/

2018-04-29T1611

After running a minimal Ubuntu install on my laptop with LUKS encryption, the boot process would halt for ~30 seconds then generate this message …

Gave up waiting for suspend/resume device

… followed by a prompt for the passphrase to unlock encrypted home, then continue to login.

[ Fix! ] System is looking for a swap device for suspend-to-disk/hibernate and fails to recognize my encrypted swap. I don’t use hibernate, so I disable the task by adding kernel option noresume.

Modify /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet noresume"

… and update …

$ sudo update-grub

Link: boot delayed by 30sec waiting for suspend/resume device

2018-04-28T1634

The Olympus Mons mountain on Mars is so tall and yet so gently sloped that, were you suited and supplied correctly, ascending it would allow you to walk most of the way to space. Mars has a big, puffy atmosphere, taller than ours, but there’s barely anything to it at that level. 30 Pascals of pressure, which is what we get in an industrial vacuum furnace here on Earth. You may as well be in space. Imagine that. Imagine a world where you could quite literally walk to space.

Link: http://www.warrenellis.com/?p=14314

2018-04-02T1918

Logwatch reported multiple attempts directed against the SSH port by a single illegal user trying to gain access to my home server.

SSH listens on a non-standard port, password authentication and root login is disabled already in my default setup. Still, attackers should not be given the chance to keep trying their luck, and I installed fail2ban as another line of defense …

$ sudo apt install fail2ban

Auto-starts with reasonable defaults.

2018-03-25T1028

Alzheimer’s disease without cognitive loss: From 1994 through 2011, the Religious Orders Study recruited more than a thousand Catholic nuns, priests and brothers, from across the United States, and collected over 350 brains for autopsy. Participants were drawn from a stable background of similar life experiences, education, and living standards (minimizing variables). Primary goals were to collect brain tissue from donors without dementia, and also from persons on whom clinical information had been collected prior to the onset of dementia.

Researchers were surprised to discover in post-mortem examinations that some of the brains displayed all the symptoms of full-blown Alzheimer’s, but the persons had exhibited no cognitive loss while alive. After studying risk factors, the study suggests that a rich cognitive environment and a positive psychology foster a “cognitive reserve” that the brain can enlist as it routes activity around damaged regions. Conversely, clinical depression showed a strong correlation with cognitive decline.

2018-03-21T2155

Once upon a time, I dreamt I was a butterfly, fluttering hither and thither, to all intents and purposes a butterfly. I was conscious only of following my fancies as a butterfly, and was unconscious of my individuality as a man. Suddenly, I awake, and there I lay, myself again. Now I do not know whether I was then a man dreaming I was a butterfly, or whether I am now a butterfly dreaming that I am a man.

– Zhuang Zhou (369-286 BC)

2018-03-20T2108

Cameron Mott began experiencing life-threatening seizures at three years old. As her condition deteriorated, doctors chose a radical solution: remove the damaged half of her brain, a procedure known as a hemispherectomy. After intensive rehabilitation, she made a remarkable recovery and is now living the life of a normal teenager. The natural property of neuroplasticity empowered her brain to remap the functions of the removed tissue on to the surviving hemisphere. Not all brain surgeries have such successful outcomes, but what kind of technologies could we develop to augment the brain’s natural abilities to self-heal?

2018-03-04T1500

Nothing is so firmly believed as that which we least know.

– Michel Eyquem de Montaigne, Of Divine Ordinances

2018-02-21T1156

The Guest House

This being human is a guest house.
Every morning a new arrival.
A joy, a depression, a meanness,
some momentary awareness comes
as an unexpected visitor.
Welcome and entertain them all!
Even if they’re a crowd of sorrows,
who violently sweep your house
empty of its furniture,
still, treat each guest honorably.
He may be clearing you out
for some new delight.
The dark thought, the shame, the malice,
meet them at the door laughing,
and invite them in.
Be grateful for whoever comes,
because each has been sent
as a guide from beyond.

– Rumi, translation by Coleman Barks

2018-02-03T1847

On my notes page I wanted to make my headers into anchor links with a small graphic to make it easy to link to a specific section of the page.

This post on Stack Overflow was helpful! Hugo already auto-generates an ID tag on each heading. I create a Hugo shortcode - a partial snippet of code that can be inserted into pages - that generates the header link decorated with the calendar icon from Feather Icons.

Create layouts/shortcodes/note-heading.html with …

{{ $id := .Get 0 | lower | replaceRE "[^0-9a-z]" "-" | replaceRE "-+" "-" -}}
<a href="#{{ $id }}">
    <h3 id="{{ $id }}">{{- partial "svg/icons" "calendar" -}} {{ .Get 0 }}</h3>
</a>

Then in my markdown document I use {{< note-heading “A note of interest ” >}} for headers.

2018-02-01T1113

Wipe the storage on a iMac G5 PowerPC All-in-one using a Lubuntu 16.04 Live Installer.

Download and write lubuntu-16.04-desktop-powerpc.iso to USB stick …

$ sudo dd bs=1M if=lubuntu-16.04-desktop-powerpc.iso of=/dev/sdX

Start the iMac, pressing the Command+Option+O+F keys to enter OpenFirmware. At the prompt, enter …

boot ud:,\\:tbxi

… and - if it works (it did) - Lubuntu live-installer boots. If not, its necessary to get the proper boot string for the USB stick. Check out Ubuntu PowerPC FAQ for details.

When the Lubuntu desktop appears, open a terminal and overwrite the internal drive (example: /dev/sda) with zeros …

$ sudo dd if=/dev/zero of=/dev/sda bs=1M

Takes approximately 75min per 100G.

2018-01-31T1835

What lies behind you and what lies in front of you, pales in comparison to what lies inside of you.

– Ralph Waldo Emerson

2018-01-26T2230

Access the ISS HDEV (High Definition Earth Viewing) stream using streamlink and display in VLC.

Streamlink is written in python. Install for user via virtualenv

$ sudo apt install virtualenv
$ virtualenv ~/code/streamlink
$ source ~/code/streamlink/bin/activate
(streamlink) $ pip install streamlink

Stream video …

(streamlink) $ streamlink http://www.ustream.tv/channel/iss-hdev-payload best
[cli][info] Found matching plugin ustreamtv for URL http://www.ustream.tv/channel/iss-hdev-payload
[cli][info] Available streams: 252p (worst), 360p, 486p, 720p (best)
[cli][info] Opening stream: 720p (hls)
[cli][info] Starting player: /usr/bin/vlc

Exit virtualenv

(streamlink) $ deactivate

Using streamlink without activating the environment …

$ ~/code/streamlink/bin/streamlink ...

Links: streamlink, the HDEV stream, and the ISS tracker

2018-01-20T1123

After assigning foo to a new group vboxusers (Virtualbox) I can reload the user’s group assignments without logging out …

$ sudo adduser foo vboxusers
$ su - $USER

Command id will now list the new group.

Link: https://superuser.com/questions/272061/reload-a-linux-users-group-assignments-without-logging-out

2018-01-18T1827

Tiny Tiny RSS update script was generating warnings that were being mailed to my admin account …

libpng warning: iCCP: known incorrect sRGB profile

[ Fix! ] Send the errors to null in my crontab …

55 * * * * /usr/bin/php /home/dwa/www/ttrss/update.php --feeds --quiet 2>/dev/null

2018-01-17T1121

Steps to verify a Ubuntu installer ISO …

0. Download SHA256SUMS and SHA256SUMS.gpg files from http://releases.ubuntu.com/16.04/

1. Get the key used for the signature from the Ubuntu key server https://tutorials.ubuntu.com/tutorial/tutorial-how-to-verify-ubuntu#2

$ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092" "C598 6B4F 1257 FFA8 6632 CBA7 4618 1433 FBB7 5451"
$ gpg --list-keys --with-fingerprint 0xFBB75451 0xEFE21092

2. Verify the signature

$ gpg --verify SHA256SUMS.gpg SHA256SUMS

3. Check the Ubuntu ISO with sha256sum against the downloaded sums

$ sha256sum -c SHA256SUMS 2>&1 | grep OK

Link: https://tutorials.ubuntu.com/tutorial/tutorial-how-to-verify-ubuntu

2018-01-12T2120

Install logwatch (log analyser) on server …

$ sudo apt install logwatch

Config file in /usr/share/logwatch/default.conf/logwatch.conf. Default cronjob in /etc/cron.daily/00logwatch.

2018-01-05T0919

We don’t see things as they are; we see them as we are.

– Anaïs Nin

2017-12-29T2136

Install Firefox quantum on Debian stable …

$ mkdir -p ~/debian/packages; cd ~/debian/packages
$ wget -c -O firefox-latest.tar.bz2 "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US"
$ tar -xvf firefox-latest.tar.bz2
$ sudo ln -s ~/debian/packages/firefox/firefox /usr/local/bin/

2017-12-08T1214

At any rate, here is a principle that is good and true: Bluntness is good in the design of information devices. Power relationships are unavoidable, but are always more ethical when they are stated clearly.

– Jaron Lanier, Dawn of the New Everything, p195

2017-12-06T1136

Successful innovators don’t ask customers and clients to do something different; they ask them to become someone different … Successful innovators ask users to embrace - or at least tolerate - new values, new skills, new behaviours, new vocabulary, new ideas, new expectations, and new aspirations. They transform their customers.

– Michael Schrage, Who Do You Want Your Customers to Become?

2017-11-16T2137

Slick Greeter for LightDM. Users can create and modify /etc/lightdm/slick-greeter.conf, settings in this files take priority.

I create a new backgrounds directory and copy over my images …

sudo mkdir /usr/local/share/backgrounds
sudo cp foo.jpg /usr/local/share/backgrounds/

Create /etc/lightdm/slick-greeter.conf

# LightDM GTK+ Configuration
[Greeter]
background=/usr/local/share/backgrounds/foo.jpg
theme-name=Ambiant-MATE-Dark
icon-theme-name=Ambiant-MATE
draw-grid=false

Link: https://github.com/linuxmint/slick-greeter

2017-11-16T1842

Increase the number of items stored in Places->Recent Documents in Ubuntu MATE.

In dconf editor go to org > mate > mate-menu > plugins > recent > num-recent-docs. Set Use default value to off and enter a Custom value.

Link: https://ubuntu-mate.community/t/increase-the-number-of-recent-documents-in-mate-panel/7407/5

2017-11-15T1642

Create keyboard shortcut to move a window to next monitor in a dual-display setup. Install …

sudo apt install xdotool wmctrl

Download this ‘move-to-next-monitor’ script, save it to ~/bin, and make it executable …

chmod 755 ~/bin/move-to-next-monitor

In Control Center->Hardware-Keyboard Shortcuts create a custom command and shortcut for the script.

Link: How to move a window to the next monitor

2017-11-14T1831

Pulseaudio for Ubuntu MATE. Sound works OK (on Thinkpad E520). Configure volume hotkeys in custom .xbindkeysrc.thinkpad_e520 (@DEFAULT_SINK@ was auto-detected) …

# Volume mute/decrease/increase                      
"pactl set-sink-mute @DEFAULT_SINK@ toggle"          
    F1                    
"pactl set-sink-volume @DEFAULT_SINK@ -5%"           
    F2                    
"pactl set-sink-volume @DEFAULT_SINK@ +5%"           
    F3

Load custom file with xbindkeys --file ~/.xbindkeysrc.thinkpad_e520.

If @DEFAULT_SINK@ not auto-detected, set manually. First, by detecting the default output source …

pacmd list-sinks | grep -e 'name:' -e 'index'
  * index: 0                                   
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo>

… then set it as the system wide default, by adding the following to /etc/pulse/default.pa

set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo

Restart pulseaudio with pulseaudio -k (kills and restarts).

Link: Pulseaudio examples

2017-11-13T2222

Ubuntu MATE 17.10: Custom start page set in Firefox constantly overwritten and reset back to MATE start page.

[ Fix! ] Edit /usr/lib/firefox/ubuntumate.cfg with my preferred start page.

2017-11-12T2128

Ubuntu MATE 17.10: Set custom time format on panel using dconf-editor.

Modify /org/mate/panel/objects/clock/prefs/ format from 24 hours to custom, then modify custom-format to preferred setting, example: %j:%d:%H:%M.

Link: Customize panel date-time

2017-10-28T1701

Enable periodic TRIM on SSD drives. Create a weekly TRIM job in /etc/cron.weekly/trim

#!/bin/sh
# trim all mounted file systems which support it
/usr/bin/fstrim --all

Make the file executable and test …

$ sudo chmod 755 /etc/cron.weekly/trim
$ sudo /etc/cron.weekly/trim                # check the program runs without errors
$ sudo run-parts --test /etc/cron.weekly    # checks that cron can run the script
    /etc/cron.weekly/trim                   # this should be output of run-parts

Links: Proper way to trim ssd in void linux and HOWTO configure periodic trim

2017-10-25T2126

Crappy font rendering in firefox. [ Fix! ]

$ mkdir ~/.config/fontconfig
$ cp /etc/fonts/fonts.conf ~/.config/fontconfig/fonts.conf

Edit fonts.conf

<!--
    Fix crappy font rendering in firefox
-->
    <match target="pattern">
        <test name="family" qual="any">
            <string>Helvetica</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>sans-serif</string>
        </edit>
    </match>

Restart firefox and the jagged helvetica font has been replaced by the default sans-serif … which can be seen by running …

$ fc-match Helvetica
DejaVuSans.ttf: "DejaVu Sans" "Book"

Link: https://forum.voidlinux.eu/t/bad-font-rendering-in-firefox-for-helvetica/2748/5

2017-10-22T1622

Using a dark desktop theme renders input fields for websites viewed in Firefox with very faint text on white background.

[ Fix! ] Create ~/.mozilla/firefox/xxxxxxxx.default/chrome/userContent.css with …

input:not(.urlbar-input):not(.textbox-input):not(.form-control):not([type='checkbox']):not([type='radio']) {
    -moz-appearance: none !important;
    background-color: white;
    color: black;
}

#downloads-indicator-counter {
    color: white;
}

textarea {
    -moz-appearance: none !important;
    background-color: white;
    color: black;
}

select {
    -moz-appearance: none !important;
    background-color: white;
    color: black;
}

Link: Unreadable input fields with dark GTK+ themes

2017-10-21T1315

Using runit init … To stop an enabled service from starting automatically at boot, create a file named down in the service directory …

sudo touch /etc/sv/*service_name*/down

2017-10-07T1116

Act without doing;
work without effort.
Think of the small as large
and the few as many.
Confront the difficult
while it is still easy;
accomplish the great task
by a series of small acts.

The Master never reaches for the great;
thus she achieves greatness.
When she runs into a difficulty,
she stops and gives herself to it.
She doesn’t cling to her own comfort;
thus problems are no problem for her.

– Lao Tzu, Tao Te Ching, Ch 63

2017-09-28T1203

Pulseaudio for Arch Linux … set default sink.

Set the default output source …

$ pacmd list-sinks | grep -e 'name:' -e 'index'
  * index: 0                                   
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo>

To set it as the system wide default, add the following to /etc/pulse/default.pa

set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo

Restart pulseaudio with pulseaudio -k (kills and restarts).

The default sink can be referred as @DEFAULT_SINK@ in commands, for example …

pactl set-sink-volume @DEFAULT_SINK@ +5%

2017-09-17T1150

Since the late 1980s, scientists have been tracking a whale who sings at a sonic frequency higher than any other whale of its species: at 52 hertz, just above the lowest note on a tuba. It sings songs no one answers. Internet societies have been following it for years like sad Ahabs, transposing their own feelings on to it, believing they understand it. Alone in their bedrooms they hunt this whale they believe to be lonely just like them. Talk to scientists and they will say other whales can probably hear it, maybe it’s deaf, maybe the whale’s song is the result of a genetic mutation. But it doesn’t matter: the lonely people have taken this whale as their totem. I’ve followed it for years.

Link: https://www.theguardian.com/global/2017/sep/17/choosing-to-be-on-your-own

2017-08-30T2055

Extend an LVM logical volume and filesystem: the quick and automatic way … If you are growing the LV you can do this while the filesystem is mounted …

sudo lvresize --resizefs --size +100G /dev/vg/home
    Size of logical volume vg/home changed from 238.42 GiB (61035 extents) to 338.42 GiB (86635 extents).
    Logical volume vg/home successfully resized.
    resize2fs 1.43.4 (31-Jan-2017)
    Filesystem at /dev/mapper/vg-home is mounted on /home; on-line resizing required
    old_desc_blocks = 30, new_desc_blocks = 43
    The filesystem on /dev/mapper/vg-home is now 88714240 (4k) blocks long.

Link: https://www.systutorials.com/5621/extending-a-mounted-ext4-file-system-on-lvm-in-linux/

2017-08-23T2205

Disable system beep on a Thinkpad …

sudo rmmod pcspkr

Permanently … edit /etc/inputrc to disable in console …

set bell-style none

… add to.xinitrc

xset b off

NOTE: this did not work … adding blacklist pcspkr to (add/create) /etc/modprobe.d/blacklist.

2017-08-05T1840

Fresh install of Tiny Tiny RSS allows a single URL path to be set. I want multiple URLs to support both local and remote access.

[ Fix! ] Disable URL checks by adding to config.php

define('_SKIP_SELF_URL_PATH_CHECKS', true);

Link: Access by local + domain IP

2017-07-21T1033

Enable forward search in Bash history. CTRL-R enables reverse incremental searches through the Bash shell history and CTRL-S runs forward searches. However CTRL-S collides with XON/XOFF flow control in terminal and disables that feature in history.

[ Fix! ] Disable XON/XOFF in $HOME/.bashrc

stty -ixon

Hitting CTRL-S by mistake in vim no longer disables output to the terminal.

Link: Unable to forward search Bash history similarly as with CTRL-r

2017-07-20T1039

A simple GIMP recipe for play at making 8-bit pixel images:

  • Open image and select Colors > Brightness-Contrast > Contrast to increase contrast
  • Image > Scale Image > 10% Interpolation: None
  • Image > Scale Image > 400% Interpolation: None

Manipulate the scale image settings to increase/decrease pixelation to satisfaction.

2017-07-17T0941

Linuxlogo provides Tux, the Debian swirl, and other distro logos that can be displayed - along with system information - at the console login prompt …

sudo apt-get install linuxlogo
sudo cp /etc/issue /etc/issue.bak
sudo sh -c 'linux_logo -L debian -F ".: Greetings, Carbon-Based Biped :.\n\n#O Version #V\nCompiled #C\n#H \\l" > /etc/issue'

2017-07-14T1538

Correct the ‘stripping effect’ in QT applications using the Breeze Dark theme. Example: Transmission-qt would show file listings in alternating background colours, with every other line rendered in light background and foreground colours.

[ Fix! ] Offending colour is #eff0f1. Replaced with #404552 in ~/.config/qt5ct/colors/breeze_dark.conf.

2017-07-13T0916

Retrieving Debian release information (depending on what I want) …

  • /etc/debian_version
  • /etc/os-release
  • lsb_release -c

2017-07-10T1846

Assign user to new group and reload assignments without logging out …

su - $USER
id        # see the new group

Link: https://superuser.com/a/354475

2017-07-09T0807

Nmap will quickly identify Internet services hosted by a network connected machine without even requiring to log in to it. Simply call the following command on another machine connected to the same network …

nmap 192.168.1.88

Link: DAH: 3.2.1.1. Network and Processes

2017-07-06T0857

Use apt-show-versions to check list of installed packages and available versions. Good way to quickly grep which packages are not part of the default release.

Install …

sudo apt install apt-show-versions

Release is stretch

apt-show-versions | grep -v stretch
  qt5ct:amd64 0.31-2 installed: No available version in archive
  volnoti:amd64 20161215T1244-1 installed: No available version in archive

2017-07-03T0900

Configure i3wm to put clients on specific workspaces. Run xprop in a terminal and click on the client to get WM_CLASS: first part is the instance, second part is the class

xprop
  [...]
  WM_CLASS(STRING) = "transmission-qt", "transmission"

Add the change to ~/.config/i3/config

# Assign torrent client to workspace 10
assign [instance="transmission-qt"] 10

Link: Automatically putting clients on specific workspaces

2017-07-02T1014

Addon for Firefox: Text Contrast for Dark Themes

Fixs issue with text entry on some websites (white text on white in gmail signin, yahoo search, others) when using the Breeze Dark QT theme.

2017-06-29T1237

Find and replace text with sed.

Save back to the original file …

sed -i 's/original/new/g' file.txt

Save to new_file.txt …

sed 's/original/new/g' file.txt > new_file.txt

Multiple text patterns and variables …

sed "s/$original/$new/g; s/$pattern2/$new_again/g" file.txt > new_file.txt

Link: https://askubuntu.com/q/20414

2017-06-28T1512

Lots of documentation and config samples are available in /usr/share/doc in gzip’ed format. Non-root user access with the zcat and zless commands. Make use of a config sample by redirecting output. Example …

zcat /usr/share/doc/dunst/dunstrc.example.gz > ~/.config/dunst/dunstrc

2017-06-28T1512

Default keyboard layout in Debian is configured in /etc/default/keyboard and is shared between X and the command line …

cat /etc/default/keyboard
  [...]
  XKBMODEL="pc105"
  XKBLAYOUT="us"
  XKBVARIANT=""
  XKBOPTIONS=""
  BACKSPACE="guess"

Modify this file to set a new default keyboard layout, either manually or run …

sudo dpkg-reconfigure keyboard-configuration

2017-06-26T1126

Limit the CPU usage of an application … I tried using handbrake-gtk to convert a video and the application grabbed 100% of all 4 cores, sent system temperature to 98C, and finally crashed the machine.

[ Fix! ] Install cpulimit and set the limit to 80 (20percent * 4 cores) …

sudo cpulimit -e ghb -l 80

2017-06-25T0922

Firework sounds for upcoming Canada Day!

sudo apt install sox

Screamer …

play -n synth sine 8000 bend 0.5,-1800,5 flanger 0 3 0 20 10 tri 20 quad trim 0 7

Bottle rocket …

play -n synth whitenoise 200 fade 0.2 1 1 trim 0 0.5 ; sleep 1 ; play -n synth whitenoise 200 fade 0 1 1 trim 0 1

Links: https://twitter.com/climagic/status/485083242425368579 and https://twitter.com/climagic/status/485069251401629697

2017-06-24T0844

Retrieve information about hardware using sudo dmidecode, or much of the same information is available to the non-root user in /sys/devices/virtual/dmi/id.

Link: https://unix.stackexchange.com/a/172334

2017-06-23T1001

Switch from default qwerty to the colemak keyboard layout …

setxkbmap -query
  rules:      evdev
  model:      pc105
  layout:     us
setxkbmap us -variant colemak
setxkbmap -query
  rules:      evdev
  model:      pc105
  layout:     us
  variant:    colemak

2017-06-22T1036

Generate list of packages installed on one machine running Debian for installation on another machine.

List of packages on first machine …

sudo dpkg --get-selections | grep -v deinstall > deb-pkg-list.txt

Install packages on the second machine …

sudo apt install dselect
sudo dselect update    # update dselect database
sudo dpkg --set-selections < deb-pkg-list.txt
sudo apt dselect-upgrade

2017-06-21T0832

VLC not playing mkv files on the chromebook. Generates error message …

libvdpau-va-gl: Decoder::Render_h264(): no surfaces left in buffer

[ Fix! ] In VLC navigated to Tools->Preferences->Input/Codecs and for Hardware-accelerated decoding switched to VA-API video decoder via x11 instead of using VDPAU. Or set avcodec-hw=vaapi_x11 in ~/.config/vlc/vlcrc.

Link: https://askubuntu.com/questions/714363/intel-vaapi-cant-play-mkv-with-vlc

2017-06-20T0926

Clearing the shell cache … I originally installed glances via apt to /usr/bin/glances, then removed, then installed via pip to /usr/local/bin/glances. The command would show in PATH but - without an explicit path defined - would continue to try and execute from /usr/bin.

[ Fix! ] Bash caches commands. Clear the cache of paths to executables using hash

type glances
  glances is hashed (/usr/bin/glances)
hash -d glances
type glances
  glances is /usr/local/bin/glances

2017-06-19T0953

Configure menu colours in Grub by creating /boot/grub/custom.cfg with settings …

set color_normal=white/black
set menu_color_normal=white/black
set menu_color_highlight=white/green

2017-06-18T0949

Stop pulseaudio from respawning after halt (encountered in Ubuntu 16.04) … When I kill pulseaudio with pulseaudio -k or kill -9 ID it immediately restarts …

pgrep pulse
  12808 /usr/bin/pulseaudio --start --log-target=syslog

[ Fix! ] There is a config file /etc/pulse/client.conf with autospawn = yes set by default. I could modify that, but chose instead to create ~/.config/pulse/client.conf and set autospawn = no. It works … pulseaudio stays dead.

2017-06-17T0921

Start a new project in Git and host on Github (after setting up a default config in ~/.gitconfig) …

mkdir new_project
cd new_project
touch .gitignore
touch README.rst      # rst will allow github to auto-detect and configure as a project homepage
git init
git add README.rst    #... or 'git add .' to add all files recursively
git status
git commit -a -m 'first commit'   # '-a' option auto-adds all files being tracked and commits them
git log               # to view commit history

Connect with Github …

git remote add origin https://github.com/vonbrownie/sitrep.git  # connect my local repo to github for first time
git remote -v  # confirm local knows about remote
git push -u origin master

… and to pull in (download) changes from Github master …

git pull origin master

2017-06-16T0950

Stop pinned tabs from auto-loading upon Firefox startup. Goto about:config and set to true

* browser.sessionstore.restore_pinned_tabs_on_demand    default boolean false

2017-06-15T0853

Debian stretch/stable xbacklight is acting up …

xbacklight -dec 10
  No outputs have backlight property

I can write to the file directly to increase/decreae display brightness …

cat /sys/class/backlight/intel_backlight/max_brightness 
  937
sudo sh -c 'echo 500 > /sys/class/backlight/intel_backlight/brightness'
sudo sh -c 'echo 937 > /sys/class/backlight/intel_backlight/brightness'

… or use xrandr

xrandr --output eDP-1 --brightness 0.5

This is a known issue.

[ Fix! ] Roll-back from xserver-xorg-core to xserver-xorg-video-intel.

Create /etc/X11/xorg.conf.d/10-video-intel.conf containing …

Section "Device"
    Identifier "Intel"
	Driver "intel"
EndSection

2017-06-14T2113

Trying to install Debian’s flashplugin-nonfree package consistently fails with the error ….

ERROR: wget failed to download http://people.debian.org/~bartm/flashplugin-nonfree/D5C0FC14/fp.24.0.0.221.sha512.amd64.pgp.asc

[ Fix! ] Manual install works courtesy of the instructions at https://wiki.debian.org/FlashPlayer#Manual_update

2017-06-14T0947

Setup colour scheme for vim. As per Giles recommendation I use tir_black. Place in ~/.vim/colors.

Set as default colour scheme in init.vim

colorscheme tir_black

Colour scheme works when neovim runs in terminal. Does not work inside tmux. Tmux is not seeing the 256 color palette …

tput colors
  8

[ Fix! ] Add to ~/.tmux.conf

set -g default-terminal "rxvt-unicode-256color"

Note: Kill all existing tmux sessions. It is not enough simply to start a fresh session. Helpful! http://stackoverflow.com/a/25940093

Launch a new tmux session. Neovim colours work OK!

echo $TERM
  rxvt-unicode-256color
tput colors
  256

2017-06-13T0847

Created a Debian stretch virtualbox guest but virtualbox-guest-{dkms,utils,x11} packages no longer available … but there are pkgs in sid.

[ Fix! ] Install the sid pkgs. Setup apt-pinning in /etc/apt/preferences

Package: *
Pin: release n=stretch
Pin-Priority: 900

Package: *
Pin: release a=unstable
Pin-Priority: 300

Add unstable to sources.list

deb http://deb.debian.org/debian/ unstable main contrib non-free

Update and install …

sudo apt -t unstable install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
sudo adduser dwa vboxsf

2017-06-12T1041

Local install of Python modules as non-root user. Example …

pip3 install exifread

… libraries are installed to ~/.local/lib/python-ver/ and the bins are placed in ~/.local/bin/.

Add ~/.local/bin to user’s $PATH.

2017-06-11T1020

If SSH session is frozen … Use the key-combo Enter, Shift + `, . [Enter, Tilde, Period] to drop the connection.

2017-06-10T0838

Microphone problem on Thinkpad x230 running Ubuntu 16.04 … No sound input and mic not detected.

[ Fix! ] Get capture device …

arecord -l                                                                         
  card 0: ... device 0: ...                                                            

… and edit /etc/pulse/default.pa with load-module module-alsa-source device=hw:0,0.

Kill and respawn pulseaudio with pulseaudio -k.

2017-06-09T0941

Restart network service on Ubuntu … Sometimes after wake-from-suspend the network connection is down and network-manager’s wifi ap list fails to refresh.

[ Fix! ] Simple systemd way …

sudo systemctl restart NetworkManager.service                             

If that doesn’t work … Try using nmcli to stop and start network-manager directly …

sudo nmcli networking off                                                 
sudo nmcli networking on                                                  

Old-fashioned SysV init script method still works on 16.04 …

sudo /etc/init.d/networking restart                                       
    ... or ...                                                              
sudo /etc/init.d/network-manager restart                                  

Last resort …

sudo ifdown -a  # -a brings down all interfaces                           
sudo ifup -a

2017-06-08T0920

Attaching to a wifi network with nmcli (network-manager cli client) …

nmcli radio
nmcli device
nmcli device wifi rescan
nmcli device wifi connect SSID-Name password PASS

2017-06-07T1219

Disable Pelican from auto-generating archives.html by adding to pelicanconf.py

ARCHIVES_SAVE_AS = ''

From URL Settings: “If you do not want one or more of the default pages to be created … set the corresponding *_SAVE_AS setting to “ to prevent the relevant page from being generated.”