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]'

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 🙂

Get things done

It doesn’t matter how big the task at hand – finish it.
Break it into smaller chunks of you have to and finish those.

I’m reminded of a quote:

The difference between successful and unsuccessful people is that successful people do what they should do, whether they feel like it or not.