Tuesday, January 20, 2015

Create a custom sandboxed webapp in Firefox

Google, Facebook, Twitter and others depend on getting as much information about you as possible and therefore use your account information to track and profile you not only on their services but also on 3rd party websites to fit the advertisement to your interests.
On this website you can check out how unique your browser is and how easy it is to identify and track you.
To make this a bit harder for them and save yourself the trouble of constantly logging in and out I will show how you can create a webapp with an independent profile for your Linux desktop.


It is very easy to create a custom launcher for each webapp and Firefox allows to create multiple profiles since a very long time. So in principle it is very simple and easy!

Let's do a webapp for Facebook! First, create a new Firefox profile, which will be used for the "Facebook-only-Firefox". Therefore, start the Firefox profile manager by typing:

$ firefox -ProfileManager

Now add a new profil 'facebook' and close the manager again. Next, create the launcher by copying the original Firefox launcher to the $HOME directory and rename it:

$ cp /usr/local/share/applications/firefox.desktop ~/.local/share/applications/facebook.desktop

Then we edit the facebook.desktop file and set the launcher name, the icon and the process how the application will be started. I suggest to get a nice icon for your application from the web and save it to ~/.icons/facebook.png. If the folder does not exist yet, create it!

$ vim ~/.local/share/applications/facebook.desktop

[...]
Name=Facebook
Exec=firefox -P facebook -new-instance www.facebook.com
Icon=facebook.png
-P profile-name opens firefox with profile "profile-name"
-new-instance opens Firefox in a new instance, as a separate process
Icon= If the icon is stored under ~/.icons/ there is no need to enter a path!

To immediately see you application in gnome-shell you can press Alt + F2 and type "r" and ENTER. This reloads the gnome-shell. Now you can use Facebook in its own browser, but don't forget to log out in your everyday browser ;)
To hide the tabs and therefore save screen space I recommend the Hide Tab Bar With One Tab addon.

NOTE:
There is one tiny problem you have to consider and which I didn't find a work around yet:
If you start the Facebook webapp and want to open your Standard-Firefox afterwards, it doesn't select the right profile. You could either change the firefox.desktop by copying to it to your $HOME as above and adding the default profile to the Exec line:

$ cp /usr/local/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
$ vim ~/.local/share/applications/facebook.desktop

[...]
Exec=firefox -P default -new-instance
or you have to start the default firefox first and then open the webapp. Do you know a solution to this?
Happy socializing 2.0!

UPDATE:
Mozilla develops a webapp framework for their Marketplace that works in a similar fashion like we show here: Separate profile directory, minimal UI, own launcher,... The only difference is that they also create a separate binary and therefore do not have the multi-instance problem. A third-party developer (dietrich ayala) created an extension, "Standalone" which uses this framework to create webapps from any page on the web. Awesome!

Thursday, January 8, 2015

Customize SSH login

After you have set up a secure  SSH server maybe you would like to customize your login, to look a bit more personal. e.g. like the penrose triangle

     ____  ____  ____  ____                      ______________________
    /\   \/\   \/\   \/\   \                    /\                     \
   /  \___\ \___\ \___\ \___\                  /  \    _________________\
   \  / __/_/   / /   / /   /                  \   \   \                /
    \/_/\   \__/\/___/\/___/                    \   \   \__________    /
      /  \___\    /  \___\                       \   \   \    /   /   /
      \  / __/_  _\  /   /                        \   \   \  /   /   /
       \/_/\   \/\ \/___/                          \   \   \/   /   /
         /  \__/  \___\                             \   \  /   /   /
         \  / _\  /   /                              \   \/   /   /
          \/_/\ \/___/                                \      /   /
            /  \___\                                   \    /   /
            \  /   /                                    \  /   /
             \/___/                                      \/___/

 (source: wikipedia)


You can also create an ASCII Art from any picture. There are some sites where you can upload your picture and create an ASCII pic out of it, look here. Once you connect via SSH e.g.  > ssh user@myraspberry.pi you see the welcome text or logo, which is defined in your sshd config. First you have to create the file containing the hello message, e.g.  

 $ sudo vim /etc/ssh/welcome.msg  
     ____  ____  ____  ____                   |
    /\   \/\   \/\   \/\   \                  |
   /  \___\ \___\ \___\ \___\                 |
   \  / __/_/   / /   / /   /                 |
    \/_/\   \__/\/___/\/___/                  |
      /  \___\    /  \___\                    |
      \  / __/_  _\  /   /                    |
       \/_/\   \/\ \/___/                     |
         /  \__/  \___\                       |
         \  / _\  /   /                       |
          \/_/\ \/___/                        |
            /  \___\                          |
            \  /   /                          |
             \/___/                           |
