nvPY on Gentoo

nvPY is a fast, simple to use, no fuss, cross-platform note taking application. One of the big benefits is that all your notes are stored somewhere on the cloud – so you don’t need to worry about them!

Unfortunately we can not simply use emerge to install nvPY, so there are a few prerequisites prior to installation.

Prerequisites

There are not many prerequisites to nvPY but here they are all the same.

Simplenotes Account

In order to use nvPY, you will first need to create yourself a simplenotes account at simplenote.com. Now armed with your simplenotes login credentails, you can begin to install.

Git

Because vnpy is not available through the Gentoo package manager, we first need to make sure we have the git client installed so that we can download the source code.

emerge --ask git

Python

At the time of writing, nvpy works best with python version 2.7.x and it currently does not work very well yet with python 3.x. Also, nvpy requires that the python version to be used is compiled with support for TkInter.

I already have dev-lang/python-3.3.2-r2:3.3 install as my default. To install a lower version, like 2.7.x but keep 3.x as your default, do. Note, you will need to be root.

emerge -av python:2.7

If, like me, you already have python 2.7.x installed, make sure it is compiled with TkInter support. If not, as root, do the following.

echo "=dev-lang/python-2.7.5 tk" >> /etc/portage/package.use
emerge --ask --newuse =dev-lang/python-2.7.5-r3

Installation

You should now be able to simply follow the instructions on github. To summarise (copy really I guess), see below. Make sure you do this as a normal user.

git clone git://github.com/cpbotha/nvpy.git
cd nvpy
python nvpy

Launch nvPY

In order to run nvPY, it first needs to be able to connect to your SimpleNotes account. So before you first try to run nvPY, create the following file, making sure only your normal user can read it.

nano ~/.nvpy.cfg

Populate it with only the following information. Obviously, replace the values on the right hand side of the equals sign with your SimpleNotes login credentials.


[nvpy]
sn_username = your_simplenote_username
sn_password = your_simplenote_password

Make sure only you can read it.

chmod -v 600 ~/.nvpy.cfg

Finally, try running it.

python2.7 nvpy &

Hopefully that worked!!

nvPY
nvPY installed on Gentoo

Yay!! Job done!

Resources

The Official Site – GitHub:
github.com/cpbotha/nvpy

How to install Python Tkinter in Gentoo Linux:
how-to.wikia.com/wiki/How_to_install_Python_Tkinter_in_Gentoo_Linux

How to choose python version to install in gentoo:
serverfault.com/questions/145856/how-to-choose-python-version-to-install-in-gentoo

Create a Self-Signed Certificate for Apache

Contained within an SSL certificate is information that pertains to you and your secured domain. Lets imaging that you have a web hosting company called Spider and the details for which are shown below.

Country Name (2 letter code):		UK
State or Province Name (full name):	Surrey
Location Name (city):			Camberley
Organisation Name (company):		Spider Web Hosting
Organisation Unit Name (section):	IT Support
Common Name (your domain name):		spiderwebhosting.com
Email Address ():			webmaster@spiderwebhosting.com

A challenge password: 			leave blank
An optional company name: 		leave blank

Generate a Private Key and Certificate Signing Request

Here we generate a Certificate Signing Request and populate it with our details. The -nodes flag tells openssl to create a private key that does not require a pass-phrase. Emitting this flag will prompt for a pass-phrase every time you use it. If installing it on Apache, this will mean entering it every time the Apache service is restarted.

openssl req -new -nodes > spiderwebhosting.com.csr

The above command will generate the CSR and the private key in your current directory.


spiderwebhosting.com.csr
privkey.pem

Generate the Certificate

To generate a certificate, you need a Certificate Signing Request and a private key. The output of the below command will create a certificate valid for 365 days, called spiderwebhosting.com.cert within your current working directory.

openssl x509 -in spiderwebhosting.com.csr -out spiderwebhosting.com.cert -req -signkey privkey.pem -days 365

Make sure that the private key is not world-readable but the certificate is.

chmod go-rwx spiderwebhosting.com.cert

The above command removes read, write and execute permissions from the group and other users.

Resources

Linux.com: Creating Self-Signed SSL Certificates for Apache on Linux
http://www.linux.com/learn/tutorials/392099-creating-self-signed-ssl-certificates-for-apache-on-linux

Hosting.com: Generate a Self-signed SSL in Linux
http://www.hosting.com/support/ssl/generate-a-self-signed-ssl-in-linux

Unix and Linux System Administration, fourth edition; Nemeth Snyder Hein Whaley.
pages 971-973

The Most Common OpenSSL Commands
http://www.sslshopper.com/article-most-common-openssl-commands.html

What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats?
http://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file

Generating 2048-bit CSR with OpenSSL
http://blogs.digitss.com/apache/openssl/generating-2048-bit-csr-with-openssl/

Shutter with XMonad

For me, Shutter is the best open-source screenshot program available for Linux. When I used Windows, I really liked Snagit – Shutter is a good alternative.

Installing Shutter

Installing Shutter is straight forward enough. However, before doing so, I added a couple of use flags to enable the drawing tools and afford the functionality of taking screenshots of websites. This needed if you want similar functionality to Snagit where you can easily take a screenshot and then quickly and easily edit it. Such as highlighting an area or blurring-out sensitive information.

echo "x11-misc/shutter drawing webphoto" >> /etc/portage/package.use

To install, simply type.

emerge --sync
emerge --ask shutter

Configuring XMonad

If you’re using XMonad and you are unable to use Shutter due to error messages similar to the one below, you’ll need to make sure your xmonad.hs file is configured to use EWMH Hints, which is required by Shutter.

Error while taking the screenshot: Maybe mouse pointer could not be grabbed or the selected area is invalid.
Error while taking the screenshot: Maybe mouse pointer could not be grabbed or the selected area is invalid.

Open up ~/.xmonad/xmonad.hs with a text editor.

nano ~/.xmonad/xmonad.hs

We need to import the following package.


import XMonad.Hooks.EwmhDesktops
...

You’ll also need to define the handleEventHook and logHook properties as show below.


...
handleEventHook = ewmhDesktopsEventHook,
logHook = ewmhDesktopsLogHook,
...

Don’t forget to recompile XMonad by pressing the modification key (Windows key on my system) with q.

WinKey + q

Resources

Shutter – Screenshot Tool: Official site.
http://shutter-project.org

Gentoo Browse: x11-misc/shutter
http://gentoobrowse.randomdan.homeip.net/package/x11-misc/shutter

Wikipedia: Extended Window Manager Hints
http://en.wikipedia.org/wiki/Extended_Window_Manager_Hints

Github.com: ahitrin / xmonad-config
https://github.com/ahitrin/xmonad-config/blob/master/xmonad.hs

Gentoo: Temporarily Configure Networking

This can be useful if your working from a LiveCD or testing the network. Note, “temporary” means it will not survive a reboot! To configure networking, adjust the below command for your own environment.

ifconfig eth0 192.168.1.109 broadcast 192.168.1.255 netmask 255.255.255.0 up
route add default gw 192.168.1.254

The above commands assign the static IP address of 192.168.1.109 to the eth0 interface and defines the default gateway as 192.168.1.254.

You might also need to add some nameservers to your /etc/resolv.conf configuration file.

nameserver 192.168.1.254
nameserver 1.2.3.4

Again, this configuration will be lost after a reboot. To permanently create these rules, use the /etc/conf.d/net configuration file.