Thursday, December 5, 2013

Thursday, November 28, 2013

Developing on the Rasp Pi w/ QT Creator

Hey All!

I've been looking to develop neat home networking applications on small, low cost devices, such as a Rasp Pi.  I think QT is a great language to develop with as well as learn.

For anyone looking to develop on the Rasp Pi, I am using Raspbian with QT Creator. I used this post and things work perfect:

I couldn't get it running with QT5 yet, only QT4, but I will post back with more success stories soon!


Monday, November 11, 2013

How to set up Arch Linux

Hey All,

Super short post. Recently installed Arch Linux on my laptop and loving it! Below I listed the guides I used, I hope you find them helpful as well!!

Best of luck Linux fans!

To really pimp your Arch install with all your faviorate offensive tools, check out BlackArch:

 Good luck! Comment if you get stuck somewhere ^_^

Update: running ArmArch on the RaspPi is also super easy and similar to normal Arch, raw linux baby!!

Wednesday, October 30, 2013

Proto-Hack Challenge: October

Halloween Edition!

Hack together "handheld fire" for your Halloween costume in a few easy steps.

Ohm's law states that the current through a conductor between two points is directly proportional to the potential difference across the two points. Introducing the constant of proportionality, the resistance,[1]one arrives at the usual mathematical equation that describes this relationship:[2]
I = \frac{V}{R},
where I is the current through the conductor in units of amperesV is the potential difference measured across the conductor in units of volts, and R is the resistance of the conductor in units of ohms. More specifically, Ohm's law states that the R in this relation is constant, independent of the current.[3]

Monday, September 30, 2013

Understanding Symbol Tables

Symbol Tables are the breakdown of languages into it's variables, with the respective scopes well defined.  You can think of it as the dynamic storage for variables as the code is interpreted.

Wednesday, September 25, 2013

Building a Custom Compilier


compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.

Check out my compiler on Github. 

Monday, September 9, 2013

Creating a Bootable Ubuntu USB Drive

One of the most useful tools to have on a USB drive can be operating system install files.

Plug in the (larger-than-2GB) USB drive and back up its contents (unless you don't care).

Begin downloading this .iso from the official Ubuntu source.

If in Linux run in terminal:

sudo apt-get install usb-creator-gtk

(In Windows, install a USB OS boot tool from online)

Once all files are ready, run the usb-creator and load the .iso and the USB drive should be ready for use.

Thursday, September 5, 2013

Installing CGMiner on a Linux OS

In terminal, use wget to download a copy of the code:


Decompress the compressed file:

tar jxvf cgminer-2.11.4-x86_64-built.tar.bz2

Thursday, August 15, 2013

Installing IDLE in Linux Mint

Within Terminal enter:

sudo apt-get install idle

Proto-Hack Challenge: August

Let's set up a Github account!

Drop a comment with your Github username so we can link up!

I'm Heshuge!

Thursday, August 8, 2013

Proto-Hack Monthly Challenges

Over the course of every month, I'm going to walk through the process of building a useful piece of hardware or software.

Sometimes this code will be a module for general use, or sometimes it may be the combination of previously made modules to result in a greater product.

Either way, stay tuned and get ready to start populating your own toolkit!

The first challenge for August is coming soon, so get ready to code something cool!

Sunday, August 4, 2013

Using Node.js and Non-Blocking Code

One of the largest strengths of Node.js is its great usage of non-blocking code.

In essence, non-blocking code creates a function to handle events as they come, so the program or application will be able to handle new events even if they arise during the last event's execution.

It's the difference between these two bits of code:

var contents = fs.readFileSync('/etc/hosts');
console.log('Doing something else');


fs.readFile('/etc/hosts', function(err, contents) {
console.log('Doing something else');

But what's best, is to define a callback function...

var callback = function(err, contents) {
} it can easily be called with one line of code.

fs.readFile('/etc/hosts', callback);

Wednesday, July 31, 2013

Reading from a JSON Dictionary

Dictionaries are useful data structures, and at their core, are a set of one-to-one mappings of data.

A loop and append pattern should work fine for getting the data into the dictionary.

(Of course using the JSON library would greatly simplify this process.)

from urllib.request import urlopen

html = urlopen("")

theDataArray = str('},{')

dictionary = {}

for i in range(100):

      dictionary[theDataArray[i].split(',')[1].split('"')[3]] = theDataArray[i].split(',')[2].split('"')[3]

That last line might look like a lot, but it's mostly just parsing away all the commas and other characters to get at the two pieces of information we're going for, key and name.

This will also take in only 100 strains, for all change to 100 to len(theDataArray), just remember to properly parse the data to avoid errors.

Parsing in Python

Let's make sense of this pile of data.

Reading and parsing data are the first two building blocks of a larger process, compiling, so it's always useful to know a couple of good methods.

A quick Google search of "python reading data" got me to, for some simple reference material.

Now, testing is always a fun way to find out what's going on behind the code, so let's see if we can just pull out a bit of the important data here so we don't overwhelm ourselves.

Now, continuing from before, lets convert the data object to a useful string/array.

>> theData = str(',')

Now let's see what this looks like.

>> for i in range(5):

         print(i, theData[i])

This smaller data structure will come in handy when setting up our larger program design.

Here's the result:

0 b'{"Key":"100-og"

1 "Name":"$100 OG"

2 "Category":"Hybrid"

3 "Symbol":"100"

4 "Abstract":"$100 OG is a hybrid cannabis strain that originally became popular in Southern California. It produces large flowers and a potent high."

Now, wait, your probably thinking, what's that b'{ doing there?

This data is meant to be parsed with the use of json modules, not bare bones python split statements, and that should massively simplify the process.

Although; you may have to redesign your parsing algorithm to completely remove all persisting characters and strings.

Monday, July 29, 2013

Reading API Data

In Python, this is as easy as running a couple of commands in IDLE.

from urllib import urlopen

html = urlopen("") 

HTTPResponse instances also have some more methods and attributes, which can be found here:

This can be additionally simplified by importing and using the json library.

Introduction to APIs

An important part of almost every web app is reading, parsing, and selecting data.

The process of doing this with a public API, can be a simple task.

Okay, hold on now, what's an API?

First, I's say do a quick read through of, but if TL;DR...

An API is an Application Programming Interface, which in simple terms is both a collection of data and commonly a means of manipulating it.

An easy way to think about APIs is that they are an interface that unifies how applications communicate with other applications.

So let's try accessing Leafly's wonderful API strain collection.

"Let's talk to the data!"

That's a good view of some of the data that's available to access.

Now here's a view of what it looks like to your code which will process it:

Well, that's clearly more convoluted... So whats really going on here?

If you took some of that and nicely spaced it out, these are what you would be left with.
    "Name":"Afghan Kush",
    "Abstract":"Originating from the Hindu Kush mountains of Afghanistan...",
    "TopActivity":"Relax at home"},
    "Abstract":"A great afghani kush cannabis strain that is mostly sativa...",
    "TopActivity":"Relax at home"