GitHub’s Gitignore and Keeping DB Keys Safe

I’m working with a raspberry pi and I’m learning how to collect and manage sensor data.

There is a lot of data and that’s awesome, but dealing with remote persistent storage has helped me understand some good ways of keeping stuff organized and safe.

For example: ‘Keys’ or ‘Tokens’ (Not to be confused with the Late English writer Tolkien)

These are the keys to the door of your data.
To access the contents behind these doors, you must establish that you are the key-holder. One of the ways to do this in software is to create a long complicated string that can passed to the database so you can input or output data.

As long as you keep this token secret nobody will be able to mess with your data, or use it without having to pay for it.

Now this sounds pretty simple, but what if you use that token in code that is stored in a public repository on GitHub? This is essentially like printing a bunch of keys to your house and leaving them all over town. Not safe or smart.


1. We need to keep these keys separate from the rest of your code.
2. We need to keep the file that contains those keys away from your public repository.

To do this I created a separate file called that contains the strings of my tokens and a function called getStorageKey() that returns those strings.
Cool, we’ve satisfied our first goal.

Now we need to keep this file away from our repository. To do this we create a .gitignore file. This is a special ‘git’ file that allows us to specify which files will not be added to the remote repository.
To create a .gitignore file simply enter:

touch .gitignore

touch is a Unix command to create a file and update the access data, but not make any edits. Its the same as opening and closing without saving any changes.

After you’ve created this file you can edit it with any editor you like. I do it with sublime or VS Code because it helps me keep track of the separation occurring between visual studio and GitHub.

All you need to do is add on a separate lines the files you don’t want GitHub or just git to include.

When I first started all my .gitignore file had was:

Its expanded to include…

# the asterisk* acts as a wild card and will match any files with .pyc at the end
# anything that starts with a # is a comment and will be ignored from .gitignore

I saved this file (.gitignore) then added and committed it to the repository.

Now any files I add that end in .pyc or match will not be added to my repository. And you will not be prompted to add them when you check git status.

What about files we’ve already have added???

If we add the rule after we added the file we want to ignore… We need to remove it from tracking on GitHub using the rm –cache command.

This will not remove it from your computer, but it will stop if from being tracked by GitHub, and will essentially be treated as if it was removed from your repository.

To pull this off simply type this command

git rm --cached

In this case I’m removing a file named ‘’.
After checking our git status we’ll see that this file is going to be removed.

Commit the changes and push to your remote repo.

You’ll see the files are still in your local directory, but are no longer in the remote or local repository. Hooray for keeping things safe!

Please let me know if you have any questions or comments.
The documentation is excellent and I recommend you spend some time reading through the resources below to round out your learning:

touch (Unix)
GitHub .gitignore
If you enter: ‘git ignore –help’ in your gitshell you can find more helpful documentation about using .gitignore
Setting up Code for Powershell
Setting up sublime for Powershell

Evangelists in their natural habitat. Behind a booth and with a computer.

WordPress – Adding Analytics

Site tracking is cool because information is cool!
This tutorial will show you how to configure analytics for a WordPress blog by editing the Header.php file using FTP.

Let’s imagine your company gave you something like this to begin analytics:

<meta name="t_omni_extblogid" content="contosotextblogs" />
<meta name="t_omni_blogname" content="alias" />
<meta name="t_omni_market" content="US" />
<meta name="t_omni_audience" content="DEVELOPER" />
<script type="text/javascript" src=""></script>
<noscript><a href='' title='Web Analytics'><img src=''  height='1' width='1' border='0' alt='' /></a></noscript>

The only thing you should have to change is the “alias” to your personal alias.

Of course I’ve edited this snippet because we don’t won’t everybody to add analytics to their blog…

Okay, so you have your snippet. Where do you put it?

Let’s say your hosting your WordPress blog on Azure. You have a number of different ways to access these files.

The simplest is probably using an FTP client such as WinScp. An FTP client will allow you to change files on the remote directory.

Here’s the link to download WinSCP:

After you install WinSCP you should see a page like this:

