## Encryption + Dropbox + Android

Dropbox is a great application which syncs data across different computers and devices. This makes Dropbox ideal for syncing important, & often sensitive, information across devices. Saving sensitive information on cloud makes me feel uncomfortable and cranky. This is log of softwares/apps required for encrypting data. Explicit goals are:
1. Data should never be saved to disk unencrypted.
2. Encrypted data should be readable, even without internet access, on Windows, Linux, & Android devices.
3. Encryption algorithm should be well known standard algorithm. Open source programs are preferable.
Following are some of the possible solutions with some notes. Not all of them achieve all the goals mentioned above.

EncFS provides encrypted filesystem in user space. It allows mounting an encrypted folder to a user defined location. Cryptonite is an android app which supports mounting of encrypted EncFS. Unfortunately, I found Cryponite to be buggy and the android app did not work out well for me. EncFS is definitely among perfect solutions for "desktop-only" systems.

BoxCryptor comes very close (and probably is heavily inspired by EncFS). It has been developed with tight integration with dropbox. It uses very popular AES-256 standard. Unfortunately its Android app requires internet connection to read the encrypted folder. Another drawback is the tight integration with dropbox. The Android app requires dropbox credentials to access data. I feel uncomfortable to give the dropbox credentials to any place other than dropbox itself.

enotes is the perfect solution for individual text files. So, each encrypted file is an independent text file and hence each individual file has to be encrypted/decrypted seperately. This can be advantage or disadvantage depending on the purpose. It also has an Android app: Encrypted Notepad. It uses AES-128 encryption and is good enough for me. The software is written in Java and hence is cross platform. Similar apps: Secret safe Lite, NoteCipher, OpenNoteSecure.

APG is an Android app which aims to provide a OpenPGP implementation. It uses public-private key or pass-phrase for encryption. But it saves unencrypted data to disk. Another app Encryption Manager Lite works in very similar fashion but with AES encryption. Similar apps: File Encrypter, Pattern Encrypt (Cool idea to use patterns for passwords).

PS: There are numerous desktop applications which can be used to encrypt/decrypt data using standard algorithms like AES. When accessing files on android device is not an issue, then any of these can be a solution. TrueCrypt is worth a mention in this category for its simple interface and powerful features. EncFS, as mentioned above, may also be suitable for some systems.

## xpdf & X resource

Tested on: Ubuntu 11.04

xpdf man page is not very detailed in terms of possible values for X resource file. Following are the places where xpdf settings can be specified:
• Ubuntu X resource file: ~/.Xresources The exact files being read can be found by looking into /etc/gdm/Xsession. My settings in ~/.Xresources # xpdf settings xpdf.geometry: 1280x1024 xpdf.initialZoom: width Run following for immediate effect: xrdb -nocpp -merge ~/.Xresources
• xpdfrc can be found at ~/.xpdfrc and at /etc/xpdf/xpdfrc. My ~/.xpdfrc file: include /etc/xpdf/xpdfrc initialZoom width 

## TeamViewer: Unattended auto-start in Ubuntu

Tested on: Ubuntu 11.04 (Natty Narwhal)

This is log of the steps to setup TeamViewer on Ubuntu on my laptop, so that I can access my laptop from any other computer, without any user interaction on my laptop's end. More importantly, TeamViewer should be started on each reboot automatically & should not interfere with user normal task(s).

Precisely its an effort to mimic TeamViewer on windows, where it can be used to remotely access the computer even before login to windows (Though this workaround is cheating as we use auto-login feature of Ubuntu. Read step 3 for details). Following are the main steps:
1. Install & setup TeamViewer for auto-start - Detailed steps are here.
• Add a new application in Menu -> System -> Preferences -> Startup Applications.
2. (Optional) Some configuration to make sure that TeamViewer does not pop-up on user logins.
3. Configure Ubuntu to automatically login & then lock the screen
Details of last two steps are given below.
Step 2:
This is optional step. Its safe to skip this step. If TeamViewer is added to auto-start on each login, the user gets the TeamViewer window on each login. This might be annoying after some time. So, the idea here is to use another application, devilspie, to hide TeamViewer window: put the TeamViewer window on another workspace and/or minimize it. Here is a very good devilspie tutorial.
• Install devilspie (& maybe gDevilspie, a nice front-end)
• Create devilspie directory mkdir ~/.devilspie
• Create a file with name 'teamviwer.ds' & put following in it. ; generated_rule teamviewer ( if ( begin ( is ( application_name ) "TeamViewer" ) ( is ( window_name ) "TeamViewer" ) ) ( begin ( set_workspace 2 ) ( minimize ) ( println "match" ) ) ) It will put the windows with name "TeamViewer" on workspace 2 & minimize it. Make sure devilspie demon is running. Check gDevilspie GUI.

This is not a very elegant solution. There were some minor issues with the rendering of the TeamViewer window (Though it works without any flaw). There can be some other ways to put it in system tray using some application like alltray. But this workaround is good enough for me.

