Preparing your Linux environment for VoCore development

Getting started with VoCore development can have quite a steep learning curve, so I am making this post and video to try and help others figure this out faster.  I tried to set up the dev environment on my MacBook, but due to an issue with MacPorts, I was unable to get it to successfully build OpenWRT.  Because of this, we will be using the Ubuntu VM set up in the previous posts to set up our environment and build OpenWRT.

To start off, you may be asking, “What is this OpenWRT thing you are talking about?  I thought this was about VoCore?”.  Well, VoCore is the chip itself, and it runs on the OpenWRT Operating System.  OpenWRT is an open source router firmware based on the Linux Kernel.  Because it is Linux based, it also makes more sense for us to use a Linux VM to ensure maximum compatibility.

The first step would be to install the necessary command-line tools for the OpenWRT build process.

sudo apt-get install zlib1g-dev libncurses5-dev gawk subversion libssl-dev git g++

This should take a few minutes.  Most of these tools could already be installed if you have done any kind of development work on this VM, but otherwise it will download and build the tools you need.

Next we are going to have to clone the OpenWRT source code so we can compile it and develop applications for the VoCore.  Navigate to your VoCore development directory, and use “git clone” to download the source.

git clone git://

This will create a local git repository containing all OpenWRT source code for you to use.  There is some code that will need to be updated however, that is not part of the main OpenWRT source.  This will be update using the bundled “feeds” script.  From the base OpenWRT directory….

./scripts/feeds update -a

./scripts/feeds install luci

At this point, we are ready to configure and build OpenWRT for the VoCore platform.  To configure the build process,

make menuconfig

and ensure that the configuration matches the following.

Target System: Ralink RT288x/RT3xxx

Subtarget: RT3x5x/RT5350

Target Profile: VoCore

Save the configuration, and build it.


This process can take several hours.  When it is completed, you should have a fully built development environment for the VoCore system.  Soon I will have a video link describing this process, and a post up on writing your first program.

Project Euler #3

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

Simply factorize the target number and select the maximum value from the factors.  Should be pretty simple.  It should be noted, however, that simply iterating through every number is not going to suffice, because a number can have two of the same factors.

For example, the number 28 has a prime factorization of 2, 2, and 7.  The fact that there are two 2’s in the factorization should be taken into account when writing your solution.

Project Euler #2

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

We are given our bounds in the problem,  1..4000000 , and we are to find and sum every even fibonacci number inside the given bounds.

To start off, we should define a function to generate a list of fibonacci numbers.  I opted for a recursive function, but this could easily be achieved using simple loops as well.

def fib(nums, maxNum):
    if not (nums[-1] >= maxNum):
        nums.append(nums[-1] + nums[-2])
        fib(nums, maxNum)
    return nums

With that function defined, the rest of the problem is simply iterating through the array of fibonacci numbers, testing if they are even, and adding them to a sum value.

Project Euler # 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

This one is pretty simple from the get-go.  Simply iterate through numbers  1..999  and check if they are a multiple of 3 or 5.  If they are, add them to the total.

Creating an easy-use framework for Python applications

Recently I have been working on a framework for database driven Python applications.

Current code can be found here.

The idea here is to abstract the database work from the programming of the application.  Instead of writing a series of complex SQL commands to modify and migrate database tables, you can simply edit a single row in the `ApplicationData` or `DocumentDictionary` tables, and accomplish the work of a whole database migration with a simple `update` statement.


All data is stored as JSON values, so if, for example, you would traditionally have a table like this:

id x-value y-value
1 0 0
2 1 1

With this framework, you would simple create an entry in the `DocumentDictionary` table for each of the columns, specifying the DocType, FieldName, and a few other things. Then, when creating a new Document of type `point2d`, the framework would create an entry in the `DocumentData` table, with the JSONData looking something like `{‘x-value’: 0, ‘y-value’: 0}`.

One of the downsides to using this system is that it adds computational overhead to database and data access. I believe that the ease-of-use justifies this, and the abstraction allows for more readable code overall.