Make sure you set the File Protocol to FTP.

Now go to Azure
Here’s the link to Azure:

Now go into azure to find the Host Name, User Name, and Password

In the current portal you’ll find all the information on the Dashboard.
You can find the FTP hostname and the Username about halfway down the page on the right.

And if you don’t know your password you can set deployment credentials from the same page. Simply click here:


Set your credentials, and remember your password.


Now open WinSCP and enter your credentials alongside the FTP Host Name


Now that you’re logged in your can explore the files just like your regular file explorer!
We’re going to find the header file of your current theme and add the code snippet!

Check the path and the highlighted file!


Now double click on that file to open it in your favorite text editor.


Here you can see where I’ve pasted in my code.

Save the file and it will be saved on your Azure directory and you’re ready to go!

You can double check to see the changes.
Go back to your azure portal and actually click on the FTP host link.
This will open a new tab and will ask for the same credentials.


Once inside you’ll be able to explore the Directory contents in your browser.

Check the path at the top to see my current location and notice that I can open the file right here to check the contents!


Looks good from here too!


Now everytime anyone opens a page on your blog data traffic data will be sent to your analytics platform.

Let me know if you have any questions!

The Kannon at //Build. This could be a really great story.
The Kannon at //Build.

Python Flask Windows Development Environment Setup

No more struggles Windows Python development! I’ve found this is the best way to configure your dev environment.
This has made things much easier to get started and less of a headache overall.

We use Virtual Environment so we can test python code in encapsulated environments and to also avoid filling our base Python installation with a bunch of libraries we might use for only one project.

But Virtual Environments can be tricky if you don’t establish a good workflow. I’ll show you how to setup your python environment from Scratch and then do a very simple workflow using Flask.

4 Steps:
Install Python
Install Pip
Install VirtualEnv
Install VirtualEnvWrapper-win

Install Python:

First Go to the Python Downloads Site.

As of March 2015 the download you want for a standard windows machine is Windows x86-64 MSI installer (The other download is for servers). Its circled here:


Run the installer!
You’ll come across this page in the installer:


You’ll want to scroll down and add it to the path. If you don’t that’s okay. You can add it later.
Adding Python to the PATH will allow you to call if from the command line.

After the installation is complete double check to make sure you see python in your PATH. You can find your path by opening your control panel -> System and Security -> System -> Advanced System Settings -> Environment Variables -> Selecting Path -> Edit ->

Now you’re looking at your Path. Be Careful, if you delete or add to the path accidently you may break other programs.

You need to confirm that C:\Python27; and C:\Python27\Scripts; is part of your path.

If you do not see it in your path you can simply add it at the beginning or end of the variable value box. As you can see in the image below.


Install Pip:

As of Python Version 2.7.9 Pip is installed automatically and will be available in your Scripts folder.

If you install a later version of Python I would recommend installing it according to this helpful stackoverflow post.

Pip is a Package manager for python which we will use to load in modules/libraries into our environments.

An example of one of these libraries is VirtualEnv which will help us keep our environments clean from other Libraries. This sounds really confusing but as you start using it you’ll begin to understand how valuable this encapsulation of modules/libraries can be.

To test that Pip is installed open a command prompt (win+r->’cmd’->Enter) and try ‘pip help’

You should see a list of available commands including install, which we’ll use for the next part:

Install virtualenv:

Now that you have pip installed and a command prompt open installing virtualenv to our root Python installation is as easy as typing ‘pip install virtualenv’
Like so:


Now we have virtualenv installed which will make it possible to create individual environments to test our code in. But managing all these environments can become cumbersome. So we’ll pip install another helpful package…

Install virtualenvwrapper-win:

This is the kit and caboodle of this guide.

Just as before we’ll use pip to install virtualenvwrapper-win. ‘pip install virtualenvwrapper-win’
Like so:


Excellent! Now we have everything we need to start building software using python! Now I’ll show you how buttery smooth it is to use these awesome tools!

7 Steps:
Make a Virtual Environment
Connect our project with our Environment
Set Project Directory
Pip Install

