Skip to content

Instantly share code, notes, and snippets.

def frontendOne(arg1,arg2):
return worker(arg1,arg2,False)
def frontednTwo(arg1,arg2):
return worker(arg1,arg2,True)
def worker(arg1,arg2,switch):
stuffWith(arg1)
stuffWith(arg2)
if switch == True:
@xrl
xrl / arduino-serial-echo.md
Last active August 29, 2015 13:58
A proof of concept for connecting a raspberry pi and arduino by UART
App.UnitActionAdapter = DS.Adapter.extend({
connection: null,
find: function(){
debugger
},
createRecord: function(store,type,record){
var action = record.get('action');
var connection = this.get('connection');
var retval = null;
@xrl
xrl / ADXL325 accelero
Created March 28, 2014 16:46
ADXL345 accelerometer programming code. Immediately raises interrupt when inactivity below THRESH_INACT is detected.
//Add the SPI library so we can communicate with the ADXL345 sensor
#include <SPI.h>
//Assign the Chip Select signal to pin 10.
int CS=10;
//ADXL345 Register Addresses
#define DEVID 0x00 //Device ID Register
#define THRESH_TAP 0x1D //Tap Threshold
#define OFSX 0x1E //X-axis offset
#!/usr/bin/env ruby
require 'bundler'
require_relative 'options'
Bundler.require
client_name = 'xrl'
options = Pix.parsed_options!
ridley = Ridley.new(:server_url => 'https://api.opscode.com/organizations/fanpix',
:client_name => client_name,
:client_key => File.join(ENV['HOME'],'.chef',client_name+".pem" ))
@xrl
xrl / HomeRoute
Created September 13, 2013 19:55
// For more information see: http://emberjs.com/guides/routing/
AdminDashboard.HomeRoute = Ember.Route.extend({
renderTemplate: function(){
this.render('home',{into: 'empty', outlet: 'naked', controller: 'AuthController'})
}
});
@xrl
xrl / gist:6417809
Last active December 22, 2015 04:29
def get_coords():
coords = raw_input("coords x,y: ")
coords.split(",")
# Gotta how big the split is
if(len(coords.split(",")) == 2):
# Python can extra lists using =
x_str,y_str = coords.split(",")
try:
x = int(x_str)
knife node from file nodes/berksinstein.json
knife ec2 server create \
--node-name=berksinstein \
--flavor=m1.medium \
--availability-zone=us-west-1b \
--bootstrap-version=11.4.4 \
--image=ami-72072e37 \
--identity-file=~/.ssh/dat_key \
--groups worker \
--ssh-key=worker \
name File.basename(__FILE__).gsub('.rb','')
attr_list = {"rx" => {
"postgresql" => {
},
"couchdb" => {
}
},
"nginx" => {
"version" => "1.4.1",
var FadeTransitionRegion = Backbone.Marionette.Region.extend({
show: function(view){
this.ensureEl();
view.render();
this.close(function() {
if (this.currentView && this.currentView !== view) { return; }
this.currentView = view;