WELCOME TO MY RASPBERRY PI!
PLEASE AUTHENTICATE!


In the next step, we have to tell our ssh daemon where to find this welcome message, therefore we have to change the 'Banner' entry in the sshd config to the location of our welcome message:

$ sudo vim /etc/ssh/sshd_config 
[...]
Banner /etc/ssh/welcome.msg


After that, we have to restart sshd:

$ sudo service sshd restart

We can also add another welcome message for the users, which are already authenticated by editing the MOTD file:  

$ sudo vim /etc/motd 

Once finished, we again have to restart the ssh daemon on the raspberry and then we can try this thing out. On connecting to our pi we should now see the pi ASCII logo and after entering the password, we should be informed about the news in our motd file.

Thursday, April 3, 2014

Ubuntu/Debian: Mouse buttons and trackpoint scrolling on T440s, X1 Carbon and all other new Thinkpads!

I just got a new Thinkpad T440s and was not very happy with it. No wifi, bad graphics and the touchpad was not working properly after installing Debian Wheezy, the current stable version.
I soon realized: Upgrading to Jessie is necessary to fix these problems. And it did - to a certain degree. Wifi was working (install firmware-iwlwifi), graphics were better, and also touchpad worked - but not as expected!

There are no actual mouse buttons on the new Thinkpad models. WHY would they do that? I hate touch and I hate pressing a whole oversized plate with a very bad haptic feedback which makes cracky noises. #whycopyapple
Further, whenever I pressed the touchpad down, the mouse arrow moved slightly which was really annoying. This is probably the Linux driver's fault, but still...
Most problematic: There is no middle mouse button scrolling any more. I hate moving my whole hand away from the keyboard just to scroll down a little bit. #hatetouchpads Pressing and holding the middle mouse button while just tapping the trackpoint a bit was so convenient!

How to make this a lot better:
Thanks to this post on Launchpad I got most of the problems somehow fixed. No more mouse moving while clicking, middle mouse button scrolling (yay!), you can even disable all the touch if you want.
All you need to do is to get the newest sources of the xserver-xorg-input-evdev driver, copy some files over from the xserver-xorg-input-synaptics sources and patch all of this with some work done by the arch linux guys.

In the end you just need to build the *.deb package and install it on your machine. You don't need to remove the original driver package! Also, don't forget to put the 90-evdev-trackpoint.conf file into /etc/X11/xorg.conf.d/ and reboot!

I already did all of the patching and building, so if you trust me (you can!) just install my packages on Debian Jessie 64bit:
Current (updated 28/01/2015) evdev version in Debian Jessie is 2.9.0, so download: patched_synaptic_amd64_debs_2.9.0.tar.gz
If you still use version 2.8.2 (eg. on Ubuntu), get this: patched_synaptic_am64_debs_2.8.2.tar.gz

PLEASE CHECK your dependencies and version numbers before installing! If the installation fails, you end up without mouse and keyboard input!

> wget http://homepage.univie.ac.at/s.hammer/files/patched_synaptic_amd64_debs_2.9.0.tar.gz
> tar -xzf patched_synaptic_amd64_debs_2.9.0.tar.gz
> sudo dpkg -i xserver-xorg-input-evdev_*
> sudo cp 90-evdev-trackpoint.conf /etc/X11/xorg.conf.d/


Have fun with your new Thinkpad!
PS: If you want me to build a 32bit package for you, please comment below!

Monday, January 20, 2014

HowTo manually upgrade the Moto G to Android 4.4 in Germany and Austria

Just today I read that it is easily possible to manually force the Moto G to a system update to get Android 4.4. All you need is to put the signed installer package on your phone under /sdcard/ and the Moto G will automatically move the files into the system memory and perform the upgrade.

So follow these steps:

  1. Download the upgrade package from here: http://d-h.st/JRE
  2. Move it to /sdcard/ either when plugged into your computer or with a file-manager
  3. Go to Settings -> About phone -> System Updates
  4. You will be asked to push the files into the systems memory and the update will begin