Make a Virtual Environemt:

Lets call it HelloWold. All we do in a command prompt is enter ‘mkvirtualenv HelloWold’
This will create a folder with python.exe, pip, and setuptools all ready to go in its own little environment. It will also activate the Virtual Environment which is indicated with the (HelloWold) on the left side of the prompt.


Anything we install now will be specific to this project. And available to the projects we connect to this environment.

Connect our project with our Environment:

Now we want our code to use this environment to install packages and run/test code.

First lets create a directory with the same name as our virtual environment in our preferred development folder. In this case mine is ‘dev’

See here:


HelloWold will be the root folder of our first project!

Set Project Directory:

Now to bind our virtualenv with our current working directory we simply enter ‘setprojectdir .’
Like so:


Now next time we activate this environment we will automatically move into this directory!
Buttery smooth.


Let say you’re content with the work you’ve contributed to this project and you want to move onto something else in the command line. Simply type ‘deactivate’ to deactivate your environment.
Like so:


Notice how the parenthesis disappear.
You don’t have to deactivate your environment. Closing your command prompt will deactivate it for you. As long as the parenthesis are not there you will not be affecting your environment. But you will be able to impact your root python installation.


Now you’ve got some work to do. Open up the command prompt and type ‘workon HelloWold’ to activate the environment and move into your root project folder.

Like so:


Pretty sweet! Lets get working.

Pip Install:

To use flask we need to install the packages and to do that we can use pip to install it into our HelloWold virtual environment.

Make sure (HelloWold) is to the left of your prompt and enter ‘pip install flask’
Like so:


This will bring in all the tools required to write your first web server!


Now that you have flask installed in your virtual environment you can start coding!

Open up your favorite text editor and create a new file called and save it in your HelloWold directory.

I’ve simply taken the sample code from Flask’s website to create a very basic ‘Hello World!’ server.

I’ve named the file

Once the code is in place I can start the server using ‘python’ this will run the python instance from your virtual environment that has flask.

See here:


You can now navigate with your browser to and see your new site!

Sweet. You have everything you need to start working through tutorials on Flask without worrying about gunking up your Python installations.

Let me know if you have any questions! Happy Developing!

Art Deco From Afar
Art Deco From Afar

Azure Storage Exploration!

Hey There, during my work studying for my Azure Exam/Working on my Hug the Cloud project. I’ve found accessing and understanding my stored data a bit confusing.

Luckily, someone shared this link with me.
Here you can find a number of available azure file/table/queue explorers.

I chose the first explorer ‘Azure Storage Explorer’
It works well, is easy to use, and is totally free.

Once you have it downloaded you’ll be met with this page:

Use add account to create a new storage view.
Use add account to create a new storage view.

Go to your azure portal and find the info about your storage account in the ‘manage access keys’ section. (You can see the manage access keys button at the bottom of this photo):

From Azure Portal select Storage -> 'Name of Storage Account'
From Azure Portal select Storage -> ‘Name of Storage Account’

Use the name and the primary key and put that info in here:

This has made it much easier for me to organize my project data, and understand what’s happening inside my storage accounts.

Notice the three different types of storage? (Blob, Queue, and Table)

Looks pretty good
Looks pretty good

Let me know if you have any questions!
Had a great time at TreeHacks last weekend. Check out this link for some great Stanford hacks!

This is what a standard Hackathon table looks like at 4am
This is what a standard Hackathon table looks like at 4am

Kinect Hackers Resources!

I’ve found a couple helpful links for folks looking to develop with Kinect.

First Understanding what’s happening with the sensors:
This site does an excellent job explaining how the Kinect calculates depth.

Second the SDK:

This is the home page for all things Kinect Dev.
I would recommend scrolling down to the support page at the bottom of this site. The FAQ is a great start.

Third:Developer Groups
The Kinect Community Forums are great
OpenKinect is another active and resource rich community

Please let me know if you have any other resources to share!
I’d love to see your hack as well!

