Skip to main content

Posts

Using multiple accounts with Github

If you're like me and have a personal Github account but work for a company that also uses Github you will probably want to be able to set up multiple accounts on Github. It's pretty simple to do so: Firstly you need to create a new key for your company account. Make sure that you save it to a file other than the default id_rsa otherwise you'll overwrite your default ssh key. For illustration lets save it to ~/.ssh/id_rsa_alternate ssh-keygen -t rsa -C "your-email-address"   Now open up your company account on Github and navigate through the settings to manage your ssh keys.  Use the following command: cat ~/.ssh/id_rsa_alternate.pub   Copy and paste the output into a new key on your company Github account. Next we add the new key to our identity: ssh-add ~/.ssh/id_rsa_alternate Edit (or touch) your ssh config file at ~/.ssh/config and include a new option for authenticating using your company account: Host github-COMPANY HostName...

Caching Laravel with Varnish

PHP Framework popularity as at 2013 - Sitepoint After having a very good experience with using Varnish to cache a Wordpress site we decided to look at caching Laravel. Laravel always generates cookies regardless of whether a person is logged in or not.  This interferes with Varnish which by default will pass all requests with a cookie to the backend and skip the cache. In our particular case our site supported the ability for users to login and would then present them with custom content.  This means that cookies are not restricted to a particular path so we can't discard cookies based on the request as we did for Wordpress when discarding everything except /wp-admin/* requests. My solution was to use a package called session-monster ( Packagist  ) which sets a response header if the data in the Laravel session can be ignored.  Varnish can detect this header and prevent the cookie from being set since we don't really need it.  This together with t...

Wordpress on Hiphop / Nginx / Varnish

I recently was asked to investigate speeding up one of the Wordpress sites of a fairly large government organization in Britain.  A large part of my investigation focused on the server stack because I felt that we could get more out of the hardware that was provisioned for us. I decided to set up a stack on my development machine to see how it would work and if it was feasible.  I settled on nginX with hiphop and a Varnish frontend cache.  I realize that nginX would be just fine as the cache and server but in this particular case it would not be possible to replace Apache with nginx on the live server.  I also wanted to experiment with ESI and it looked better documented in Varnish than nginx. Installing HHVM is very easy: wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | apt-key add - echo deb http://dl.hhvm.com/ubuntu saucy main | tee /etc/apt/sources.list.d/hhvm.list apt-get update apt-get install hhvm Installing nginx is also very easy:...

Server sent events in PHP

Server sent events are really pretty cool.  They let your application function a little bit more like an application and a little less than a click adventure in the web wonderland.  They are very simple to code and allow your backend code to notify your frontend of progress or other changes. I could get into trouble for this class comment At time of writing they are not supported by Internet Explorer ( see here ) but hopefully Microsoft will either stop making Internet Explorer or bring it up to speed with modern browsers.  Yeah I know that's not going to happen, but we can wish right? You don't need to retain an open connection for every visitor to your site because browsers will reopen a closed connection after a few seconds.  The additional load for implementing SSE seems to be manageable according to people like this guy who have done tests. My first project implementing them was for a database consistency tool that is intended to be run against the d...

Useful tool when helping Windows users install their OS

This post is more of a "note to self" than an attempt to be useful to somebody else. I am even typing this post in Internet Explorer. It feels like a Pterodactyl is about to swoop into the room and try to shit on HTML standards. In any case I gave my backup laptop to my kid and so had to install Windows on it. Why? Well I want her to be able to play games so Windows seems the best choice. Plus she can still learn open source programming languages, albeit in a funny way. Luckily I remembered this blog that I read and they posted this really nifty tool called Ninite. Click the link here ( http://ninite.com/ ). This helpful tool lets you download a single install file that installs free (either OSS or free to use) software like Libre Office, Flash, Notepad++, antivirus, etc. Lets just say that it feels almost like an Ubuntu meta-package that helpfully installs everything you need, but you get to choose. Plus it's all free and the only software I don't tr...

A rare Google UI failure

A Google UI employee contemplating how to make Larry and Sergei some money I updated my Google Chrome mostly because I trust Google in terms of UI. In the past they've always released updates that make things faster or easier to reach (while perhaps adding new extra functions). Why am I so disappointed? Well now when you open a new tab you're confronted with a Google search bar and your most visited sites. This most probably sounds like a good thing. BUT... your tab is in the omnibar which is the same as a Google search if you don't specify a valid URL. So to make use of the default Google search requires you to tab or click into the box. More annoyingly you can't choose to have your installed apps show instead of a Google search box and an acknowledgement that they track your browsing activity and share that with the American spy agency. So instead of hitting CTRL-T and clicking feedly I have to face NSA surveillance by Google showing me they're track...

Fixing the "smsbox_list empty" error in Kannel

I got this error even though I had an smsbox defined.  Unfortunately I had forgotten to create the smsbox-route group, so this is a very quick fix: #--------------------------------------------- ## SMS ROUTING ##--------------------------------------------- group = smsbox-route smsbox-id = mainbox smsc-id = ztemodem-smsc-group sim-buffering = false ... continues ... Just make sure the id's matchup, so my smsbox group begins with this: #--------------------------------------------- ## SMS BOX ##--------------------------------------------- group = smsbox smsbox-id = mainbox ... continues ... And my SMSC looks like this: #--------------------------------------------- ## GSM MODEM SMSC ##--------------------------------------------- group = smsc smsc-id = ztemodem-smsc-group ... continues ... This successfully cleared the "smsbox_list empty" error and allowed messages to be delivered properly. Kannel had until then been able to send messages and receive delivery...