06 Jun 2015, 15:06

Save your Yahoo Pipes as Node.js Apps for posterity

I swore I’d never use another Yahoo product after the cultural terrorism of their Geocities shutdown. Now one of their few bright lights of the past decade, Pipes, is biting the dust. However a very very smart person wrote a program called pipes2js three years ago which you may find useful. It converts your Pipes to Node.js apps!

RIP Pipes

Installation is a tiny bit different from the instructions as it doesn’t seem to be on NPM any more. Here’s what worked for me on a Fedora 22 Virtual Box. I assume OSX would be similar. I might try Windows 8.1 later for the laugh.

The steps are as follows:

  • sudo npm install -g git://github.com/neyric/pipes2js.git
  • Go to Yahoo Pipes
  • Get the ID of each Pipe from its URL
  • pipes2js the_id_of_your_pipe
  • cd pipes/the_id_of_your_pipe/
  • Edit package.json and change “pipes2js”: “0.0.1” to “pipes2js”: “git://github.com/neyric/pipes2js.git”
  • npm install .
  • node run.js

The sad reality for me is that most of my Pipes are no longer functional as they use the old brilliantly simple but deprecated Twitter APIs (shakes fist at Twitter too). But it’s nice to be able to keep some sort of copy and give 2 fingers to the purple charlatans.

Update: It runs fine on Windows 8.1 if you have the various Visual Studio Express bits installed to compile Native Node modules. You may also have to run pipes2js with the full path to pipes2js.cmd so Windows can find it.

01 May 2015, 17:49

A Node.js web-server running on Windows 10 IoT on a @Raspberry_Pi 2. Wow!

I’ve been Snarky McSnarkenstein about Windows 10 IoT on Raspberry Pi for quite a while. When it was originally announced, everyone seemed to think they were getting full-blown Windows for free on Pi. Many still think this. What you actually get is a GUI-less version of Windows on to which you can deploy Universal Apps (and others). So unlike Raspbian on Pi, you can’t actually develop on it, you have to have full Windows 10 running somewhere else to develop, compile, deploy and debug. Or as I said on Twitter:

OK, snark over. Let’s give this thing a go.

Several hours later……

Installation is still a nightmare in this Preview version. Between clicking on hidden EULAs and installers failing with nonsense errors, not to mention having to install Windows 10 Preview in VirtualBox, this is not for the faint of heart.

Win 10 VBox

The RaspberryPi bit was ok and creating the image on an SD Card worked fine. Win 10 IoT booted first time with no issues.

Win 10 IoT on Pi

After several more rounds of messing with Visual Studio, I followed the Hello World Tutorial and pointed it at my Pi. I was rather shocked to see it worked!

Screen

That was the point the scales fell from my eyes. This is actually a very powerful offering to anyone who uses Microsoft tools already. You can build Drag n Drop Universal Apps which deploy just as easily to the Pi as they do to Windows Desktop/Tablets/Phones. I think Kiosks and Control Dashboards could be a big seller here, particularly for the Pi Compute Module. Obviously Visual Studio itself is damned powerful and is considered by most people, even MSFT haters, to be the most powerful IDE available today.

Then I decided to go a step further. Could I get a Node.js program to deploy?

A bunch more stupid installers later……..

Node.js on Vis Studio

Deploy the code, annnnnnd

Node.js on Pi

Oh wow, that is a bit brain melting. So now I have a web-server on Node.js on Windows on Pi on ARM, all debuggable with some kick-ass tools on my PC.

The only major criticism I can make is that I’d like every single piece including VisStudio and all the add-ons to be installable with a command-line package manager. Much easier for everyone.

I doff my cap to you Mr Nadella, this really is the new Microsoft.

Cap

03 Apr 2015, 11:32

Node v0.12.2 for ARM V6/V7 including Raspberry Pi, Raspberry Pi 2 and ODROID-C1

As with Node 0.12.0 and 0.12.1, there are no-precompiled ARM versions of 0.12.2 on the main site.

Node.js

I’ve built for Pi 1 (ARM v6) and ODROID-C1/Pi2 (ARM v7). The latter was built on an ODROID-C1 and it seems to run fine on the Pi 2 since both are ARM v7. It took 1 hr 15 mins to compile compared to 4+ hrs on the Pi 1.