Step 3: Configure Ubuntu to automatically login & then lock the screen
TeamViewer will auto-start only when user is logged in. So in order to make sure that TeamViewer is started even in case of remote reboot, auto-login has to be enabled. But this is also a security/privacy threat. One of the easiest way to maintain security is to somehow lock the screen immediately after login in. We can create a custom xsession for the same. See note 2 below, if you are using some secured wireless network on Ubuntu.

Create a file /usr/share/xsessions/autolock.desktop with following content. Change username to the correct user name. [Desktop Entry] Name=Auto Lock Gnome Comment=Custom ~/.xsession script Exec=/home/<username>/.xsession X-Ubuntu-Gettext-Domain=gdm
Create another file ~/.xsession with following content: #! /bin/bash gnome-screensaver gnome-screensaver-command --lock gnome-session --session=2d-gnome Note the last line. I am loading the Ubuntu (Wihout any effects). You may want to change it to appropriate session. Check other .desktop files in /usr/share/xsessions/ for the correct command.

Now enable auto-login. Menu-> System -> Administration -> Login Screen. Select "Auto Lock Gnome" in the default session. Reboot & you should see the change. Check note 1 & 3 as well.

Notes:
1. You may opt to allow only selected computers to connect to the TeamViewer for better security. See 10.2 "Security Category" in TeamViewer manual
2. If auto-login is enabled, Gnome-Keyring kicks in each time after auto-login & usually affects all application related to saved passwords including network-manager. This is especially important if you are using a secured network, like WEP etc, as the internet connection won't be active till user enters the password in Gnome-Keyring manually. Here is a very easy work-around to get internet connection without Keyring kicking in. You should apply this changes for only the trusted network(s).
3. Please note that enabling Auto-login & configuring it to connect to wireless network automatically is a potential security threat. Try it at your own risk.

## Quotes

Quotes I liked. Source: Internet & people in and around planet earth.

• If you expect the world to be fair with you because you are fair with them, it is like expecting a lion not to eat you because you don't eat lion. - Internet
• If you succeed in cheating someone, don't think he/she is a fool. Rather realise that he/she trusted you more than you deserved - Anonymous
• The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts. - Bertrand Russell
• A relationship that falls beyond the domain of definition is 'Friendship'. - Anonymous Girl
• The financial markets have turned so bad that women are now actually marrying for Love !! - Anonymous
• A Good Girlfriend is one who forgives her Boyfriend when SHE is wrong. - Anonymous Girl

## CVS cheatsheet

Tested on: CentOS release 5.6 (Final)

There are many other CVS cheatsheets & books on the web. This is my version, which is intended to grow with time but will be less verbose (might not be good for beginners).
• Update current working directory with prune & build directories cvs update -P -d
• Difference between current version & latest repository version: cvs diff -cw <fileName>
• Rename a file: mv <OldFileName> <NewFileName> cvs remove <OldFileName> cvs add <NewFileName> cvs commit -m "Renamed <OldFileName> to <NewFileName>" <OldFileName> <NewFileName>

## Infrequent Linux commands

Tested with mainly Ubuntu-based distributions. List of Linux commands which are useful but not frequently used. See online or local man pages for details.

### System Information

uname -a # Details of kernel, processor, machine, OS cat /proc/version # Detailed kernel version. More details about /proc. cat /etc/*-release # See details of distribution lsb_release -a # See details of distribution service --status-all # status of init services; [+] Running, [-] Not running, [?] Unknown sudo initctl list # List & status of upstart jobs. More at UbuntuBootupHowto. 

### Hardware Information

cat /proc/cpuinfo # Shows CPU details free -mt # Shows details of memory usage sudo dmidecode -t memory # Shows details of RAM slots df -hT # Report disk type, space usage, mount points sudo fdisk -l # Lists partition table of all disks blkid # Lists UUID and type of all disks ls -l /dev/disk/by-uuid # Lists drives by UUID 

### Users and Groups

groups <username> # Lists group memberships of the user id -u <username> # Prints user-id of user id -g <username> # Prints group-id of user id <username> # Print user and group information of user sudo passwd <username> # Change user password sudo usermod -d /new/home/dir <username> # Change user home directory 
• Disk usage (size) of directories: du -ach du -sch du -ch /home/user
• List USB Devices lsusb -t
• apt installed packages:less /var/log/apt/history.log zless /var/log/apt/history.log.1.gz dpkg --get-selections | sed -n 's/\t\+install$//p' Automatically installed packages </var/lib/apt/extended_states awk -v RS= '/\nAuto-Installed: *1/{print$2}'
• Image to pdf:convert *.png out.pdf convert -compress jpeg *.png out.pdf

Last edited: June 11, 2014

## Font & old emacs

Tested on: CentOS release 5.6 (Final)

