Use Nemo with All-in-one-Places Cinnamon applet

It's really a pity, that the All-in-one-places applet hasn't got an update for including support for Nemo, as this is IMHO the best one of its kind.
But there's a workaround.
Its enough to add Nemo to the available filemanagers in settings.py
I provide you here a patchfile that you can apply, so you don't have to edit the file by yourself.
Just execute the following steps in a command line terminal.

Install instructions

First you'll have to create the patchfile with this:
cat <<EOF  >/tmp/All-in-one-Place.patch
--- a/.local/share/cinnamon/applets/all-in-one-places@jofer/settings.py
+++ b/.local/share/cinnamon/applets/all-in-one-places@jofer/settings.py
@@ -28,7 +28,7 @@ PANEL_WIDGETS = [
     {'type': 'switch', 'args': { 'key': 'full-color-panel-icon', 'label': _("Show the panel icon in full color") }},
     {'type': 'switch', 'args': { 'key': 'show-panel-text', 'label': _("Show text in panel") }},
     {'type': 'entry', 'args': { 'key': 'panel-text', 'label': _("Panel text") }},
-    {'type': 'combo', 'args': { 'key': 'file-manager', 'label': _("File manager"), 'values': {'nautilus': 'Nautilus', 'thunar': 'Thunar', 'pcmanfm': 'PCManFM'} }},
+    {'type': 'combo', 'args': { 'key': 'file-manager', 'label': _("File manager"), 'values': {'nautilus': 'Nautilus', 'thunar': 'Thunar', 'pcmanfm': 'PCManFM', 'nemo': 'Nemo'} }},
     {'type': 'entry', 'args': { 'key': 'connect-command', 'label': _("Application for the  \"Connect to...\" item") }},
     {'type': 'entry', 'args': { 'key': 'search-command', 'label': _("Application for the \"Search\" item") }}
 ]
EOF
Apply the patch with this:
cd ~ ; patch -p1 < /tmp/All-in-one-Place.patch
No log out of the cinnamon session is necessary.
Just open now the settings of All-in-one-place and select Nemo from the filemanager combo.

Adorn a dumb terminal

 Sometimes, you need to sit in front of a servers terminal, one without any window manager.
So you lack the cut&paste function of your mouse.
And to make things worse, it's keyboard isn't your native one, so you start trying out certain characters like . / and so on.

An administration nightmare!

So here come some instructions to get rid of these burdens so you can focus on the real problems.

Set your favourite keyboard

Just load another keyboard translation table that fits your fingers needs:

loadkeys [keymap]

# Examples:
# loadkeys de   # german keymap
# loadkeys es   # spanish keymap
Available keymaps can be found mostly in /lib/kbd/keymaps.

Cut&paste mouse functionality

If your server has internet connection than go and install the gpm package, a cut and paste utility and mouse server for virtual consoles, which permits to use your mouse on the terminal, even if it's very basic it permits selection and pasting with middle button.
# Install the gpm package
yum install | apt-get install | etc.   gpm

# Launch the daemon
gpm -m /dev/input/mice -t exps2

Speed-up bash scripts that use grep often

The last day I ran into a very awkward situation, but lets start from the beginning:
I wrote a bash script that had to perform several regular expression grep's in several text files.
So far so good, but the script always needed several minutes since the first version. I never wondered about this long execution time, the script runs on a remote server and also uses some mysql searches on another server.
Until some days ago, I wanted to debug a minor error with bash -xv to see all instructions when being executed.
To read the huge output more easily, I logged into the remote server from emacs editor and launched the script and had all the output in my emacs window in a few seconds. Wait, it only needed a few seconds?!
What happened, I rechecked the execution, with exactly the same parameters to the script from my emacs shell and from a ssh terminal.
The same, within emacs it only took some seconds, within the ssh terminal y took minutes.