“make test” on the ODROID gave the same results as on the Pi 1: [10:33|% 100|+ 784|- 4]: Done

26 Mar 2015, 09:56

Download compiled version of Node.js 0.12.1 Stable for Raspberry Pi here

Unfortunately, just like 0.12.0, the 0.12.1 release of Node won’t compile on Raspberry Pi (pre 2) so I took a patch from io.js and was able to build it.

Node.js

The problem is due to recent releases of Raspbian mis-identifying the ARM version so Node tries to build for V7 instead of V6. These two changes from this io.js thread sort it out.

I set the Raspberry Pi B+ to Turbo mode and it took 4ish hours to build

Download here and enjoy.

wget https://s3-eu-west-1.amazonaws.com/conoroneill.net/wp-content/uploads/2015/03/node-v0.12.1-linux-arm-pi.tar.gz
tar -zxvf node-v0.12.1-linux-arm-pi.tar.gz
cd node-v0.12.1-linux-arm-pi
sudo cp -R * /usr/local/

Updated files: * configure * cpu.cc

Diffs: * configure

493a494,495
>     o['variables']['arm_fpu'] = 'vfpv3'
>     o['variables']['arm_neon'] = int(is_arm_neon())
495,496d496
<   elif is_arch_armv6():
<     o['variables']['arm_version'] = '6'
498c498,500
<     o['variables']['arm_version'] = 'default'
---
>     o['variables']['arm_fpu'] = 'vfpv2'
>     o['variables']['arm_neon'] = 0
>     o['variables']['arm_version'] = '6' if is_arch_armv6() else 'default'
500,501d501
<   o['variables']['arm_fpu'] = 'vfpv3'  # V8 3.18 no longer supports VFP2.
<   o['variables']['arm_neon'] = int(is_arm_neon())
  • cpu.cc
368c368
<     // We try to correct this by looking at the 'elf_platform'
---
>     // We try to correct this by looking at the 'elf_format'
374c374
<       char* processor = cpu_info.ExtractField("model name");
---
>       char* processor = cpu_info.ExtractField("Processor");
  • Make Test Output: [25:08|% 100|+ 775|- 6]: Done (failures seem to be timeouts mainly)

08 Feb 2015, 12:45

Download compiled version of Node.js 0.12.0 Stable for Raspberry Pi here

Unfortunately the 0.12.0 release of Node won’t compile on a non-V2 Raspberry Pi so I took a patch from io.js and was able to build it.

Node.js

The problem is due to recent releases of Raspbian mis-identifying the ARM version so Node tries to build for V7 instead of V6. These two changes from this io.js thread sort it out.

It took a lonnnngggg time to build directly on my RPi Model B+.

Download here and enjoy.

wget https://s3-eu-west-1.amazonaws.com/conoroneill.net/wp-content/uploads/2015/02/node-v0.12.0-linux-arm-pi.tar.gz
tar -zxvf node-v0.12.0-linux-arm-pi.tar.gz
cd node-v0.12.0-linux-arm-pi
sudo cp -R * /usr/local/

Works perfectly for Harp.js, including the ever-problematic node-sass with its native bits.

04 Jan 2015, 13:42

Bandon Flood Warning data now scraped to Google Fusion Tables using Node.js on ODROID-C1 and OpenShift

After 3 years running as a Python script on a file server, the Bandon FEWS scraper is now running on an ODROID-C1 under Node.js and soon on OpenShift.

Introduction

Cork County Council in Ireland has a site called Bandon FEWS (Bandon Flood Early Warning System). When the Bandon river hits certain levels near Bandon town, it alerts registered users via SMS in case they need to take emergency measures. It’s a very useful service and is very necessary due to the regular flooding that occurs. However the historical river level data is not available in any useful form and that’s the point of this project.

Hickey's Bandon

In November 2011, I created a simple Python script which scrapes the site every 15 minutes and saves the river level to a Google Fusions Table “spreadsheet” here. This now has (with a few interruptions) 3 years of data which anyone can query, re-use or slice-dice and mashup with weather info. Not that anyone has done this :-)

The script has been running on a small home Ubuntu fileserver all this time but stopped working mid-December 2014 either due to changes with the page structure of the Council site or as unexpected fallout from upgrading to Ubuntu 14.04. I have therefore re-written it in Node.js which has the big added advantage that there are free hosting possibilities for this code such as my employer Red Hat’s OpenShift.

