Configuring Vim and Tmux

My development environment has changed a lot of late. Where I previously used a macbook pro, I find myself using a Chromebook more these days.

While things like Crostini are great for local development, I find myself wanting an environment I can just jump into when I have a few minutes. I’m usually on the road, so I want to be able to kick off installs / downloads and have that work reliably without relying on my local connection.

My current set up of choice is a Chromebook + Raspberry Pi. The latter is a low power way for me to have an always on machine connected to my fibre connection at home. The former is a great as a travel machine. Generally lightweight, long battery life and a fairly decent SSH extension for connecting to the Pi.

Initially, I was SSHing directly into the Pi, but this meant that when I lost my connection, anything I was doing would stop.

Enter tmux.

Below is my configuration for tmux:

# set the tmux command prefix to ctrl+a. (Like screen)
bind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# reload config file
# e.g. ctrl+a then r
bind r source-file ~/.tmux.conf

#switch panes using alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

#enable mouse control
set -g mode-mouse on
set -g @scroll-speed-num-lines-per-scroll 0.1

#vim stuff
set -g status-keys vi
setw -g mode-keys vi
set -gw xterm-keys on
set -g default-terminal "xterm-256color"
set -g status-bg black
set -g status-fg white
set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'

Install Ruby on Rails (web development) environment on Chromebook using Crouton

Web development on a Chromebook. Is it possible? Even if its possible, does it work well? It does! I develop web applications, mainly using Ruby on Rails on my Chromebook. I used to use to 15 inch MacBook Pro, but since I travel almost every month, after a while, lugging my macbook around was a real pain in the back. For the last year or so I've been using an Asus C302A Flip Chromebook. At first, I wasn't sure the Chromebook was going to be able to cope with web app development using Ruby on Rails, but I was pleasantly surprised.

In this post I'm going to document how I set up ubuntu on my Chromebook for local web development. Please note that I've already put my Chromebook in developer mode, installed Crouton and created an ubuntu chroot. If you haven't done it here's a guide on installing crouton and chroots on your chromebook.

Once you're all set up, follow these steps to set up Ruby on Rails on your new Ubuntu Chroot.

  1. Open Chrome
  2. Press CTRL + ALT + T
shell
sudo enter-chroot -n ubunutu

The '-n' let's you pass a name to your chroot. Hopefully you named your chroot. If you only have one chroot, you can skip the '-n ubuntu'. If you have multiple chroots, and you didn't name yours then the default name will be the release name, something like 'xenial'.

Congratulations, you're now logged in to your virtual ubuntu machine. Now for the fun part.

Install Git:

sudo apt-get install git

Install Curl:

sudo apt-get install curl

Install RVM (Ruby Version Manager)

sudo curl -sSL https://get.rvm.io | bash -s stable

Ah, I got a failure. Something to do with GPG keys.

sudo curl -sSL https://rvm.io/mpapis.asc | gpg --import -

OK now rerun the previous curl command to get rvm. You should see a success message like this:

Installation of RVM in /home/user/.rvm/ is almost complete:

  * To start using RVM you need to run `source /home/user/.rvm/scripts/rvm` or source ~/.rvm/scripts/rvm
    in all your open shell windows, in rare cases you need to reopen all shell windows.

Let's check we have the latest version installed.

rvm get stable

Now we need to get the system ready for Ruby

rvm requirements

What ruby versions can we install? Let's check.

rvm list rubies

2.4 is the latest. If I'm not mistaken the app I want to work on runs on 2.2, so I'm going to install that.

rvm install 2.2

Wait a while….

ruby -v
ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-linux]

To avoid conflicts between ruby versions, we'll create a gemset to use with this ruby version.

rvm use 2.2@r2.2_default --create --default
Using /home/chirag/.rvm/gems/ruby-2.2.7 with gemset r2.2_default

Before we install rails, we should tell rubygems not to create any documentation. Use your text editor to edit the file. I'm using VIM.

vim ~/.gemrc

Add the following two lines in the file and save.

install: --no-rdoc --no-ri
update:  --no-rdoc --no-ri

Now you can install rails. I'm using 4.2.10

gem install rails --version 4.0.8

We need to perform some one time set up if this is the first time you're using git.