So what's going on here?
Investigating the processes in the remote server with htop showed that the grep commands consumed almost 100% of the CPU for some time.
But when launched from emacs they did not.
What might be different?
Well, what about the environment?
Emacs might use it's own set of environment, different from a terminal.
Looking at the export definitions of both, I could see that the locale was different, emacs was using the C, whereas the terminal was using the English en_UK.UTF8.
Issuing a export LC_ALL=C in the terminal and then launching the script ... only a few seconds.
So it seems, grep is sensible to the locale of the shell.
Investigating in the web confirmed this, people talk about a speed enhancement of up to 10 times when using the C locale with grep, as it doesn't have to convert anything, it just compares a plain ASCII set of character, which in most cases is enough.
Also, grep is slightly faster when comparing fixed strings if you use the -F flag or call it with fgrep (due to lazyness I always used grep in such cases).

Instructions for speeding up grep

At the beginning of my scripts, I now put these instructions, which will force to use the C locale for all three flavours of grep:
shopt -s expand_aliases
for g in "" e f; do
    alias ${g}grep="LC_ALL=C ${g}grep"  # speed-up grep commands by not considering locale.
done
It does not work to just put export LC_ALL=C at the beginning.

More fortunes for Mint

If you like to see some funny quotes when opening a new shell terminal, you can enable the fortune-mint script that will be launched automatically.
By default, this script only shows non-offensive quotes and only three different types of animals: the moose, the tux and the koala.
But the cowsay package provides a whole bunch of pictures that can be used.
Cow files in /usr/share/cowsay/cows:
apt beavis.zen bong bud-frogs bunny calvin cheese cock cower daemon default
dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
ghostbusters gnu head-in hellokitty kiss kitty koala kosh luke-koala
mech-and-cow meow milk moofasa moose mutilated pony pony-smaller ren sheep
skeleton snowman sodomized-sheep stegosaurus stimpy suse three-eyes turkey
turtle tux unipony unipony-smaller vader vader-koala www

The following patch will enable all these that you have installed in your system, as well as all different eye and tongue styles. If you don't like offensive quotes, you'll have to take off the -a parameter from the fortune command in the last line of the patch below.

Install instructions

Paste the following into a textfile, for example mint-fortune.patch
4c4
<     RANGE=3
---
>     declare -a cows=( $(cowsay -l | grep -v "Cow files in") )
6,17c6,7
<     let "number %= $RANGE"
<     case $number in
<         0)
<             cow="moose"
<             ;;
<         1)
<             cow="tux"
<             ;;
<         2)
<             cow="koala"
<             ;; 
<     esac
---
>     let "number %= ${#cows[*]}"
>     cow=${cows[$number]}
19c9
<     RANGE=2
---
>     declare -a says=( say think )
21,30c11,19
<     let "number %= $RANGE"
<     case $number in
<         0)
<             command="/usr/games/cowsay"
<             ;;
<         1)
<             command="/usr/games/cowthink"
<             ;;
<     esac
<     /usr/games/fortune | $command -f $cow
---
>     let "number %= ${#says[*]}"
>     command="/usr/games/cow${says[$number]}"
> 
>     declare -a states=( "" -b -d -g -p -s -t -w -y )
>     number=$RANDOM
>     let "number %= ${#states[*]}"
>     state=${states[$number]}
> 
>     /usr/games/fortune -a | $command $state -f $cow

Then apply this patch to the original script (a backup will be created) and enable the fortune-teller:
sudo patch -b /usr/bin/mint-fortune mint-fortune.patch
gconftool-2 --set /desktop/linuxmint/terminal/show_fortunes true --type bool

Provide your own cows

You can create your own cow files, just have a look at the manual of the cowsay command. Or just copy the ones I prepared from here into any folder you want.
You could just copy them into the system folder /usr/share/cowsay/cows, but if you want to keep them separated, you can instruct cowsay to look for you ones too (for example in your folder ~/Documents/cows:
mycows=~/Documents/cows ; sudo sed -i.orig 's|/usr/bin/mint-fortune|export COWPATH=/usr/share/cowsay/cows:'$mycows'\n\0|' /etc/bash.bashrc

Example of a Star Wars scene as cow

 _____________
< Hello world >
 -------------
          \
           \                .==.
            \              ()oo()-.
             \  .---.       ;--; /
              .'_:___". _..'.  __'.
              |__ --==|'-''' \'...;
              [  ]  :[|       |---\
              |__| I=[|     .'    '.
              / / ____|     :       '._
             |-/.____.'      | :       :
            /___\ /___\      '-'._----'