Code is now available on GitHub here.

The code started as Google’s example G+ OAuth code but now has the bulk of the functionality completed. It is running reliably under Supervisor on an ODROID-C1 single-board computer on my desk.

To use it for something else on Fusion Tables, the main thing you need to do is setup an App in the Google API Console, enable Fusion Tables API access and use those keys in the placeholders in the config files.

Files

  • main.js - The main code
  • bandonfews.conf - Supervisor config file. Copy to /etc/supervisor/conf.d/bandonfews.conf then sudo supervisorctl reread and sudo supervisorctl reread
  • tokens-example.json - rename to tokens.json. Will be auto-generated by the code on first run in any case
  • config-example.json - Rename to config.json and fill out the Google OAuth API key/secret, the URL of the FEWS site and the id of the Fusion Table
  • index.html - Placeholder for upcoming landing page
  • server.js - Placeholder for upcoming API server
  • package.json - Required Node.js packages. npm install to install everything
  • .gitignore - Stuff that shouldn’t go under Git control

OpenShift Environment Variables

If you are running on OpenShift, you need a way to set various keys etc without adding them to files in Git which could potentially leak accidentally if you also put a copy up on GitHub. So set the following (mirroring the equivalent ones in config.json and tokens.json):

rhc set-env access_token="blah" token_type="Bearer" refresh_token="blah" expiry_date=1419970265050 client_id="blah" client_secret="blah" redirect_url="http://localhost" fews_url="http://www.bandonfloodwarning.ie/main.php" fusiontables_id="blah" -a bandonfews

TO-DO

  • The first time run is currently broken for the OAuth credentials. Easy fix coming.
  • OpenShift is SIGINT’ing it for some unknown reason after a random time which is why it’s running on the ODROID for the moment
  • It should have a simple Express based API so others can avoid the pain of dealing with the Fusion Tables API for basic queries
  • It should have a simple landing page showing the latest water level and maybe a graph
  • It should add back in the functionality of the old Python code for posting to COSM
  • ???

Release Notes

  • 04/01/2015 - First public usable version

21 Dec 2014, 17:44

Introducing FitBit's first sports tracker for Superheroes - The FitBat

Finally the product that Superheroes everywhere have been crying out for - The FitBat. I’m sure the protector of Gotham would approve.

FitBat

13 Dec 2014, 19:59

Say hello to my little friend. The Fitbit XL with external battery by Conor

My first Fitbit died in the washing machine and they kindly replaced it for free. The replacement’s battery started acting up recently and finally gave up the ghost last night. You won’t believe what happens next ;-)

I figured out how to take apart the Fitbit One on the original dead one so this time I managed to do it with no damage. I de-soldered the battery and tried the old one instead. No joy. I’ve found some Chinese suppliers of 55mAh Lipos but I don’t have the patience to wait. One slightly too big battery and some hot-glue later and I give you the FitBit One XL.

Now that I know it works, I’ll remove most of the hot glue and try some Shoe Goo instead. Front Front

Back Back

Wearables. In its clip

13 Dec 2014, 14:35

Some of my old Red Hat floppy disks from 2000-2004

We had to empty our attic to get the house insulated this week. I uncovered some old Red Hat and Fedora floppies and CDs. I previously had much older ones but was quite ruthless about reusing floppies in the old days!

The very first Linux I installed was Slackware on a self-built AMD K5 PC in Sunnyvale in 1996 (I’ve never built a PC with Intel CPUs! Current box is self-built FX-8 Eight Core 8370). I was so traumatised by the Slackware experience, as a Windows 95 user, that I didn’t try again until ‘97 with Red Hat Linux 4. My oldest floppy is from Red Hat 6.2 in 2000:

Red Hat 6.2

I then found a guy in the UK who would burn each new release of Red Hat onto CDs and send them to you for a few quid. That kept me going for ages. Here’s a Red Hat 7.0 boot floppy cunningly reusing a Windows NT disk:

Red Hat 7.0

Then Red Hat 7.3 updates on CD

Red Hat 7.3

And finally Fedora Core 1 boot disk:

Fedora Core 1

