Change docker data directory

There are other ways to do this, but a simple one is to replace the default directory with a symbolic link to wherever you want to have your data directory. This is tested with OpenSuse LEAP 42.3.

Stop docker (if it is running):

service docker stop

Move the contents of the docker default data directory (under Suse this is /var/lib/docker/) to somewhere else:

mv /var/lib/docker/ /path/to/new/folder/

Now create a symbolic link to the new location in place of the default directory:

ln -s /path/to/new/folder/ /var/lib/docker/

Start docker again, it should use the new location:

service docker stop

(PS: In my case I had not deleted all containers and images before, so I had some things that linux didn’t want to move to the new location. I just deleted them manually:)

btrfs subvolume delete btrfs/subvolumes/*

sshfs – mount files over ssh

Mount a file system on a different computer via ssh:

sshfs -o follow_symlinks user@server:/home/user/ /path/to/mount/point

server is the other computer, user is your username on the other computer and /home/user/ is the folder you want to include from the other computer. /path/to/mount/point is the place on your drive where the files will be located. It needs to be a folder that exists and is empty.

To get rid of the mounted folder again use

umount /path/to/mount/point

Other settings for “non-scientific” texts in LaTeX

Figures that have no numbers, but only text in the captions:

\usepackage{caption}
\captionsetup[figure]{labelformat=empty,textfont=footnotesize}
\renewcommand{\thefigure}{}

No indentation at the beginning of a paragraph, but a bigger separation space between paragraphs:

\setlength\parindent{0pt}
\addtolength\parskip{4pt}

Header lines that contain only page number and chapter, not the section:

\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\automark[chapter]{chapter}
\ihead{\headmark}
\ohead{\pagemark}

LaTeX package “wrapfig”

LaTeX is all nice and fancy if you write technical texts, where the pictures are floating in the text (mostly at the top and/or bottom of pages) and you reference them with numbers. But as I do all sorts of things with LaTeX, sometimes I want more “fun” texts which have pictures somewhere in the pages and text flowing around them.

For this purpose, I have now discovered the package wrapfig:

\usepackage{wrapfig} 

You can include a picture like this (this one floats left of the text with a width of 7em):

\begin{wrapfigure}{l}{7em}
\centering
\includegraphics[width=\linewidth]{AuthorOfArticle.png}
\end{wrapfigure}

You can control some of the appearance with different settings in the preamble (see the documentation at CTAN), e.g.,

\intextsep0.5ex

Docker cleanup

Delete all containers

docker rm $(docker container ls -a -q)

Delete all unnamed images

docker rmi $(docker image ls | grep "<none>" | tr -s ' ' | cut -d ' '  -f 3)

docker image ls lists all images,
grep "<none>" selects all that have the tag (or repository! or part of name!) “<none>” ,
tr -s ' ' merges sequences of spaces to a single space,
cut -d ' ' -f 3 splits each line at the space and gives the third column (the image id).
The list of ids is then passed on to docker rmi to be deleted.

Use at your own risk!

How to get WiFi running on Suse Leap 42.3 (Broadcom driver)

After the update from Suse Leap 42.2 to Suse Leap 42.3, my Wifi stopped working. Which is kind of bad, because I need internet to figure out what is wrong…

This was the situation right after the update, when it was not working:

> lspci -nnk | grep -A 3 "Network"
04:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)
        Subsystem: Hewlett-Packard Company Device [103c:804a]
        Kernel driver in use: bcma-pci-bridge
        Kernel modules: bcma
> hwinfo --short
network:
  eth0                 Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
                       Broadcom BCM43142 802.11b/g/n
network interface:
  eth0                 Ethernet network interface
  lo                   Loopback network interface
> iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
> lsmod | grep "wl"

No WiFi to be seen!

So now this is what I did:

  1. Remove the old driver:
    > rpm -e broadcom-wl broadcom-wl-kmp-default 
    
  2. Find out my exact kernel version (the last part is the part we need, i.e., “default”):
    > uname -r
    4.4.104-39-default
    
  3. Add the Packman repository to my repositories:
    > zypper addrepo http://packman.inode.at/suse/openSUSE_Leap_42.3/ packman
    
  4. Install the drivers, paying attention to my kernel type (…-“default”):
    > zypper install broadcom-wl-kmp-default broadcom-wl
    

    You can also download the rpm by hand and install it. In that case, you need to pay attention to the full kernel number. Meaning, for my kernel 4.4.104-39, I should install the driver from broadcom-wl-kmp-default-6.30.223.271_k4.4.49_19-3.6.x86_64.rpm where the numbers after the k match exactly. Using Packman does that for you.

    Another issue I had with manual installation was missing keys. At least my configuration forces a valid PGP key and aborts if no key is in the key list. And I didn’t have a key for the downloaded rpms. It is possible to tell rpm to install the packages without checking the key (option --nosignature), but that did not properly install the package (without error messages, of course). When installing with zypper it looks for the key itself and you don’t have to worry.

  5. I rebuilt the loaded modules list and then restarted, but I am not sure it is necessary:
    > mkinitrd
    

Finally, the outputs of the above commands are (for reference, the next time it breaks):

> lspci -nnk | grep -A 3 "Network"
04:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)
        Subsystem: Hewlett-Packard Company Device [103c:804a]
        Kernel driver in use: wl
        Kernel modules: bcma, wl
> hwinfo --short
network:
  eth0                 Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
  wlan0                Broadcom BCM43142 802.11b/g/n

network interface:
  wlan0                WLAN network interface
  eth0                 Ethernet network interface
  lo                   Loopback network interface
> iwconfig
lo        no wireless extensions.
wlan0     IEEE 802.11abg  ESSID:"..."  
          Mode:Managed  Frequency:2.412 GHz  Access Point: ...   
          Bit Rate=65 Mb/s   Tx-Power=200 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-39 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
eth0      no wireless extensions.
> lsmod | grep "wl"
wl                   6451200  0 
cfg80211              610304  1 wl

And it only took all afternoon … sometimes I hate Linux 🙁

Inkscape Basics (because I forgot what I knew a week ago)

Resize Inkscape svg canvas to it’s content
Go to File -> Document Properties -> Page
Resize page to drawing or selection

Add guides helps with alignment etc.
Just click ruler and drag down from top, left or even top/left for diagnonal guide

Setup/Change snapping when moving objects around
Go to File -> Document Properties -> Snap

Change color of object
Go to Object -> Fill and stroke (Shift+Ctrl+F)

Posted in Mac