Installing flash in Chromium on a Raspberry Pi 2 with Kano

So, if you know anyone who is into the online version of Scratch, and has a Kano, you’ll know that Flash doesn’t work by default. Adobe haven’t built anything for the Arm chip, and there are no Chrome plugins in the store. Most websites recommend gnash / iceweasel / lightspark, but I struggled with these. Here is how you do it with just chromium and terminal.

mkdir ~/tempdownload

cd ~/tempdownload

wget http://odroidxu.leeharris.me.uk/xu3/chromium-pepperflash-19.0.0.185.r1-1-armv7h.pkg.tar.xz

now extract the file

tar xf chromium-pepperflash-19.0.0.185.r1-1-armv7h.pkg.tar.xz

then

sudo cp -R ~/tempdownload/usr/ /

rm -R ~/tempdownload

cd /usr/lib/PepperFlash/

sudo chmod +x *

sudo cp * /usr/lib/chromium-browser/plugins

sudo nano /etc/chromium-browser/default

Now you need to edit the file, remove the existing line CHROMIUM_FLAGS=”” and replace it with

CHROMIUM_FLAGS="--ppapi-flash-path=/usr/lib/chromium-browser/plugins/libpepflashplayer.so --ppapi-flash-version=19.0.0.185-r1 -password-store=detect -user-data-dir"

Save the file with Ctrl+O, then return to confirm, then Ctrl+X to exit.

Now open Chromium (you’ll need to restart it if it’s already open) and go to chrome://plugins (type this in the address bar), you should see one for Adobe Flash Player, check “Always allowed”.

You should now be able to use https://scratch.mit.edu as per normal.

Thanks to this thread for the basis of my guide
https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=99202

mkpasswd –method=SHA-512 –rounds=4096 in .Net for Windows

I’ve been playing with CoreOS in Hyper-V lately, and struggling to generate passwords. I could spin up Ubuntu/Debian and use

mkpasswd --method=SHA-512 --rounds=4096

But without SSH’ing in, Hyper-V is a pain to copy / paste from.

I’ve written a little C# app (extending on the CryptShartp library. Just  type in a password, add a salt (don’t do that unless you have to, use the generate button instead) and specify a number of rounds to stretch the key and make it a bit more computationally expensive to crack.

You’re better off having a more complicated and longer password, “unless your password is at least 12 characters, you are vulnerable”. But you can set it to 1million rounds instead of the recommended 4096 if you like.

Requests for changes welcome, new hashing algoritms etc.

Download it from: http://russtaylor.co.uk/files/SHA512CryptDotNet.zip

SHA512 Crypt Dot Net Screen Shot

First attempts with F#

I wanted to have a go at some functional programming in F#. I must admit I thoroughly enjoyed it. I feel about F# the same way I feel about C, it’s just right. I am going to continue playing in F#, but I’d really like to see what a large scale app looks like in it.

I was helped by following some guides on: http://fsharpforfunandprofit.com

My first foray was this Dojo: https://github.com/c4fsharp/Dojo-Fractal-Forest

I could spend days playing around, tweaking, trying to make them look more natural, but I had to stop at some point. My trees ended up looking like this.

threetrees

ASP.Net 5, inside Docker, inside CoreOS, inside Hyper-V, inside Windows 8.1 – Part 1

A combination of ASP.Net 5 held in a Docker container, running under the light weight CoreOS Linux, hosted with Hyper-V on my Windows 8.1 laptop sounded like a cheap way to create something. I’m also excited about using this as a hosting solution with a very light footprint, my own free to use PaaS set up.

Part 1 – Getting CoreOS running on Hyper-V

We will start by performing a Bare Metal install of CoreOS. You’ll need to Download the CoreOS ISO.

 

Enable Hyper-V

Follow the Microsoft guide here: http://windows.microsoft.com/en-au/windows-8/hyper-v-run-virtual-machines

 

Set up Hyper-V networking

  1. Run the Hyper-V manager (start -> type Hyper-V).
  2. Select Virtual Switch Manager on the right, then select Internal and click Create Virtual Switch. Call it Hyper-V Network.
  3. Run View network status and tasks (start -> type Network Status).
  4. Click Change adapter settings in the top left. Right click -> Properties on the internet connection you wish to share with Hyper-VBe careful selecting which ethernet / wifi connection to share with Hyper-V. At first I chose the wrong one, and that resulted in the bare metal install not responding, with no obvious error.CorrectEthernetToShare
  5. From there select Allow other network users to connect through this computer’s internet connection, and in the Home networking connection drop-down, select the virtual interface you created earlier  called Hyper-V Network. Click OK .

 