A knit bombed tree
This tree is wearing a sweater. A sweatree. A Tree-Shirt. A Car-tree-gan.

Hug a Cloud project Introduction!

Remember that flight where all the clouds looked like soft pillows?
And you imagined floating down and taking a little snooze on a bed made of clouds; resting your head on the softest pillow ever created.

Maybe when you think ‘cloud’ you think cloud computing and all the marvelous new ways cloud computing has made powerful scaling infrastructue available for all creators. And you want to give it a big high five.

Or maybe, you have a cloud certification exam you have to take and are feeling a little bit confused about the cloud and might want to take out some angst on the cloud.

Well, regardless of your cloud experience, I’ve been working on a fun little project to help get folks acquainted with how easy it is to begin developing for the cloud with a cloud!

The project will take place in three steps.
1. Setup raspberry pi to collect data
2. Setup your cloud
3. Connect a website to your cloud

All three of these steps have potential for numerous derivatives, but are presented in a very simple straightforward way.

I’d like to think of this series as the first step as you begin to build out much more complicated systems.

As a bit of a disclaimer, I am not expert on any of these three pieces, but I am passionate about learning and I do enjoy the number of fun project ideas that have sprung into my head since starting the project.

I’ll also be iterating on these project as I build up the complexity in the coming weeks. As for now this is the complete barebones solution: Version 0.1.

So lets get started with your raspberry pi!

Running Multiple Python Versions on Windows

So, you are learning to develop with Python and you keep hopping back and forth from Python 2.x and Python 3.x and possibly versions in between.

Beside running everything in a virtual environment, its sometimes nice to just get to the different REPLs to test tiny pieces of code.

This can be managed easily in powershell using powershell profile.
This link helped me learn about what it is and how to set it up.

But basically, you establish shortcuts by customizing a profile page with the things you need to access quickly.

Currently in my Profile I have a shortcut for starting Python27, Python34, and Sublime.

I’ll show you how I set it up.
First we’ll edit our Profile, then we’ll change the execution policy to allow this file to edit PowerShell.

Open powershell!

1. Type the following command and press ENTER:

Test-Path $profile

2. If False you need to create a profile, if true go to step 3:

New-item -type file -force $profile

3. Go to you PowerShell Directory. Step 2 will show the path to the location. For me its Users\tireilly\Documents\WindowsPowerShell.

4. Open your profile:

Notepad .\Microsoft.PowerShell_profile.ps1

5. Now in Notepad you can add your aliases.

This is what I have:

Set-Alias subl 'C:\Program Files (x86)\Sublime Text 2\sublime_text.exe'
Set-Alias python34 'C:\Python34\python.exe'
Set-Alias python27 'C:\Python27\python.exe'

Make sure you have the proper path to your existence of python. I have mine in my Root directory.

Now to activate this you need to set the execution policy to allow this to be activate each time you open powershell.

To do this follow these steps:

1. Determine your current execution policy.


This is just to double check you are restricted either way set it again to be sure.

2. Set Execution policy for yourself.

Set-ExecutionPolicy -Scope CurrentUser

3. You’ll be prompted with “ExecutionPolicy: ”
Set it as unrestricted
It should look like this:
ExecutionPolicy: Unrestricted"
Press enter.

4. Comfirm by entering ‘Y’ and pressing enter again.

Now Restart Power shell and try typing in your alias!
Does Python Start?

If not, I’m happy to help if you have any questions.

This Photo is from 2010... Just saying
This Photo is from 2010…

How to Win at a Hackathon

These are things that I’ve found drive successful teams at Hackathon’s

Fundamental Principal:

You win by creating a good hack and presenting it well.

We’ll break this into two sections.