Currently the framework provides a set of 4 classes to be used when programming.

  • framework.Framework(db = ‘/DB/application.sqlite’)
    • You’d instantiate this at the start of your application, optionally specifying your database location if it is different than the standard.
    • Stores all your important stuff in Memory, such as your current DocumentTypes, and currently open Docs
  • framework.Document()
    • Can be created anytime, by any object. Stores data in JSON, as seen in the DB structure.
    • Calling Document.commit() will write your Document to the database.  You should avoid doing this directly, because if Document().__dict__[“id”] already exists, you are going to overwrite it and lose your data.
  • framework.DocumentType()
    • Has two instance variables, one containing a string stating the DocType, the other being a list of framework.Field() s.
    • These are loaded from the database by Framework().loadDocTypes() , but you can create them yourself and write them to the database at will.  Please make sure that you do not overwrite anything important.
  • framework.Field()
    • Simply specifies a Field for use in a DocType
    • Corresponds to a typical Column in a database structure
    • Can be manually created and added to a DocType to create new “columns” in the database

Reddit Chrome Extension

I made a little extension for Google Chrome that allows you to quickly navigate to subreddits by simply typing “r”, followed by a space and the subreddit name in your address bar.

Code can be found here.

Install is simple.  Open Chrome, and type chrome://extensions into your address bar.  Enable developer mode, and select Load Unpacked Extension.  Select your local copy of the code, and you should be done.

Try it out!  Type “r all” in your address bar, and you should see “” load up!

Resizing a VirtualBox .VDI virtual hard-drive file

In my last post, I created a Ubuntu VM in VirtualBox, but only used the default size of 8Gb for the size of the virtual hdd.  For some small applications, this may be ok, but it can be a large handicap when working on larger projects or with multimedia.  If I wanted to have a bigger hard-drive, I’d have two options: either create a new .VDI file, or resize the existing one.  Creating a new file would require reinstalling Ubuntu to it, along with all my programs and files, so we are going to opt for resizing our existing file instead.  In order to do this, we need access to Terminal and a Ubuntu(or other Linux distro) Live CD image.


The first thing we need to do is physically resize the file.  VirtualBox comes with a nifty command for doing this called “vboxmanage” that allows you to modify many aspects of your VM.  Enter the command below, substituting in the Absolute Path to your .VDI file  and the size in Mb of how large you want your .VDI to be.

vboxmanage modifyhd [AbsoluteFilePath] –resize [SizeInMb]

Once your file is modified, open up VirtualBox, and startup your VM.  Select “Devices > CD/DVD Devices > Ubuntu.iso” from your host OS’s menu bar, which will tell your VM to boot from the live CD instead of the .VDI on its next reset.  Press “R” to reset the system, and reboot the pc.

Once it boots you should again be faced with “Try Ubuntu” and “Install Ubuntu”.  This time, we are going to choose “Try Ubuntu”.  When your desktop loads, go to the Dashboard, and search for GParted.  Run it, and you should be faced with a  screen allowing you to modify your hard drive partitions.  Modify your partitions following the instructions in the video, and apply the changes.  Shutdown your VM, and on the next boot up, you should have access to all of your new space!

Installing Ubuntu with VirtualBox

In this guide, we will be creating a virtual machine, using the VirtualBox software, and running the Linux distro Ubuntu inside of our host operating system.


To start, head on over to the VirtualBox website, and download the latest version of the VirtualBox software for your Operating System.  It should be a fairly straightforward install process.

Next, head to the Ubuntu download page, and download a Ubuntu .iso file.  You can select either the 64 bit version, or the 32 bit version.  I would recommend the 64 bit, because it is a more modern architecture built for better computers.


With both of these items fully downloaded to your computer, open up VirtualBox.  Hit “New” at the top-left, and name your Virtual Machine.  If the name you choose includes the word “Ubuntu”, then it should automatically fill in the two boxes below.  Otherwise, change “Type” to “Linux” and “Version” to “Ubuntu”.  Hit “Continue”.

Here, it will ask you to allocate RAM to your VM.  This can be any amount, but whatever number you choose will affect your VM’s speed.  I chose 2 Gb, to shorten my build times in later videos.

In the next screen, it will ask how you want it to do the Hard-Drives.  Opt to create a Virtual Hard Drive.  In the prompt that follows, choose to create a .VDI file, and choose an allocation type.  The two types have their own advantages/disadvantages, some of which I detail below:

Dynamically Allocated:

  • Pros: Takes up less space on your HDD if your Virtual Drive is not completely full.  Also takes less time to generate initially.
  • Cons: Slower IO times when running your VM, because VirtualBox has to allocate more space as you use it.

Fixed Size:

  • Pros: Faster IO times inside VirtualBox, because the file is already created, and you are just overwriting the data.
  • Cons: Full-Size file is created from the start, so it takes up more HDD space from the beginning.

It should then prompt you for a size.  Pick something large enough to store all you need to, but not large enough to be cumbersome to your host OS.  It is possible to resize a .VDI file later, as seen in this post, but this process is best to be avoided.


At this point, you should have completely set up your VM.  Go ahead and select your VM from the list on the left, and hit “Start“.  You will soon see a prompt asking you to locate your CD Image.  Navigate to your Ubuntu ISO, and select it.  VirtualBox will boot into the Live CD version of Ubuntu.  You should quickly see a prompt asking if you want to Try Ubuntu, or Install Ubuntu.  Choose to Install it, and follow the prompts.  It should be pretty straight forward from here, up until your desktop gets fully booted up.

Once you finally get to the Ubuntu desktop, there is one final step.  In order to ensure full compatibility with VirtualBox, Oracle has created a small software package for you to install to ensure the best experience.  Go to “Devices” in the Menu Bar of your host OS, and hit “Install Guest Additions“.  Let the process run its course, and you should be good to go.  Let me know in the video comments if any part of this was unclear!

Simple AltCoin written in Python

In this day and age, nearly everyone has had some kind of exposure to cryptocurrencies.  Bitcoin has been massively popular over the past couple of years, and has sparked the creation of thousands of so called “Alt-Coins”.   Alt-Coins are essentially bitcoin clones that add new features, algorithms, etc to their codebase to allow for a broad spectrum of capabilities.

To the average coder though, the Bitcoin codebase is all but inaccessible.  The code behind Bitcoin is incredibly complex, and requires maintainers and contributors to be very familiar with the way that Bitcoin works and how the network operates.

This is where BasicCoin came in.  BasicCoin was created by Zack-bitcoin to simplify the code behind crypto-currencies.  BasicCoin uses a simple sha-256  hashing algorithm, and consists of just a few Python files.

From BasicCoin, I am developing MyCoin (the name is a work in progress.  I haven’t decided on a final name yet.).   The plan is to use the x11 mining algorithm for coin production, and the primary goal is just to keep the coin simple.  Progress can be tracked at the project github page.  Currently, only OSX is supported, due to syntax differences between OSX, Linux, and Windows.  For any suggestions, just submit an issue to the issue tracker, or submit a pull request!

Assembly development on a mac.

When I first got my mac, I had no idea how to continue working on my toy operating system.  After some research, I found a couple of effective ways to do assembly programming on the mac.

Option 1:

I recommend this method for learning basic assembly.  In combination with, dosbox provides a good safe environment for learning the basics.  A guy named Khoraski(on YouTube) has a really good series on how to do assembly programming in DEBUG.

Install dosbox.  Just use the .dmg file to install it to a default directory.

Next create a working directory to store all you dosbox programs and source files. Open up a terminal window, and type something along the lines of ‘mkdir ~/DOSPrograms’ to make a folder.

Now that you have a working directory, just download the file (try this site) and put it into the directory you created earlier(e.g. DOSPrograms).

The rest of this method is just  booting dosbox and using its built in commands.

Option 2:

This is another very safe way to practice Assembly, but provides a much broader toolset.

Download and install VirtualBox, and the latest Ubuntu .iso.

Install nasm via command line.

you should be good to go

Option 3:

Probably the most obvious option, you just install the tools directly into OSX and just program without the protection of a virtual machine.  Download Xcode, enable the command-line tools, and you should be ready to go.  Nasm, GCC, DD, VIM, and LD should be automatically installed and enabled.


I hope some of you found this helpful.  Options 2 and 3 are probably the two I would most recommend for serious Assembly development, seeing as Option 1 is severely limited in scope and utility.