Next week I finally rid myself of the last vestiges of Ubuntu and move the home-office file server to CentOS 7 :-) I’m baaaaaaaack.

29 Nov 2014, 15:00

Conor's Thanksgiving Tech Miscellany

As always, so many great tech things happening out there, so little time to blog them, let alone do anything useful with them.

These posts are like a curated, contextualised version of my Pinboard account. Here’s hoping y’all find something useful below.

  • ATOM - The Atom editor by GitHub is coming along nicely and even works well on Windows now. I also discovered that Windows now has a package installer called Chocolatey which is pretty cool. I still think building an editor on a browser engine is somehow wrong tho.

  • Google Compute Engine - I moved an old Django web-app to Google Compute Engine recently. This has previously run seamlessly on a variety of dedicated server providers, on Amazon EC2 and on Amazon EC2 + RDS. It has been anything but seamless on GCE with multiple access errors to CloudSQL per week and random server reboots. Sure, cloud servers should be treated like cattle and not pets (my fave Ops phrase recently) but this isn’t good enough from Google. I couldn’t recommend it to anyone for small production deployments. And unless you are willing to pay for support, you are stuck with “community support” on Stack Overflow if you have problems. This is pretty ridiculous when they are providing $300 worth of credits (or 60 days) for free. If the bloody thing is unreliable and support is barely accessible, the free offer basically sends people away for life. If you want public cloud, stick with EC2.

  • OpenShift - Now that I’m a RedHatter (getting the red fedora on Tuesday, woohoo!), I’ve been playing around with OpenShift Online. It’s a really easy to use git-based flow into a PaaS and I’ve got both Node and Go apps running on the free tier with no effort. MongoDB is running nicely for me there too. It’s a great way to bootstrap an API server and if you are looking to do something with Open Data, it would make a superb base. It also helps that it’s from a company that has Open Source built into its DNA, not just as a morketing tool.

  • Yosemite - If the trackpad on your MBP goes all weird and refuses to click on stuff after you “upgrade” to Yosemite, this trick worked for me where you reset the PRAM.

  • Hudl 2 - We got a Tesco Hudl 2 Android tablet for my 8yo daughter for her birthday. If you want to buy from Ireland, you can get from Tesco UK Online and use your Parcel Motel address for delivery. Initial impressions have been overwhelmingly positive. The 8.3” full-HD screen is superb, the Intel CPU is surprisingly fast, the back camera is good and the stock Android experience is great. It also takes SD cards and has HDMI out. XBMC/Kodi runs beautifully on it too. The only two tiny negatives are that it is quite heavy and there are too many unremovable Tesco UK widgets on some of the home screens. If you are in the market for an Android tablet this Christmas, I honestly haven’t been able to find anything that comes close for even a lot more money. I see almost no practical difference between it and my latest-model iPad Mini which is hugely more expensive.

  • Google Cardboard Apps - Reality Hacker is a Google Cardboard App which is completely head-wrecking and full of awesome. It basically gives you a filtered view of what the phone camera can see. You immediately feel like you are in a Sci-Fi movie or you are Robocop. If you haven’t bought a bunch of Google Cardboards as stocking fillers this Christmas, you and your Android-owning friends/family are missing out big time. I get mine from Elecfreaks in China but it’s a long wait. I assume someone in Europe is dong them at this stage?

  • Just Dance - Chromecast is another bloody bargain that we aren’t using massively but I still like the fact that it is there. It can do a lot more than Netflix. Once I explained to the 8yo that she can cast any YouTube video from her Hudl to the TV, she was hooked. But the app that showed what’s really possible with a €39 TV dongle is Just Dance Now. Instead of the usual Wii and Wiimotes that we use in our house for Just Dance, you use your Android phone, a free App and Chromecast. It works perfectly. The kids were very impressed. The only teeny tiny downside is that they are now moving their arms around quickly with a large €600 phone in their hands rather than a small cheap Wiimote!

  • Chromebooks - Still waiting for the perfect Chromebook that I can dual-boot into Linux. It seems all Chromebooks on Amazon UK are 2GB only, which is ridiculous. I want 4GB, 32GB SSD, 13”, a Haswell CPU and non-disastrous build quality. Too much to ask?

  • Stupid MBP - If Apple are such design geniuses, why do MBPs still have a Caps Lock key and the utterly ridiculous § key? Do yourself a favour and install both Karabiner and Seil. Caps Lock is now a second Shift key for me and the stupid key is now #.

  • iBeacons and BLE - Android 5.0 now lets phones act as (i)-Beacons. Very useful for event check-in.

  • Plex Media Server - I’ve had a few goes at installing Plex over the years but never had much success with it. I hate “library” features on most media apps (glares at almost all Android music players) and much prefer a folder view of the world. But Plex gets very confused if it finds multiple directories called something like “Season 1”. So after a big media clean-up on directory names, it now seems to work ok. We need it in our house due to the inability to install XBMC on iOS devices and their lack of any media playing app that can use SMB shares. So far so good and they have just announced the one thing I needed before I let the kids use Plex - family controls.

  • Hook.io - Marak, one of the original founders of a certain Node company, is back promoting his hook.io platform again. Very interesting approach to webhooks and micro-services. Open source now too.

  • Hackathons - I cringed recently at a conference in London where some big name tech companies were running a “hackathon”. Participants were directed to build web-apps which had to use the “sponsors” products and which would result in some really shitty prizes. A Raspberry Pi, for fucks sake, all £35 worth. I was stunned to see people had turned up to waste their day working for free for someone else on this. To what end? Which is why I adore Stupid Projects from the Stupid Hackathon which has the best/worst ideas from the Stupid Shit No One Needs & Terrible Ideas Hackathon.

  • Espruino - I’m really delighted that the Espruino Pico Kickstarter by Gordon Williams got backed and hit several of the stretch goals. The idea of a tiny USB stick that can emulate a KB/Mouse and is fully programmable to control hardware in JavaScript via your Chrome browser is just too cool. It also has Scratch-style blocks programming. I said it already on Twitter but I think this might be a better tool than raw Arduino for getting kids into programming and hacking and hardware. But it needs a bigger community of contributors which I hope it’ll get from all the Pico backers. Speaking of which, I am 7 months overdue doing a full debug of the NRF24L01 code to figure out why they can talk Espruino to Espruino and Arduino to Arduino but not Espruino to Arduino or vice versa.

  • Wireless Comms - Also speaking of the NRF24L01, this branch of the main Arduino and Raspberry Pi library seems a lot better than the one I used previously. Next week I’ll blog about my wireless switch which uses the sample code with a few tiny changes.

  • Hot and Sticky - I love hot glue but so far I’ve hated hot glue guns. Unreliable, clunky, awkward pieces of crap that take 5+ minutes to heat up. Then a few weeks ago, I discovered the Bosch GluePen. A lithium battery powered piece of brilliance that charges via micro-USB and heats up in 10 seconds. 10 seconds! Of course I bought one. Love it to bits.

  • Ron Swanson - Nick Offerman’s Handcrafted Wood Emojis. Nuff said.

  • Lenovo and Dabs Hell - Absolutely horrendous experience buying a Lenovo E555 laptop from dabs4work.ie. I’ve been a Dabs customer for absolutely years and previously never had hassle with them, even with returns. But they now have a brain-dead policy that you must deal with the manufacturer first to arrange an RMA and only then contact them. The E555 that arrived was a piece of garbage. The space bar was hanging off, the keyboard looked like it cost 15c to make, the screen was randomly covered in colour blocks, the USB ports would’t recognise a mouse and the whole machine froze solid every few minutes and needed a hard reboot. It took days of trying to ring Lenovo/IBM/Medion (which one depended on who you talked to) to get a return approved. Eventually I got an email saying I had contacted the wrong department followed 10 minutes later by an RMA approval! Complete clowns. Avoid avoid avoid Lenovo. Then I got on to Dabs where I clicked “arrange collection” which of course failed on the last step. This was followed by a series of emails, at a rate of one per day, where I tried to arrange collection. The courier arrived 2 days after promised and I finally got a refund whereby I immediately bought an Acer on Amazon instead. 18 days of grief spells the end of a very long buying relationship with Dabs. When are these companies going to realise that people may come for prices but they stay for customer service (ditto Google Compute Engine). In comparison I bought some second hand DDR2 memory from an eBay seller in the UK. One of the RAM modules was faulty. They sent me a replacement immediately and asked me to return the dodgy one only when I got it. That’s how you keep repeat business.