Swapfile instead of a swap partition

First create the file to use for swap. I use /swapfile.

sudo dd if=/dev/zero of=/swapfile bs=1M count=2000

The above command would create a 2 GB file, feel free to adjust the size to fit your need.

Now set the correct permissions on the swapfile.

sudo chown root:root /swapfile
sudo chmod 600 /swapfile

Now setup that file to be used for swap.

sudo mkswap /swapfile

Enable the swapfile.

sudo swapon /swapfile

To have the swapfile automatically loaded on boot, add this to /etc/fstab.

/swapfile none swap sw 0 0

Now if you run free -m you can check that it lists the correct amount of swap.

Show week numbers in the Gnome DateTime Indicator

The date/time indicator in the Gnome3 panel does not show week numbers by default.

To change this run this command:

gsettings set com.canonical.indicator.datetime show-week-numbers true

At least in Elementary OS I found not GUI way of changing this.

Plexgear WR1 configuration on RasPlex

I recently bought a Raspberry Pi 2 for the TV in my sons playroom so that we can watch movies with Plex on our old TV. I got a Raspberry Pi 2 kit that contained all the needed parts:

  • Raspberry Pi 2
  • Transparent casing
  • Power adapter
  • 8 GB micro SD card (preinstalled with Kodi)
  • TPLink USB Wifi adapter
  • Plexgear WR1 remote

Since I want to use it as a Plex client I went with the RasPlex distribution for Raspberry Pi. Works well, easy to install, just DD the image over to the sd card:

dd if=RasPlex-RPi2.RP-1.0.2.img of=/dev/mmcblk0 bs=1MB

Obs

Make sure to use the correct output device so that you don't overwrite anything important. You can find the device name with either fdisk or lsblk.

Once up and running I noticed that some of the buttons on the remote did not work. Which made it impossible to go back to the main menu from after starting a movie. I did some searches and found that the remote came with a manual for how to configure the keys using an Kodi add-on. Bummer since I installed RasPlex :)

So after some tinkering I managed to create my own keymap configuration for configuring the remote in RasPlex.

First I enabled the "Enable debug logging" option under Preferences / System / Advanced. Not sure if it was required but I rebooted after that as well. Then I started pressing the buttons that did not work a couple of times.

After that connect to RasPles using SSH, and go to /storage/.plexht/temp and run this command to filter out the keypresses in the log

less plexhometheater.log | grep OnKey

From that output I could see that the buttons that did not work was home and leftwindows.

Then I created created my own keyboard.xml file in /storage/.plexht/userdata/keymaps with the following content:

<keymap>
  <global>
    <keyboard>
      <home>Back</home>
      <leftwindows>ContextMenu</leftwindows>
    </keyboard>
  </global>
</keymap>

I assigned the keys Back and ContextMenu, but if you want other actions you can look at the default keyboard.xml file in /usr/share/XBMC/system/keymaps.

PC or Mac

About two weeks ago I started to look at what my next laptop would be. I started looking at Apples Macbook Pro and it is very tempting since the hardware is far better than any PC, but will I stand with using Mac OS X?

I started using my wifes old Macbook as my daily driver as a test to see if I can get used to it. Since I'm a Linux user chosing a locked down Macbook would be a big step. I know you are able to install Linux on the Macbook, however that is not problem free.

Here is a list of things Apple to well:

  • Good looking hardware.
  • Excellent thermal design using the space in the display hinge instead of fan ventilation holes on the sides or bottom.
  • Good hardware components, like the Intel graphics iris 6100.
  • When you open the screen, the resistance on the screen hinge is balanced so that the rest of the computer stays in place instead of following the screen up in the air.
  • Good touchpad, when typing I don't acidentally make the cursor jump randomly by hitting the touchpad with my palms.
  • Long battery life.

Now to the bad parts:

  • There are no dedicated home/end keyboard buttons, instead there are multiple keyboard combinations you can use. I first found out about cmd+left/right arrow keys. That seemed good enough, but it turned out that it does not work in every application, and in the terminal that combination is used to switch between multiple terminal windows. So in the terminal you can use ctrl+a/e which also works in other applications as well. But the ctrl+a/e combo does not behave like home/end should in Sublime Text, there I need to use cmd+arrow keys. Why this inconsistency.
  • Copy/Paste typ operations is done with cmd+c/v instead of ctrl. I guess it makes sense to seperate copy (cmd+c) from sigint (ctrl+c, used to terminate terminal processes), I do however feel it's easier to use the same modifer key (ctrl) instead of adding another key. You just need to remember to use another combo in the terminal (which most normal users never use anyway).
  • When you use the cmd key in a combo like copy or paste, the Edit menu item in the top of the screen is highlighted blue, which causes an annoying blink effect.
  • There is no way to maximize a window, yes you read it correctly. You can't maximize windows, there is an option to maximize a window to full screen which creates a seperate virtual desktop for the app, however in this mode no other window can be floating over the maximized window. There is also a small plus button on each window which maximizes the window vertically but not horizontally, there you will need to drag the window border to the correct size which rarely fits the screen properly.
  • When you browse folders it leaves a .DS_store and a ._.DS_store file in each folder, these are hidden an not visible by default on your Mac, but then browing remote network shares it will polute those other systems to. I found some command online which was supposed to disable this, but it did not work for me, might have been for some other Mac OS X version?.
  • The Mac OS X filesystem is bad, this is not something that is visible to the users, but it is still in there in the back of my head.

At the moment I am back on my PC running Ubuntu to write this. And I don't see me going back to Mac in the near future.