The installer package I linked above is a Germany/Austria specific package, I don't know if it will work for other countries too. If you current version in Settings -> About Phone -> System Version is also *falcon_umts.Retail.en.DE it will work for sure. If you have links for other builds, please leave a comment.

Have fun with Android 4.4!

Saturday, August 31, 2013

One-liner to convert any music file to mp3

On Debian 7 ffmpeg is not installed any more as it comes with its successor avconv.
Therefore it is enough to write a small bash for loop which takes any *.wma file of the folder and starts the conversion. The output file will then have the file extension replaced to mp3. Done!
The result looks like this:
for f in *.wma; do avconv -i "$f" -ab 192k "${f%.wma}.mp3"; done
However, you can replace the two occurrences of *.wma with any other music file format you want to convert from (eg: *.flac, *.aac, *.wav,...). Keep in mind that you need to have the right gstreamer plugin installed to encode and decode the desired formats.

Monday, July 29, 2013

How to manually install the OpenVPN binary

It seems that since the upgrade to Android 4.3 the OpenVPN Installer App is not working for me any more. I get some error saying /system cannot be mounted writeable (rw).
However, it is still possible to install the openvpn binary per hand... and it is not as complicated as it seems! This guide only works on rooted devices and is written for Linux users, however the lower part should also work on Windows and Mac.

At first you need to get the Android Debug Bridge binary and install it on your computer (I just put it into $HOME/bin).
Then download the latest OpenVPN Installer APK - we need to extract the openvpn binary from this package:
wget http://android-openvpn-installer.googlecode.com/files/OpenVPN-Installer-0.2.4.apk
To extract the xbin-binary, you can use FileRoller on Gnome or any other tool. Here is an example of how do it with the terminal only:
unzip OpenVPN-Installer-0.2.4.apk assets/openvpn-2.1.1-static-xbin
mv assets/openvpn-2.1.1-static-xbin openvpn
rm -r assets
Now use adb to push the binary to your phone/tablet's "sdcard" (external storage):
adb push openvpn /sdcard/
The next two commands will open a shell and give us root access on your Android device. Everything you type afterwards happens directly on your device, so be careful!
adb shell
su
Now we need to mount /system as writeable to be able to make changes. Next we copy the binary to its final location and delete it on the sdcard (unfortunately moving is not possible). After we changed the file-permissions so that the binary can be executed, we need to mount /system as read-only again:
mount -o remount rw /system
cp /sdcard/openvpn /system/xbin/
rm /sdcard/openvpn
chmod 755 /system/xbin/openvpn
mount -o remount ro /system
Everything should be done now. Close the connection to your device by typing exit two times and try to use OpenVPN Settings! The installer app will also show you "Binary installed" if everything worked!

Sunday, July 14, 2013

Rainy can't be built on Debian Wheezy any more - here is a solution!

To be able to build Rainy on Debian Wheezy (and probably also on Ubuntu), you need to do several preparations, because building now depends on NuGet (http://nuget.codeplex.com).
At first you need to install mono-complete, as this tool has many dependencies:

$ sudo apt-get install mono-complete

Then download the nuget command-line utility: http://nuget.codeplex.com/releases
Further create a file/script called "nuget" so that nuget.exe is called with our desired options:
#!/bin/bash
mono --runtime=v4.0 /usr/local/bin/nuget.exe "$@"

Copy both files (nuget and nuget.exe) to /usr/local/bin/ and make it executable:

$ sudo cp nuget* /usr/local/bin/
$ sudo chmod a+x /usr/local/bin/nuget


You now can already call nuget in your terminal. However, if it still creates an error, you need to download Microsoft.Build.dll and also copy it to /usr/local/bin. Get it, for example, here: http://headsigned.com/download/running-nuget-command-line-on-linux/Microsoft.Build.zip
This blogpost also explains how to extract the ddl from a working Windows installation in case you don't trust the previous source: http://headsigned.com/article/running-nuget-command-line-on-linux

Now you can try to make Rainy. If it throws an error not being able to download from https://something, import the certificates from Mozilla:

$ mozroots --import --sync

Now it should be able to build Rainy on Debian!

$ git clone https://github.com/Dynalon/Rainy.git
$ cd Rainy
$ make