First: Create a good Hack
Build Small
Make it a topic you’re an expert in
Make it useful to you -> Build something you want
Try to find something that takes 3 or more clicks and turn it into 1 click
Use the Mentors to learn and create
Use the mentors to determine if you have a good project
Use GitHub
Take Advantage of the APIs and Sponsor Solutions – they’ll help you get far
Don’t build a working prototype
Build a robust demo application
Make it smoke and mirrors if necessary
Looks can go a long way to engaging customers
Follow the money (especially if you don’t want to start a company)
Make it engaging
Break down problems as you face them
Delegate amongst your team
Ask Why?
Don’t sit idle
Make friends
Spend time talking to the organizers
Tell a story
Stick to the fundamentals
Work to each teammates strength
Find a quiet space to focus
Watch the clock
Don’t get discouraged, enter another Hackathon
Go to the talks to learn more
Take some photos, take a walk, clear your mind

Most importantly, Have Fun!

Second: Present it well
Practice your pitch
Talk about these things: What’s the problem, how you fixed it
Tell a story
Don’t push back against questions
Have fun
Get up in front of people and make them listen to it
The mentors are good people to practice with
Use the science fair time to rehearse
Use the most articulate person on your team to present
Let the Sponsors know you used their product
Have a clear submission on Challengepost
Stick to the demo you’re comfortable with -> Don’t present Alpha on stage

The above tips are to warn and tip you off about the potential pitfalls of the next 24+ hours.

I think an example itinerary might help hackers who are serious:

1. Pregame

Go to the booths
Talk to the sponsors about their prizes
Brainstorm as you go from table to table
Engage with other hackers while you wait to talk
Ask them if they have any ideas if they have a team
Join a team of 1 to 4
Hash out a couple ideas – Three is a good number to take to the next phase
No writing just speaking

2. Learn and Plan

Learn the why? and how? of your project
Go to talks if you need to brush up on tech
Talk to mentors about what needs to get done
Find resources that will help you accomplish your how

Get on a whiteboard
Wire frame
Prototype and create user models
Talk to your team about the plan
Communicate what everyone is doing
Spend time setting up dev environments
Get going with source control
Practice a push or two to make sure everything works
Practice using GitHub!
Delegating a head developer isn’t a bad idea

4. Create

Start small
Get the first things in place as a team so everyone understands the framework
Begin to delegate as more pieces need to be worked in
Find a quiet spot where you can focus
Delegate tasks
Don’t be afraid to ask for help
Continue to learn as you work.
Commit small changes
Spin up a VM or website to host your project and database

5. Submit

Submit early
Make your challenge post clear
Stop Building

6. Present

Practice your pitch and presentation
Know your demo back and front
Try to get feedback from the demo hour
Get on stage! Perform!

7. Reflect

Something happened in the last 24 hours…
Don’t let if slip your mind
Try to spend some time journal-ing about the experience
Pool the resources you acquired
Update your resume
Sign up for the next hackathon -> It will be better than the first.

If you came to this hackathon and you feel totally out of your element that’s okay.
Hackathons are a great place to be out of your comfort zone, there’s food, friends, and things to learn. I have a sample itinerary for those folks as well:

Go to the booths.
Ask the mentors questions about their companies. Ask them about computer science and development in general. Ask them why?

Find people who are in a similar boat and hang out with them, ask them about their experience with computers and computer science.

Go to the sessions to learn about development.

Start with Code Academy and move onto development with Touch Develop, Python, or JavaScript. Make something tiny.

Shoot for something adorable.

Practice using GitHub take tutorials online

Go around asking groups about their hacks, ask if they need users to test their interfaces.

Go to the presentations -> Take note of the good presenters, take note of the good demos

Connect with the people you met on Facebook.

Reflect (Like above)

Having said all that… You are here to learn and challenge yourself to do your best. Nobody is going to die. Take this time to put something behind you and move forward in your pursuit of Technical expertise.

This is what a Hackathon Looks like before Hackers arrive. The tables look barren.
This is what a Hackathon Looks like before Hackers arrive. The tables look barren.

Kinect Kannon

How to setup KinectKannon

More info about the Kannon can be found on Steven’s GitHub & Blog
Software Setup:
Get a computer setup with decent specs and usb 3.0 (X1/SP3) with Visual Studio
Install the Kinect 2.0 SDK
Install Phidgets drivers
Clone the repository from github
Open the .sln file in visual studio