The newer version of emacs (23.x) has a nice option in menu to change the default font. But the older emacs (21.4.1) does not have these options. The older (& stable) versions of emacs are generally shipped with centos. Here are steps for changing the default fonts in emacs 21.4.1

Option 1 (for current sessions only)
1. Open emacs.
2. Left-click on mouse while holding 'Shift' key on keyboard. A Font-menu will pop-up.
3. Play around with the menu & set required font.

Option 2 (for all future sessions)
We have to find the available system fonts and apply them to ~/.emacs file.
1. Open terminal & execute following command: xfontsel
2. Left-click on 'fmly' & others to select a value. You will be able to see how the font looks like in the same window. When you are satisfied with the font selected press 'Select' button. It will copy the font name with details to clipboard. Following are some of the examples of the fonts: -*-courier-medium-r-*-*-17-*-*-*-*-*-iso8859-* -*-lucidatypewriter-medium-*-*-*-14-*-*-*-*-90-iso8859-* -*-luxi mono-medium-r-*-*-17-*-*-*-*-*-ascii-*
3. Open ~/.emacs file in any text editor and add following at the end of the file: (set-default-font "-*-*-*-*-*-*-*-*-*-*-*-*-*-*") Replace -*-*-*-*-*-*-*-*-*-*-*-*-*-* by your selected font name (like one of the examples shown above) Save ~/.emacs & re-launch emacs. You should be able to see the difference.
4. There might be some delay before text is displayed in emacs. Add following to top of the ~/.emacs file for a workaround: (modify-frame-parameters nil '((wait-for-wm . nil)))

## AUCTeX on windows

It’s a little tricky to get AUCTeX working on windows, specially the preview feature working. Following steps helped me.
1. Install MikTeX.
2. Install Ghostscript & GSview.
3. Install Emacs & AUCTeX from here.
4. Add to system PATH the location of gsview32c.exe. (Required for LaTeX-preview). Restart the system (Did not work without restart for me)
5. Add following lines to .emacs file (load "auctex.el" nil t t) (load "preview-latex.el" nil t t)  .emacs file can be found in C:/users/username/appdata/roaming/ or in the home directory.
6. Change variable (see next section) preview-image-type to pnm. To use other types install correct dll files in bin directory of emacs.
Other customizations:
To customize/change a variables in Emacs use M-x customize-variable
• Change default viewer: <to-find-out>
• Change preview size: Customize variable display-mm-dimensions-alist. Experiment with width height. My setting: Width-250, height-180

## Gcal with time in Rainmeter

I have been using Rainmeter for some time & have started liking it. But the default Google Calendar reader do not show any information about starting time and ending time of the events. So I modified the default .ini file according to my needs. The difference can be seen in attached pictures.

Notice the time in 3rd row from last. Its NOT perfect. This script fails whenever the event description reads like “Thu Jan 20, 2011 3pm to Thu Jan 20, 2011 5pm PST” instead of “Thu Jan 20, 2011 3pm to 5pm PST”. It is a problem of regular expression. But I guess its sufficient for me. Let me know if you can fix it. The script can be downloaded from here. Copy the file to Gcal folder in Rainmeter skins folder.

## Matlab Font(s) - Windows

I do not find Matlab default font to be soothing to eyes, specially the fonts in figure windows. See more about fonts here. So, here are the instructions to change the fonts in matlab. Make sure that you have installed the font of your choice.
• For editor, main window, GUI
Navigate to File->Preference. Select "Fonts" in the left panel. Then follow the instructions over there. You can also check the 'Custom' tab for advanced settings.
• For figure window
Add following lines to your startup.m. See next section for details. set(0,'DefaultAxesFontName','DejaVu Sans'); set(0,'DefaultAxesFontSize',10); set(0,'DefaultAxesFontWeight','Bold'); set(0,'DefaultTextFontName','DejaVu Sans'); set(0,'DefaultTextFontSize',10); set(0,'DefaultTextFontWeight','Bold');  Change the font-name & size according your choice. You can find a list of installed fonts by typing following command at matlab prompt. listfonts
startup.m
Each time matlab is started, it searches all the matlab path for this file. The most common place to keep this file is: C:\Users\<user-name>\Documents\MATLAB\ This is good place to put/over-ride settings. Create this file, if it is not present.

I am having hard-time  to configure the same thing in Ubuntu. I will be posting the same, if I get some success.
Update: I was not able to get anti-aliased fonts in linux. But, I found a font called 'Andale Mono', which gives good result with aliased fonts. This link might help in some cases.

## Programmer's fonts comparison

In my opinion every programmer should be very selective about fonts, as bad fonts can not only decrease efficiency but also bless you with eye problems and headaches. Here is my own comparison of fonts. You can also find other font comparisons on many websites or just google 'programmer fonts'. I have listed the fonts in order of my preference. All the fonts shown below are anti-aliased. If you are forced to use aliased fonts, you can try Andale Mono, I find it good even at bigger font size and bold font weight. This blog uses Droid Sans Mono from Google web fonts for all the code sections.