Skip to content

Instantly share code, notes, and snippets.

View theacodes's full-sized avatar
🪼
I'm workin on it!

Stargirl Flowers theacodes

🪼
I'm workin on it!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am theacodes on github.
  • I am theacodes (https://keybase.io/theacodes) on keybase.
  • I have a public key ASAYLG-IxCSWNo0Kdev6Z4K60rWKN3-qmJMPSPJ6H_DXpAo

To claim this, I am signing this object:

Write our robot code in Python on the Raspberry Pi.
We'll use the Arduino as a daughterboard. It'll handle I/O.
Use a serial protocol to communicate between the 2.
Raspberry Pi (Python) <-> USB Serial <-> Arduino (Firmware)
How do we get there?
1. Write a Arduino sketch to act as our firmware. This will receive serial commands and send back data.
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@theacodes
theacodes / nox.py
Created August 30, 2016 23:49
nox for gcloud-python
def session_test(session):
session.interpreter = 'python2.7'
session.install('-e', '.[grpc]')
session.install('pytest')
session.run('pytest', '-x', 'google')
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@theacodes
theacodes / Dockerfile
Created February 24, 2016 18:41
scipy on MVMs
FROM gcr.io/google_appengine/python-compat-multicore
# Install scipy dependences
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python-scipy
# Add app code
ADD . /app/
@theacodes
theacodes / safe_format_and_mount.sh
Created January 30, 2015 16:20
Safe format and mount from GCE
#! /bin/bash
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@theacodes
theacodes / example.py
Created January 23, 2015 15:48
Simple search and delete task
from google.appengine.ext import ndb
def reaping_task():
search_string = "spam"
# Disable all caching, this prevents out of memory errors as we
# go through the whole dataset. If we don't do this, ndb will
# try to keep a copy of every entity we look at.
ndb.get_context().set_cache_policy(lambda key: False)
@theacodes
theacodes / example.php
Created January 19, 2015 22:02
Compute Engine PHP OAuth Example
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://metadata/computeMetadata/v1/instance/service-accounts/default/token');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Metadata-Flavor: Google']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$resp = curl_exec($curl);
curl_close($curl);
// The client library expects the 'created' property to be set on the access token.
$token = json_decode($resp, true);
$token['created'] = time();
@theacodes
theacodes / CollisionManager.hx
Created January 18, 2015 17:07
Really basic collision manager for luxe
import luxe.collision.ShapeDrawerLuxe;
import luxe.collision.shapes.Shape;
import luxe.collision.Collision;
import luxe.collision.CollisionData;
import luxe.Entity;
import luxe.Color;
class CollisionManager {