Archive

Archive for October, 2016

Stop the spammy notifications

October 31, 2016 Leave a comment
Categories: Interesting

Change key mapping from caps lock to control key

October 29, 2016 Leave a comment

Problem:
I needed to remap my caps lock key to be ctrl for tmux key bindings. Now I can use capslock + a instead of ctrl + a.

Solution:
Added the following to .bashrc

$ /usr/bin/setxkbmap -option "ctrl:nocaps"

Source:
http://serverfault.com/questions/10437/how-do-you-swap-the-caps-lock-to-control-in-xfce#10537

Categories: bash Tags: ,

Python Generators

October 29, 2016 Leave a comment
Categories: Interesting, python

Applying the Linus Torvalds “Good Taste” Coding Requirement

October 28, 2016 Leave a comment
Categories: Interesting

Spell Checking in Vim

October 27, 2016 Leave a comment
Categories: Interesting

Vagrant was unable to communicate with the guest machine

October 23, 2016 3 comments

Problem:
I was setting up vagrant on an old laptop running debian 8. I also had virtualbox installed. I ran into the following error when trying to set up an ubuntu vm.

$ vagrant init ubuntu/trusty32
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty32'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Setting the name of the VM: flaskbox_default_1477256195436_10223
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

The main reason for this was because the networking on ubuntu was not working.

Solution:
The fix was to restart the network interface on the ubuntu box.

To do this I had to log into the box via the gui interface using virtualbox or uncommenting “vb.gui=true” in the Vagrantfile.

After connecting I ran the following commands

$ sudo ifdown eth0
$ sudo ifup eth0

I then made sure that I could ping google.com and the host box. Now I needed to enable this when the machine booted. That meant adding the same command to /etc/rc.local

$ less /etc/rc.local
ifdown eth0
ifup eth0

exit 0

I now did a test run on ubuntu/precise32. This worked well and vagrant was now working as expected. Trying the same on ubuntu/trusty32 resulted in a timeout once again. This meant that I had to add the following to the Vagrantfile

  # For ubuntu/trusty32 the box takes a while to boot up.
  # Default timeout is 300 seconds.
  config.vm.boot_timeout = 600

Now both boxes are able to come up even after reboot.

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => /home/rodnee/boxes/testbox
$ vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-100-generic i686)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sun Oct 23 21:21:41 UTC 2016

  System load:  0.25              Processes:           81
  Usage of /:   3.3% of 39.34GB   Users logged in:     0
  Memory usage: 15%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


Last login: Sun Oct 23 21:12:08 2016 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-32:~$ exit
logout
Connection to 127.0.0.1 closed.
$ vagrant halt
==> default: Attempting graceful shutdown of VM...

Note:
You would have to log into a new box the very first time to bring up the network interface. The new changes will persist after a reboot.

Sources:
This took me so long to fix and I went down so many different rabbit holes that I can’t quite say that there was a definitive source that helped me out.

Lessons learnt
1. Installing the latest version of virtualbox did not work on debian 8 (stretch). I needed to stick with what came with the distribution.
2. I did not need to install virtualbox-guest-additions as it already comes with virtualbox.
3. There is no need to change the Network settings on virtualbox. The default settings for NAT work just fine and were not part of the problem.

# Packages that I needed to install
$ sudo apt-get install virtualbox virtualbox-guest-dkms dkms
$ sudo apt-get install vagrant

Your Social Media Fingerprint — thoughts…

October 12, 2016 2 comments

Without your consent most major web platforms leak whether you are logged in. This allows any website to detect on which platforms you’re signed up. Since there are lots of platforms with specific demographics an attacker could reason about your personality, too. https://robinlinus.github.io/socialmedia-leak/

via Your Social Media Fingerprint — thoughts…

Categories: Interesting

DNS Crash Course: A, AAAA AND PTR Records

October 10, 2016 Leave a comment

I usually contribute posts to my blog to share a new concept or to review an awesome new piece of software. However, every once an a while I feel it necessary to contribute to the general knowledge of the Internet by bringing you posts like these.

I plan to publish a series of articles called DNS Crash Course and over the next several weeks, I’ll be explaining about DNS records – those pesky things that can make or break your website, email, and other services critical to a business or organization. I consider myself something of a subject matter expert on DNS as it relates to web hosting, being involved with Fox Design Werx. These articles will focus on a particular record type or types, if appropriate to be discussed together.

In this inaugural article, I’ll be discussing the most basic of all DNS records: the A record. By extension, I’ll also be explaining a reverse lookup record, also known as a PTR record, and something called AAAA or ‘quad-A’ records. First things first…

https://classicyuppie.com/dns-crash-course-a-aaaa-ptr-records/

Categories: Interesting

Three Infrastructure mistakes your company must not make

October 7, 2016 Leave a comment

When Avi Freedman was getting ready to graduate Temple University in 1992, there was no way to buy internet service in Philadelphia. Literally. If you wanted to send someone money to get a dial-up account, there was nobody to send it to. But Freedman had already been running public access Unix machines and letting people he knew log into them. So he decided to turn his personal frustration into a company that would offer dial-up Internet access to everyone in the area.

He thought, “Well, it can’t be that hard. I’ll just buy a commercial 24-7 internet access link and add some modems.” Not long afterward, Freedman founded Philadelphia’s first ISP. That early experience has served him well. Netaxs and many similar ISPs that built out the commercial internet spawned a community of people that now run some of the largest enterprise, web, and cloud and service provider infrastructures around the world.

Freedman has since wended his way through the networking world. He ran engineering for AboveNet, a global backbone provider (now part of Zayo); spent 10 years at Akamai, running the network group and creating infrastructure-focused services; and then served as CTO for the hosting and cloud company ServerCentral. Two and a half years ago, he founded Kentik to give companies complete visibility into their network traffic, performance and security. Having seen over 100 startups scale their infrastructure, he’s one of the best sources of advice we could have found to talk about technical infrastructure.

In this exclusive article, Freedman shares the three biggest (often company-ending) mistakes startups make when it comes to setting up their systems:

* They land themselves in Cloud Jail.
* They get sucked in by “hipster tools.”
* They don’t design for monitorability.

But don’t worry if you spot symptoms of these where you work. It’s possible to avoid these pitfalls if you’re aware of them as you build your company.

http://firstround.com/review/the-three-infrastructure-mistakes-your-company-must-not-make/?ct=t(How_Does_Your_Leadership_Team_Rate_12_3_2015)

Categories: Interesting