git config --global user.name "Your Full Name"
git config --global user.email your.email@mydomain.com
git config --global alias.co checkout

Once you're in a folder where you want to work

git init

If you're working on code that's already on a repository

git remote add origin git@bitbucket.org:username/projectname.git

To use this we need to set up ssh keys for bitbucket.

ssh-keygen -f ~/.ssh/<bitbucketusername>
ssh-add ~/.ssh/<username>
cat ~/.ssh/<username>.pub

Paste the contents into bitbucket. Follow these instructions. 

Now grab your repository. Use clone instead of pull as it will set up remote tracking.

git clone git@bitbucket.org:team/project.git

You should be ready to roll if you downloaded an existing rails project. Enjoy!

Review: SoundPeats Q12 Bluetooth Headphones

Looking for Bluetooth headphones, there’s a lot of variety on offer. I wanted something out of the way so opted for in ear headphones. 

Now, a quick amazon search will return so many different types of Bluetooth headphones. What’s the difference? Which one to choose?
There is a mix of name brands and no name brands with varying reviews and features. It’s easy to get paralysis by analysis. There is so much choice.
Just before i made my purchase the powerbeats3 were released. I was SO tempted. They had a price point of over £120 GBP.
For me, headphones don’t last long. Usually about six months before one ear stops playing sound. So I wasn’t sure if it was worth spending on the powerbests3.
After some careful research I settled with SoundPeats, specifically their Q12 model. 
The Q12 had a lot going for it.

  • 6hour battery life
  • apt-X
  • magnetic earbuds
  • carry case
  • 3 sets of earbuds and eartips
  • inline controls and mic
  • £15 GBP

And so on. You can look up the spec on Amazon.