Create the Hyper-V CoreOS virtual machine

  1. From Hyper-V manager select New -> Virtual Machine in the top right. Call it whatever you like, e.g. CoreOS. Click Next.
  2. Select Generation 1, click Next.
  3. Set the memory for your machine, click Next.
  4. Select your virtual network called Hyper-V Network under the Connection dropdown, click Next.
  5. Create a virtual hard disk of the appropriate size, click Next.
  6. Tell Hyper-V to Install an operating system from a bootable CD/DVD-ROM and select the ISO you just downloaded, Click Finish.
  7. Select the new Virtual Machine and click Connect.
  8. In the new window click the Green power button in the top left, the VM will now boot to the ISO.


Install CoreOS

This is where I deviate from other guides slightly, and have hopefully saved you some effort. Now that the CoreOS install has booted:

  1. Sudo to root:
    sudo su - root
  2. We need to pay close attention to the cloud-config.yml requirement.A lot of people use private keys when they SSH into CoreOs, but I wanted to go direct in with Hyper-V and thought a password would be easier. I haven’t found a quick way to generate a password but some options can be found here (see generating a password hash):https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/I have created a generic enough (with a weak password hash!) yaml file to download and get things going. This is not safe to be internet facing! I generated the password in Cygwin. You can grab it with:
    wget http://russtaylor.co.uk/files/cloud-config.yml

    If your network sharing isn’t configured correctly the wget will fail and time out. Ping something if you’re unsure of your net connectivity. Now use Vi or similar to edit it to your needs. A guide to your options is here:

    https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/

    I’d recommend you validate any config before using it, yaml is sensitive! Use the CoreOS validator and not just a yaml validator:

    https://coreos.com/validate/

  3. Once you’re happy with the config use
    coreos-install -d /dev/sda -c cloud-config.yml

    to begin the install.

  4. Once it’s installed, shutdown with
    shutdown -h now

    then unmount the ISO (Media -> DVD Drive -> Eject).

  5. Power up the VM again and you should then be able to login with User: core, Password: password.You should also be able to SSH with Putty or similar to the machine called “CoreOS” on your network.


Troubleshooting

You may bump into problems, instead of going round and round in reinstall circles there is a guide to troubleshooting at the bottom of this page:

http://blog.pace7.com/post/CoreOS_install_to_a_VPS/

I kept tweaking my config, re-uploading it, booting with the ISO, mounting the device (in my case it’s /dev/sda9):

sudo mount /dev/sda9 /mnt

and then overwriting it with an updated version

sudo wget -O /mnt/var/lib/coreos-install/user_data http://russtaylor.co.uk/files/cloud-config.yml

or edit it by hand. I then shutdown, unmounted the ISO, and restarted trying the new config.

I’m new to this, so the config will need tweaking for Docker I’m sure, any improvements are greatly received.

 

Thanks go to these blogs that helped me write this:

General Hyper V and CoreOS: http://silarsis.blogspot.co.uk/2015/01/docker-coreos-hyper-v.html

Cloud-config.yml explanation: http://stevieholdway.tumblr.com/post/90167512059/coreos-bare-metal-iso-install-tutorial

CoreOS Bare Metal Install: https://coreos.com/docs/running-coreos/bare-metal/installing-to-disk/

 

Next post, Part 2 – Getting Docker and ASP.Net 5 running with HelloWeb example.

Don’t put credentials in source control

Bots are crawling all over GitHub seeking secret keys, a developer served with a $2,375 Bitcoin mining bill found.

I think this is just fantastic, and a great example of how unforgiving the internet is. It’s also another example of why you need to stop including credentials in your source control.

Read the full story over at El Reg – http://www.theregister.co.uk/2015/01/06/dev_blunder_shows_github_crawling_with_keyslurping_bots/

Android Device Monitor – Device disconnects and LogCat stops working

For weeks I have been suffering Android Device Monitor periodically disconnecting. From Android Device Bridge (adb)

C:\Users\Russ>adb devices
List of devices attached
c736ba04 device

would become

C:\Users\Russ>adb devices
List of devices attached
c736ba04 offline

The solution was to stop connecting my test phone via the USB hub on my monitor! Connecting direct to my machine resolved it. There are other ideas to try here

http://stackoverflow.com/questions/5154847/device-going-offline-randomly-and-appearing-multiple-times-as-offline-in-eclip