Skip to content

Instantly share code, notes, and snippets.

View jmsaavedra's full-sized avatar

Joe Saavedra jmsaavedra

View GitHub Profile
//#include <WiFlyHQ.h>
/*
- download visualight library from here:
https://github.com/lpercifield/visualight/releases/download/1.1/Visualight.zip
- unzip, put in the Documents > Arduino > libraries folder
*/
#include <EEPROM.h>
@jmsaavedra
jmsaavedra / index.php
Last active August 29, 2015 13:58
PHP simpleXML example
<?php
//first grab the xml file
$xml=simplexml_load_file("http://www.stateair.net/web/rss/1/1.xml");
/* simpleXML let's you parse through the entire file */
/* info: http://www.w3schools.com/php/php_xml_simplexml.asp */
//foreach($xml->children() as $child) {
// echo $child->getName() . ": " . $child . "<br>";
//}
@jmsaavedra
jmsaavedra / gist:9996360
Last active August 29, 2015 13:58
arduino_write 3 bytes
char inByte; // incoming serial byte
int count1; //for some fake data
int count2; //even more fake data
void setup() {
// start serial port at 115200 bps:
Serial.begin(115200);
// while (!Serial) {
// ; // wait for serial port to connect. Needed for Leonardo only
@jmsaavedra
jmsaavedra / _openFrameworks data to arduino over serial.ino
Last active August 29, 2015 14:01
Serial control of Arduino. After kick-off message is sent from OF and a response is received from Arduino, OF continually updates Arduino with 3 bytes of data via a call and response driven by Arduino.
int bytesReceived[3]; //incoming bytes
void setup() {
pinMode(13, OUTPUT); //LED on 13
pinMode(12, OUTPUT); //LED on 12
Serial.begin(9600);
}
void loop()
import java.io.*;
import java.util.*;
/**
made this work.
- joe
@jmsaavedra
jmsaavedra / simpleserial.ino
Created October 3, 2015 22:18
Teensy Serial Controller
/******
* Teensy connected to Powerswitch Tail 2
*/
#define PST_1 3 //powerswitch tail pin 1
#define PST_2 4 //powerswitch tail pin 2
#define LED 13 //teensy 3.0 on-board LED
void setup() {
Serial.begin(9600);
@jmsaavedra
jmsaavedra / info.md
Last active November 6, 2015 21:09
startup script resources for ubuntu

adding an init.d script:

  1. look at /etc/init.d/skeleton for the script template
  2. after creating your own, chmod a+x myscript
  3. sudo mv myscript /etc/init.d
  4. update-rc.d myscript.....tba...

OR

...tba...

@jmsaavedra
jmsaavedra / cURLinOF.cpp
Last active December 7, 2015 07:39
cURL POST Request with ofSystem from openFrameworks
string completeUpdate = "{\"requests\": [{\"method\": \"PUT\",\"path\": \"/1/classes/"+dbName+"/"+displayObjectId+"\",\"body\": "+ updateObj + "},{\"method\": \"PUT\",\"path\": \"/1/classes/"+dbName+"/"+displayObjectId+"\",\"body\": " + updateObj2 + "}]}";
string someId = "someIdString";
pushData(someId, completeUpdate);
void pushData(string someIdStr, string updateObjectStr){
cout << "updating parse. objectId: "<<someIdStr<<endl;
cout << "\tupdate object: "<<updateObjectStr<<endl;
@jmsaavedra
jmsaavedra / .eslintrc
Created May 18, 2016 01:37 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@jmsaavedra
jmsaavedra / mongo-cli-reference.md
Last active January 24, 2017 01:12
mongodb cli quick reference + setup guide

###mongodb quick CLI reference

db backup and restore

from any directory on host machine, export entire db

$ mongodump -db myDatabaseName #OSX
$ mongodump --db myDatabaseName -o C:\Users\someuser\Desktop #win