Installation of therubyracer fails with "undefined method `include_path'"

Today I ran into trouble installing therubyracer on Ruby 1.8. The installation failed with

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
   ...

Installing multiple MySQL versions on the same Linux with mysql-sandbox

Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home:

  1. Install mysql-sandbox
sudo apt install mysql-sandbox
  1. Download the version of MySQL you want to use from mysql.com:
    https://dev.mysql.com/downloads/file/?id=480427
    Make sure to choose "Generic Linux" instead of "Ubuntu" so you get a .tar.gz instead of .deb

  2. cd into the directory the mysql binaries will be extracted to

mkdir -p ~/bin/sandbox_dist
cd ~/bin/sandbox_dist
  1. Build the sandbox
make_sandbo...

redshift

For all late night coders:

The program "redshift" changes your monitors' white balance according to your position on the planet and your local time. This is supposed to put less strain on your eyeballs than staring at a "daylight white" screen all day and night.
The program is in the Ubuntu repositories, so a simple "sudo apt-get install gtk-redshift" transfers it onto your hard drive.

I find the effect rather pleasing and so I have set the following alias on my computer:

alias rdshft='gtk-redshift -l 48.3714407:10.8982552 -t 6500:4200 &'...

Ubuntu: Restart sound services

Sometimes sound breaks for me and speaker output is completely broken. This helped:

pulseaudio -k && sudo alsa force-reload

Howto: Create a self-signed certificate

Option 1: Creating a self-signed certificate with the openssl binary

As igalic commented on this gist.

openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout server.key -out server.crt

Explanation

req -new

Create a new request ...

-newkey
: ... using a new key ...

rsa:2048

... of type RSA, 2048 bits long.

-sha1
: Make sure to use SHA1 as this certificate's hashing algorithm,

-nodes
: don't encrypt the key and

-x509
: ma...

How to fix: Microphone recording levels are too quiet (or get lowered automatically)

If others on a call (Skype, SIP, ...) can not hear you loud enough, your volume levels are probably too low. Also, Skype may be changing your mixer levels.

Set a proper recording volume

  1. Open your mixer software (run pavucontrol).
  2. Switch to input devices.
  3. If you have more than one recording device, find the correct one.
  4. Make a test call to a colleague that can tell you if it's too loud or too quiet.
  5. Drag the volume slider for your input device to an adequate level -- for me, 75% (-7.46dB) work fine. 100% is usually way to...

How to not leave trailing whitespace (using your editor or Git)

There is no reason to leave trailing whitespace characters in your project's files, so don't add any.

A git diff --check will tell you if there are any and you should not commit when you see them. So go ahead and switch your editor/IDE to automatically remove them for you.
Below are a few instructions on how to get them removed by your favorite IDE or editor.

Note that except for RubyMine, the following changes will remove trailing white-space on all lines, not only those that you changed.
While this should not be a problem if your proje...

Reset mysql root password

This article describes how to reset MySQL's or MariaDB's root password on your workstation. It's meant for local development purposes only, don't do this in production. This article will also help you if you have a fairly recent MariaDB version that uses authentication based on linux users instead of passwords for the root user and you prefer using a password for root.

Solution

Step 1 is getting a root mysql shell that allows us to change user credentials. We need to stop the mysql daemon first and re-start it without authorization c...

Be careful when using Unicode symbols for graphical elements

There are many fun Unicode characters like ▲ or ☯. You might be tempted to use them for graphical elements in lieu for an image. After all they are so much easier to style and scale than a raster image!

Unfortunately you will discover that these symbols render very differently on Linux, Windows and MacOS. The reason for this is that the font you are using will probably not contain any characters outside the standard Latin-1 set. When browsers encounter a character not included in the current font, they use a fallback font for this one cha...

Disable the Java plugin in browsers to avoid drive-by attacks

Every now and then, Java is subject to security issues where code can break out of Java's sandbox and obtain more privileges than it should.
In almost all cases, such issues are actively being used for drive-by attacks via the Java browser plug-in, for example by malicious ad banners.

Since removing Java completely is not an option for us, make sure the Java plug-in is always disabled in every browser, even when you have updated Java on your machine.
Please re...

Get the initial username which you used to login to your Linux system

If you need the initial user which you used to login to your Linux system or the time when you login you can do:

whoami

One purpose of this could be the .bashrc to show different Bash Prompts for root to different users:

if [ $(whoami) = "root" ]; then
   PS1='${debian_chroot:+($debian_chroot)}\[\033[41;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
   PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi

Some useful Unicode chars

Copy and paste at will, they're free!

  • German quotation marks: „ “ (Ubuntu-Hotkey: AltGr+v and AltGr+b)
  • English quotation marks: “ ”
  • En dash: –
  • Em dash: —
  • Ellipsis: …

Some useful hints for users of Ubuntu Linux

  • Your Ubuntu comes with a searchable list of Unicode chars. Go to Accessories / Character map. Ctrl + F searches for a character by name.
  • If you want to write all of them (and more) yourself, [configure a compose key](https://makandracards.com/makandra/1030-insert-an...

LibreOffice won't embed most fonts into PDFs (with fix)

  • LibreOffice Impress, Writer, etc. doesn't embed most fonts into the PDFs it generates.
  • This means if you share a slide show with a font that is not Arial or Times, other people will get an error message "Cannot extract the embedded font 'XYZ Some characters may not display or print correctly" and unreadable text. Everybody loses.
  • Some forums will recommend that you tick "PDF/A-1a" in the PDF options to make LibreOffice embed fonts. In reality, thi...

Linux: How to add a task bar to VNC displays

If you are using VNC to run Selenium tests, it may be hard to see what's going on since by default there is no list of open windows and Alt+Tab won't work.

Solving that is easy:

  1. Install a panel of your choice (like lxpanel) which offers task switching:

    sudo apt-get install lxpanel
    

    (You can't use gnome-panel because it won't start twice -- but lxpanel does a good job)

  2. To have that panel appear on VNC screens by default, edit ~/.vnc/xstartup...