Install FTDI-drivers on Mac OS X 10.10 Yosemite

REMEMBER: This is for OS X 10.10 Yosemite.

If you are going to use the ESP8266 with a FTDI-cable, you first need to install some drivers. Actually this is pretty basic IF you read the manual (link is below), but if you are like me; here are the steps you “need” to follow.

1. First uninstall Apple-provided FTDI VCP driver, from the Terminal.

Type :
cd /Library/Extensions
sudo rm -r FTDIUSBSerialDriver.kext


2. Download VCP-drivers and install, normal .dmg-install. (Even I now how to do this, just follow the wizard).

3. Download D2xx Drivers (1.2.2) copy libftd2xx.1.2.2.dylib (think I used the one in /bin/10.5-10.7) into the dir /usr/local/lib (use Terminal or Finder).

Change dir to /usr/local/lib

Create a symbolic link1 to the library (ln -sf libftd2xx.1.2.2.dylib libftd2xx.dylib)

Done! (Taken from the installation guide @

Next: Test drive your ESP8266 with some basic AT-commands

Bonus (some Terminal stuff). Command ln (linkname) creates links between files. Passing -sf as options:
-s create symbolic link (soft link)
-f (force) overwrite file if it already exist

In the next part we’ll be looking at hooking up the ESP8266 to your computer via the FTDI-cable.

The idiot guide to ESP8266

In the coming days (weeks? months? years?) I’ll be talking about the ESP8266. ESP8266? From

“ESP8266 is a complete and self-contained Wi-Fi network solutions that can carry software applications, or through Another application processor uninstall all Wi-Fi networking capabilities”

I spent some time (more then I’m willing to admit!) reading numerous guides and blogs and so forth about the little fucker!

Pretty new to the world of electronics and microcontrollers (and with a faint mind) the guides never suited my needs so I thought I’ll do a series of guides for myself and other idiots out there!

Coming next:
Part 1. Install FTDI-drivers on Mac OS X 10.10 Yosemite
Part 2. Hook up your ESP8266!

Solution to slow WordPress Multisite (wpmu) admin

After an update to WordPress running WordPress MU (multisite) the root blog (ID1) went dead slow. Each request took about 1 minute! Every other site on the system was still running at normal speed.

We run a pretty complex setup with plugins like, WordPress MU Domain Mapping and Networks for WordPress (that lets ju run multiple main-blogs with it’s own child blogs).

My initial though was to reinstall WordPress and deactivate plugins and test the installation out. But no luck!

After some Google magic, I found this post at the WordPress support forums (user MacManX (James Huff)).

First step solved our problem!

1. Manually run /wp-admin/upgrade.php (visit it in your browser).

So run (but replace with your own, stupid!) and run the upgrade wizard and you should be fine, if not; follow the other suggestion in the support post.

I suspect that db_version in wp_options did not match the new WordPress install. and WordPress, play nice.

Just discovered a great new service,

“Hosting websites has never been this easy
Keep your websites up and running. Zero server hassle.”

One great thing is the ability to clone (or duplicate) an installation of WordPress (like a staging sever), but that is _exactly_ what it is, a copy. That means that the clone has the root installation URL, so when you try to log in at your new clone it points back to your root installation, not cool. A feature request is made, but in the meantime this following method is a poor mans solution to the problem.

Open up wp-config.php and paste this:


Then visit (Not /wp-admin, didn’t work for me at least) (Replace with your own URL).

You should now be able to access the new (clone) admin.

You should now prob remove the line in wp-config.php

Read more @ WordPress Codex.

Sending mail with Mandrill & PHP (MailChimp)

Hi there

Short post about sending mail through the Mandrill-system.

“Mandrill is a scalable and affordable email infrastructure service, with all the marketing-friendly analytics tools you’ve come to expect from MailChimp.”

Download the latest release (working 2014-16-04). Grab the /src.

Create an API-key @

Put for example mail.php (code below) in the root folder (with /src).

Full API docs.


require_once 'src/Mandrill.php'; 

try {
    $mandrill = new Mandrill('YOUR_API_KEY');
    $message = array(
        'html' => '<p>Example HTML content</p>',
        'text' => 'Example text content',
        'subject' => 'example subject',
        'from_email' => '',
        'from_name' => 'Example Name',
        'to' => array(
                'email' => '',
                'name' => 'Recipient Name',
                'type' => 'to'
        'headers' => array('Reply-To' => ''),
    $async = false;
    $result = $mandrill->messages->send($message, $async);
        [0] => Array
                [email] =>
                [status] => sent
                [reject_reason] => hard-bounce
                [_id] => abc123abc123abc123abc123abc123
} catch(Mandrill_Error $e) {
    // Mandrill errors are thrown as exceptions
    echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
    // A mandrill error occurred: Mandrill_Unknown_Subaccount - No subaccount exists with the id 'customer-123'
    throw $e;

A dead crappy simple node.js chat with telnet

Stolen from Prerequisite: node.js installed (


create chat.js (with the code from down under)

  • type node chat.js in the terminal
  • open a new terminal-window
  • telnet 8000
  • chat away

Bonus: on a local company net? get your IP (ifconfig) and telnet into that, share it with your friends.

var net = require('net')

var sockets = [];

var server = net.createServer(function(socket) {
  socket.on('data', function(d) {
    for (var i = 0; i < sockets.length; i++) {
      if (sockets[i] == socket) continue;
  socket.on('end', function(d) {
    var i = sockets.indexOf(socket);

Website Facebook feed, take 2 a more robust way!?

In a previous post we walked through a way to get a Facebook feed onto your site.

This post is about a more robust(?) way to get the work done!

This solution always provides you with a valid access token. You don’t have to create one yourself.

First the code and the walkthrough below.

$app_id = 'APP_ID';
$app_secret = 'APP_SECRET';
$my_url = 'http://localhost:8888/Facebook/FQL';
$page_id = '164076286984711';

$token_url = ''
  . $app_id . '&redirect_uri=' . urlencode($my_url) 
  . '&client_secret=' . $app_secret 
  . '&grant_type=client_credentials';

$access_token = substr(file_get_contents($token_url), 13);

$fql_query_url = ''
  . 'fql?q=SELECT+message,attachment+FROM+stream+WHERE+source_id=' . $page_id
  . '&access_token=' . $access_token;
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);

Line 1 – 4: Fill in your app id, app secret, the redirect url and the page id you want the feed from.

Line 6 – 9: Here we get an access token (app token) with grant type of client_credentials. Read more about Facebook access tokens.

On line 13 – 16 we query the Facebook graph API to get the data from our page. We use FQL to fetch the result. Read more about FQL and what data to get from the tables.

Line 17 then JSON-decodes the response in an array.

Output the data

<?php foreach ( $fql_query_obj['data'] as $data ) : ?>
  <div class="message">
    <p><?php echo $data['message']; ?></p>
    <?php $images = @$data['attachment']['media']; ?>
    <?php if ( $images ) : ?>
      <?php foreach ( $images as $image ) : ?>
        <p><img src="<?php echo $image['photo']['images'][1]['src']; ?>" /></p>
      <?php endforeach; ?>
    <?php endif; ?>
<?php endforeach; ?>

We run through the data with foreach.

On line 4 we get any attachments and suppress any warnings/notices with the @-sign (@$data).

We then run a inline foreach to get all the attachments (only photos in this case) and echos out the src for the image. Note that the [1] on line 7 gets the second element in the array. Without any deeper investigation I believe you get the largest image. The first element is the small (_s), thumb. (See below for an alternative solution).

Alternative image solution

In the $image object there is ‘src’ ($image[‘src’]), where you get the small source (_s). You can then use the same replace-method in the previous post to get the normal (_n) one.

Source on git

Website Facebook feed

A twitter friend asked me about creating a custom feed for a Facebook wall. Pretty easy with the php sdk, but when I looked at the source it turns out I made it another way. Better or worse? You tell me.

The dirty secret

PHP’s file_get_contents. Here goes.

$content = file_get_contents('');

You need an access token for this, get one like this (small warning, it may expire). Create a Facebook app and add the client_id and client_secret like below.********7221&client_secret=b4a761c0a6************9692ffd58&grant_type=client_credentials

This will return the access token needed to get the content of the Facebook page.

Now your variable $content (from above) will contain a JSON-feed.

Decode it with

$content = json_decode($content, true);

Then run a foreach to output the array (see below for code explanation).

<?php foreach ( $content['data'] as $fb ) : ?>
  <?php if ( $fb['message'] ) : ?>
     <?php echo wpautop($fb['message']) ?>
     <?php $replace = array('_s.jpg', '_s.png') ?>
     <?php if ( $fb['picture'] ) : ?>
      <p><img src="<?php echo str_replace($replace, '_n.jpg', $fb['picture']) ?>" /></p>
     <?php endif ?>
     <time datetime="<?php echo $fb['updated_time'] ?>"><?php echo nicetime($fb['updated_time']) ?></time>
  <?php endif ?>
<?php endforeach ?>

Line 2: If there is Facebook wall posts (called messages in the JSON) then on line 4 output the message with the WordPress wpautop-function

If there is a image (line 6) then print the image but replace the small feed image with a bigger one (from _s (small) to _n (normal).

On line 9 output the updated time with a custom time ago-function. Tho you could use WordPress built in function for this: human_diff_time

Download source/example-file