Lately I have been having issues with my macbook 13in retina 2013.The bluetooth on the mac doesnt connect to any device.After trying a lot of things this is the only solution that worked for me.

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist

I guess this turns off the bluetooth device deamon/agent and voila bluetooth now works.



Everywhere you go either to eat, sleep and even fly.You will always come across open wireless networks.

Currently where I reside most of the shopping malls have free to use Internet.In exchange for your traffic and mobile number you get to access the Internets at crawling speed.These networks are usually open networks, so basically your traffic is naked and unencrypted.Any one can sniff the traffic,inject traffic into your stream and even MITM you, So rather than staying vulnerable target just use a VPN.You have two options to get a VPN,either you buy a VPN from a VPN provider which you cannot certainly cannot trust for anonymity OR the better option setup your own VPN.

Last week I finished my VPN cookbook and this post is a follow up to my previous rant about documentation and how value of open source is diminished without good documentation.

Let’s get to the meat of the post,the post will help you setup your own VPN server ,so you no longer have to worry about open networks.

  • First you need to get chef installed.Download it from here.
  • Then install two ruby gems to help you install the VPN server.
    Librarian-chef a ruby gem to manage your chef repositories.
    Knife-solo is like a tool which understand the chef cookbooks and helps you run the code on your server

Once you have the prerequisites installed, create a Cheffile and add my cookbook to it.Your cheffile should look like this.

cookbook 'pptpd', github: 'h0lyalg0rithm/pptpd'

Then run librarian install to download all the cookbooks to your computer.

Then run knife solo user@host and this will run the chef client on your server and install the recipes.

Once you run it you will notice that it creates a mode directory which will contain a json file.
Edit you json file to add the username and password you want setup in your VPN server.

{
  "run_list": [
    "recipe[pptpd]"
  ],
  "automatic": {
    "ipaddress": "host"
  },
  "pptpd":{
    "users":[{
        "username": "user",
        "password": "password"
      }]
  }
}

Now you have the VPN setup connect to it.PPTPD is one of the oldest VPN servers out there.It should even work on older smart phones even some of the old nokias.



A couple of months ago I worked on a chef recipe to deploy pptd on your server and I used it to setup my own pptpd server on host1plus.
I even made it open source on github.last week I had to setup another pptpd server,So this was the right time to reuse the recipe I wrote.It had been more than a month that I had used chef and knife solo to setup the server.

I tried out my recipe and shot things were not working.there were multiple issues with the recipe.the documentation as good as no documentation.i had to go through the ruby code to actually understand the parameters.moreover I had to restart my server to get the iptables rules to apply and on top of it the iptable rules in my recipe were not complete.basically The server would receive data from the client but it would not forward the data to the interface connected to the network.

So with all of this chaos the lesson I learnt was open source is good.open source is not just about writing code,the only way you can make open source work is by supplementing your code with documentation and tutorials which would help others or the future you to get started with using your project.



Last week I gave a talk at Devnights.The talk was on Emberjs a framework for building ambitious web application. Unfortunately the turnout was not very impressive.I managed to convince a bunch of developers to try emberjs in their next application.

For those who missed my talk, here are the slides.

 



Understanding relative and absolute positioning in CSS didn’t come easily to me when I first started building websites.Now ages after building more websites than I count.I have gotten used to way the browser positions stuff.

Before I talk about absolute/relative position I need to explain what static position is.

0


 

By default every element in the DOM is positioned static.Which means every element appears one after the other in the order they were written in the body tag.

So what is absolute position?Absolute position is where you set the position of the current element relative to the first parent element.

0


Relative position on the other hand sets the element relative to the parent.

0

So we can build awesome stuff by combining the two.

0



Hosting a website is pretty cheap nowadays,with most of the hosting websites charging anything from 4$ to 20$ for a small traffic domain.

Recently I came across cloudflare.com CDN service through mazyod.Cloudflare is a ddos protection service that works by modifying your DNS entries.the best part is that they are free for small websites.

So using Cloudflare and heroku we can get a website running for free with free SSL again (thanks to cloudflare).

To setup your free website

Create an account on heroku.com and host your content on it.
heroku
Next sign up for their new relic monitoring service though heroku.Link

new relic
One gotcha about heroku is that it puts your app to sleep if it doesn’t receive any traffic for a particular amount of time.New relic offers a service where they check the status of the website after a particular interval of time.This check forces your app on heroku to stay away preventing from sleeping.

To activate this service go to application monitoring in the new relic dashboard and enter your domain url 

newrelic_ping
Next setup the Cloudflare account and point your nameserver to cloudflare.To use cloudflare set your nameserver to mary.ns.cloudflare.com or tim.ns.cloudflare.com

Once you are done, create a CNAME record in cloudflare with value of YOUR_HEROKU_APP_NAME.herokuapp.com.

You can check for this value in your heroku settings.

heroku_settings