Hardware Setup:
Make sure the surge protector is connected to an outlet and illuminated

Check all outlets in the surge protector

Connect the white ‘normal’ sized usbs to the hub.

And connect the single hub to a usb 2.0 on your computer

Make sure the Hub is powered with the small dc power adapter

Connect the Kinect USB 3.0 to your usb 3.0 port. The Kinect has the more dense cord and the blue usb tip.

Locate the Xbox controller and make sure you have adequate battery power

Locate your co2 bottle. This is a bit tricky. 

The hose coming from the cannon portion needs to be attached to the bottle

First take dial on curly hose and rotate all the way to the left (lefty loosy)
You’re moving the pin away from the pin so you can connect to the bottle without freezing your hand

Now righty tighty the bottle onto the curly hose. Make it snug.

You can now righty tighty the dial from the hose to the tank. You should feel the hose take on the pressure

If you hear/feel leaking, lefty loosy the dial on the hose connector and retighten the bottle to the hose.

Leaks are not your friend

Loading the kannon

T shirts folded once and then rolled tightly and wrapped with rubber bands work well.
The tighter the fit the farther the launch.
So if you’d like to launch further you may want to fold the shirt in thirds!

Now you are ready to run your code!

Start the program using our favorite green arrow

All is good if app says system ready in the top right corner

Power on your Xbox controller

This will be how you interface with the Kannon

There are three aiming modes which can be selected using the X, A, and B buttons

Manual (x button):
Full (x, y) axis control using the left stick
Keep the kannon facing forward. Turning too far can break connections and render the Kanno

Tracking (A button):
The Kannon will detect people using the skeleton tracking and attempt to move the crosshairs to the center of the body.

WARNING the tracking feature may throw in an exception which will result in the Kannon losing control and reeling to the right. This puts it at risk of breaking connections and rendering the device useless.

To mitigate the risk
Be near the kannon you may have to physically stop it from turning
Once you stop it from moving, it will continue to resist, Stop and Start the Visual Studio Project. It will enter back into manual mode and you can move it back to center
Keep the controller in hand ready to switch to manual mode if the device begins to move hard right

Also, in tracking mode. If you have several people lined up in front of the Kannon you can switch between targets using the D-Pad on the controller. This is a bit buggy as the skeletal tracking hops in and out your selections may not register. Moving back to manual mode will reset the selection capabilities. Now go back to tracking and try using the D-pad again.

Audio (B button):
Audio mode will use the array of microphones to detect the direction of sound and move the kannon towards the loudest noise.
Commanding it like a dog works pretty well, or if you can get someone to laugh. “Come here kannon!, Good boy!”
You are still in manual control of the Y axis. It will pan left and right, but you can aim up and down.

Other Features

Night vision
To enable night vision in any mode simply press the y button, and press y to turn it off

The program uses a text to speech library to speak current state if you can plug your computer into speakers during a demo it can have a great effect!

Safety and Firing
In all aiming modes the kannon is capable of firing.
To toggle safety hit the RB and LB buttons simultaneously
You’ll see firing enabled come through on the display
Once the safety is off pull both triggers (LT and RT) to fire
Just like a real gun. Turn on your safety once fired

If phidgets driver offline
Check your phidgets control panel (Search Phidgets Control Panel)
If the there are two devices connected
We have a USB issue check this forum for more info:
Basically, you have to find the program that is using the USB and close it.
Or move to another more stable computer and load the program there
If the devices do not show up in the control panel
Check your connections
The phidgets controllers are connected using the white USBs
One leads to the valve switch controller on the back
That’s the relay panel mounted on the back of the box, the USB has a tendency to fall out so double check
One leads to the servo controller (The black box with the foam handle)
Check that controller is turned on, the switch can sometimes be accidently knocked off.
You should be able to see a small red light from the box.
Also check the fuse.

Hope this helps get you started!
Let me know if you have any questions in the comments below.

I’ll be posting edits as I find ways to clarify.

Here's the Kannon hanging at Stanford
Here’s the Kannon hanging at Stanford