The magnetic earbuds are great. You can just clip the eabuds together to form a necklace when you’re not listening to tunes.
The sound quality was on par with my wired Samsung headphones. That said, I seemed to have more sound in my right ear. I could feel the bass clearly on one side. It made me feel unbalanced and a little uneasy. One email to SoundPeats and they replied with an offer to refund me or send a new set of headphones. I’m requested the latter.
For a value pair of headphones the customer support was a great touch. Better than some of the bigger brands. (Samsung you could learn something here.
Let’s talk a about the biggest issue with bluetooth Headphones. Battery life.
? ? ?
I use the Q12s about 2 hours each day for my commute. I find myself charging them every 4 or 5 days.
Battery life is great. I haven’t tested them continuously so i cant tell you total playback time. 
The one annoying thing is that they don’t have a battery level indicator so it’s hard to tell how much juice you have left. A couple of times I’ve started my commute and heard the headphones interrupt my music to let me know the battery was low. This is really annoying. The constant interruption and the fact there’s no way to know how much battery life is left.

I don’t like to charge products too much, if they have enough power. So not knowing what’s left may cause you to charge these headphones daily to ensure you have enough power for the day ahead.

Charging takes around 2 hours.

Build quality of the headphones is good. Reviews of other headsets on Amazon said that they broke. Mine travel in my jacket pocket when not in use and don’t show any sign of weakness yet. The feel is plasticy and not premium, but I’m not complaining for the super low price point. The cable that joins the two earbuds is flat which means it rarely gets tangled and your headphones are always ready to go.

The brains of these headphones are in the earbuds so they’re a bit bigger and heavier than normal in ear headphones. That said, I’m using the supplied ear wing tips and they sit safely and securely in my ears, even when I’m running for a train or at the gym. You couldn’t sleep with these headphones on though. They do protrude out a little more than non Bluetooth units.

Recommendation

Overall, I would rate these a buy and say give them a try. They’re not perfect but great for the majority of use cases. Also you can buy so many of these for the price of the beats equivalents. Don’t forget that customer service was also really helpful which is often something I overlook when making my buying decision.

#soundpeats

#bluetooth

#bluetoothheadphones 

#q12

#wireless

#beats

#powerbeats3wireless 

#samsung

The Web App Challenge 2017: From zero to £3000 in 6 months

Wait a minute..didn’t we do this before? Yep. Back in 2013 I attempted the web app challenge along with Nathan Barry and some others.

I had a quick look at the contenders from 2013 and it looks like every site is down with the exception of Nathan’s and mine. Nathan has made huge progress in 3 years. I, on the other hand had to park the project and haven’t touched it since.

Why am I doing the web app challenge again?
I find it a lot easier to work with a goal in mind and a clear deadline. Doing a public challenge like this is going to keep me more motivated than privately promising myself to deliver something.

What are the rules going to be?

The rules will be similar to last time. To build an application generating £3000 in monthly recurring revenue by July 1st 2017.

I have a £1500 budget to spend on development help, but I may increase this to £3000 over the course of the project. I will be developing the application myself, with hired help as needed.

As for time restriction, I’m not imposing one. My aim is to spend as much necessary time as possible on making this work. Remember that this will be in addition to a normal 9 to 5 grind an managing another business.

What am I working on?

This is where I’m cheating a little. I’m planning to pick up the web app challenge where I left off. I’ve already started the process of upgrading the rails codebase to the latest version of rails and refamiliarising myself with what I intended to build 3 years ago.

My aim is to get the app in front of potential users within the next couple weeks, validate it and continue pursuing it. 

Who else is doing the web app challenge?

A little friendly competition is a good thing. I know of two others who are planning to do this challenge with me. I’ll link to their blogs when they are available. If you’re thinking about joining in, please do! You have little to lose and everything to gain. If you do take up the challenge please let me know and I’ll add you to any slack / whatsapp groups.

Updating Asterisk (minor version) 13.0 to 13.5

In order to update Asterisk a minor version e.g. 13.x to 13.y you need to follow the steps below.

If you need instructions on upgrading asterisk to a newer major version e.g from 11 to 13, please leave a comment.

Official instructions for installing Asterisk are here: https://wiki.asterisk.org/wiki/display/AST/Installing+Asterisk+From+Source

1. Download the latest asterisk to /usr/local/src.

cd /usr/local/src

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz

2. Untar Asterisk

tar -zxvf asterisk-13.5.0.tar.gz

3. Change into the untarred directory and check your system.

cd asterisk-13.5.0/
./configure

4. If you have missing dependencies after running ./configure you can use the install script to install everything that is missing.

./install_prereq install

OR

./install_prereq install-unpackaged

Note: you may also use: ./install_prereq test

5. Choose modules to install

make menuselect

Here you’ll need to choose the modules your required. Also remember to choose the core sound package you require (i.e. American vs British English or a different language altogether).

6. Now we can make and install asterisk. The first step, will show you the creation of the modules you selected in the make menu select step. The second command ‘make install’ will actually install asterisk.

make

make install

7. That should be it. We won’t install the sample scripts since this is an upgrade. If you want them please make sure you backup your existing asterisk installation first by tarring up the /etc/asterisk folder at a minimum. If you do want to install the samples and documentation you should run:

make samples
make progdocs

You may also see a warning like this:

 WARNING WARNING WARNING

 Your Asterisk modules directory, located at
 /usr/lib/asterisk/modules
 contains modules that were not installed by this
 version of Asterisk. Please ensure that these
 modules are compatible with this version before
 attempting to run Asterisk.

    res_ari_mailboxes.so
    res_pktccops.so
    app_voicemail.so

 WARNING WARNING WARNING

You’ll probably want to remove these if incompatible.

8. If you had asterisk running you’ll want to stop it

asterisk -r
core stop now

You’ll then need to start the new version of asterisk

asterisk
asterisk -r
core show version

You should see the following

Asterisk 13.5.0 built by user @ host on a x86_64 running Linux

That’s it! You should now be running the latest version of Asterisk. Please remember to test thoroughly and read the release notes / upgrade notes before releasing asterisk to production.

TalkTalk Fibre with a Draytek 2820vn

This post is about using Talk Talk Fibre Broadband (aka BT Infinitiy) with your own router. You might have guessed from the title, I have fibre broadband via TalkTalk. They sent me a new router (thanks TalkTalk) but I already have everything set up with my lovely Draytek 2820vn.

BT Openreach left me with a VDSL modem that plugs directly into the master phone socket. I plugged this in to the TalkTalk router and everything just worked. However, when I plugged it into the WAN (2) port of the Draytek I had no internet.

Solution

I searched online for the settings, but different people said different things, none of which worked for me. Below I’m going to show you how I configured my Draytek to work with Talk Talk Fibre.

1. Plug the LAN port of the BT OpenReach modem (mine’s a white box) into the WAN port of the Draytek 2820vn.

2. Navigate to the Draytek management page (usually 192.168.0.1).

3. Click on WAN (in the left menu) then General Setup

4. Under WAN2 you’ll want these settings:

  • Enable: Yes
  • Display Name: TalkFibre
  • Physical Mode: Ethernet
  • Physical Type: Auto Negotiation
  • Active Mode: Always on
  • VLAN Tag Insertion: Diable
  • Click OK

5. In the left menu navigate to WAN -> Internet Access

6. In the INDEX column select WAN2

7. You’ll see PPoE, Static or Dynamic IP or PPTP/L2TP – SELECT Static or Dynamic IP

8. Fill in the screen as follows:

  • Enable: click to select
  • Enable PING to keep alive: [unchecked]
  • PING to the IP: [blank]
  • PING Interval: 0
  • Wan Connection Detecion Mode: ARP Detect
  • Ping IP: [blank]
  • TTL: [blank]
  • MTU: 1500
  • Enable RIP: [unchecked]
  • Obtain an IP address automatically: [select this]
  • Router Name: [enter your phone number e.g. 02081231234]
  • Domain Name: talktalk.co.uk
  • Default MAC Address: [select this]
  • Click OK

Et voila! Your draytek will restart and hopefully you’ll be able to access your fibre via the BT Modem.

Hope that helps 🙂

One simple thought to keep you motivated on your startup

Working on your side project or business idea takes a lot of motivation. Deep down you know you should be working.

But it’s tough. Tough to get started. Tough to avoid distractions. Even tougher when you’ve just put in a full day at your 9 to 5.

Don’t worry, you’re not alone. I’m in the same boat too.

In January this year I started the web app challenge. My goal was to build software for the property management industry. Initially I worked extremely hard. I knew I needed to make a dent into my new product before I began to second guess myself.

Every time I came up against a difficult problem I would get a bit disheartened. I didn’t want to start work when I got home.

I was tired.

Eventually I’d set aside a weekend and put in the hours to solve my problem. Most of the time the solution was simpler than I thought it would be. So I began to ask myself “Why am I finding it so difficult to sit down and work on something I actually want to work on?

At my job I’d be reminded about how much I really wanted to work for myself. And how much I want to build a business that allowed me freedom. Freedom to travel.

Then it hit me. I kept losing sight of that goal.

My goal is to quit my job within two years and have a business that meets my financial needs. Every day that I don’t work on my goals is a day longer I stay employed.

That’s an empowering thought for me.

Now, my aim is to spend at least one hour each day working towards my goal. This small shift alone has increased my productivity.

I keep a score. 730 (365 days x 2). Each day I don’t work at least an hour on my new business, I add one to the score.

Each day I do work at least an hour, I minus one from the score. Hopefully, by the end of two years I will have spent roughly 730 hours or more on my own business.

That’s about 20 full time working weeks! Time that could be easily wasted watching the latest TV shows in the evening.

So here’s my challenge to myself and to you. What can YOU build with 20 full time working weeks?

Web App Challenge Status Report

Back in January I threw down the gauntlet and decided to take on the web app challenge. I said I would make a profit. I also said I would be transparent.

So here it is. An update.

The past couple months have been a crazy journey. I’ve taught myself Ruby on Rails. I’ve written 80% of a web application that works. And I’ve even learnt how to deploy it to a VPS myself.

That’s not all. I also had the time to make a marketing site and get the app tested by a potential end user.

Let me be honest. My app is nowhere near finished or ready for sale, but I am getting there. To be perfectly honest I’m finding it really tough to juggle my full time day job, family and social commitments and working on the app. I’m getting there, but not as fast as I’d like.

In case you don’t already know I am building software for property management and lettings agents in the UK.
I haven’t been tracking my time so I can’t say how long I’ve spent on the app so far. I’ve spent under £300GBP on a VPS and domain names.

Right now I think I’m over complicating some functionality and that’s stopped me from implementing anything other than bug fixes for a while. If you’re good with modelling data or would like to test my app please get in touch!

Scratch your own itch

When you’re building a product, web app or otherwise, the de facto advice is to “scratch your own itch”. It makes sense. Find a problem which bothers you enough to take some action to solve it. Ideally, you won’t be the only person with the same problem and others will be experiencing enough pain to do something about it i.e. pay you for your solution.

If you’ve been following my posts lately, you’ll know I’m midway through month two of my web app challenge. Going against conventional wisdom I’m not scratching my own itch – I’m scratching someone else’s (that sounds wrong…but you get what I mean).

Now although the itch isn’t mine, it belongs to someone close to me and I feel their pain.

What’s the pain?

90% of their business activities are recurring repetitive tasks that could be automated. Right now they do everything manually – yes, manually.

Is there a solution out there?

Yep, plenty. We could use one of these existing solutions but decided against it. After speaking to several businesses in the same industry the consensus was that existing providers were either too expensive, too hard to use or a combination of the two.

Another thing I noticed was that many of the existing providers didn’t offer an overly “user friendly” web based offering. Instead they required to customer to have on site equipment (severs etc) to run their applications. On top of this most providers (in the UK at least) seemed to have websites that looked dated and didn’t demonstrate their product well.

There were some exceptions to this of course and I made use of free trials where available. I found that whilst many performed the job they were not intuitively easy to use.

What am I building?

I’m building a property management application. The person who’s itch I’m scratching is my Father. Whilst his business is a lot more than just property rentals, this is the area I’m choosing to focus on as it’s where they are experiencing growth and need a solution thats more scalable than spreadsheets and files in filing cabinets.

It’s nice to have access to a “subject matter expert” at home, but I’m also in touch with similar businesses to ensure I build a tool that caters to the majority of needs rather than something bespoke for my Dad.

How much time have I spent?

Keeping in mind I have a day job, I’ve had to make some hard decisions about how to spend my out-of-work hours. I try to make it to the gym 3 times a week and leave Friday/Saturday evenings for socialising. The rest of the week I try to work pretty much immediately after getting in from work until bedtime.

I’ve found staying motivated is hard. It’s even harder to get to work after “relaxing” in front of the TV for an hour. In my head I keep telling myself, I’ll have more time to watch TV after July. It’s been tough and some days I get nothing done, but having limited time is keeping me focused.

I haven’t done any specific time tracking, but my guess is about 10 -15 hours a week.

“The one human quality that must be developed is self discipline for success. The will power to force yourself to do what you know you should do when you should do it, whether you like it or not, whether you feel like it or not. Success is tons of discipline.” — Brian Tracy

Where are the links I promised last post?

In my last post I mentioned I had been in touch with a great bunch of guys working on their own web app challenges. They’ve been a great source of motivation and inspiration so far. Here are links to their blogs/projects:

App Name App Author Target Monthly Income
by July 2013
App Description
Convert Kit Nathan Barry $5000 (USD) An app to help improve the conversion rate of your landing pages and make the set up of auto responder email courses easier.
Xander.io Martyn Garcia 10 paying customers The best conversion optimization platform the world has ever seen. Developer and designer friendly.
The Niche Finder Paul Devlin $5001 (USD) A tool that scans eBay recording product metrics such as how many of each product the seller has sold each month. The products are then displayed in a best seller list so users can find popular products at a glance.
ThankBee Rob Chava $1000 (USD) With ThankBee, Android app developers can:

  • Invite buyers to friend them on Facebook, follow them on Twitter, or to join their mailing list.
  • Invite users to give them valuable comments and feedback (possibly solving issues that would normally end up as negative reviews).
  • Promote their other apps and services.
  • Offer special discounts or trial codes to users who cancelled their purchase.
Procedure Office Will Claxton $500 (USD) Virtual Assistant Management Software

  • Manage any number of Virtual Assistants easily all from one simple to use dashboard
  • Create Standard Operating Procedures (SOPs) for quick reference to common repeatable tasks
  • Custom Tasks & SOPs have colour coded Priority Levels
  • Set SOPs to Re-occur on the VA’s to-do list
  • Business Owners receive notifications if scheduled SOPs not completed on time
  • Statistics on task completion timing and scheduled SOP completion percentages
  • VA’s can have multiple clients, this makes managing daily workload much simpler as everything is in one location.
Property Management App CD £3000 GBP (~$4700 USD) An easy to use, web-based Property Management Tool for UK based Letting Agents