Skip to content

Instantly share code, notes, and snippets.

View jmsaavedra's full-sized avatar

Joe Saavedra jmsaavedra

View GitHub Profile
@jmsaavedra
jmsaavedra / aws-server-configuration.md
Last active April 23, 2018 19:10 — forked from piuggi/AWS_NODE_FOREVER_SETUP.md
AWS Ubuntu Server Setup incl Node, Mongodb, Port Forwarding

AWS SERVER CONFIGURATION

Configuring an Ubuntu AWS Box with Node, Mongodb, and Forever with port forwarding


  • Login to aws.amazon.com and create an EC2 instance with a standard Ubuntu (14.04) installation.
  • Create a Security Group that allows type SSH on port 22 and HTTP on port 80.
  • Download the .pem file (during setup) which we'll use to authenticate into your server via terminal.
  • Modify permissions on the .pem file downloaded from AWS
$ chmod 0600 ~/Downloads/{your_key}.pem
// WS2812_RFduino_Test
// By Thomas Olson
// No complicated Pixel Library needed.
// Tested with WS2812B 4 pin versions.
// Modified by Sam Decrock to resemble NeoPixel API
// Modified by http://jos.ph to incorporate more of NeoPixel examples
// 20160510 ... verified works with Arduino 1.6.5 and simblee module
// >>> using 3.3v > 5v level shifter between pin 6 and NeoPixels
const int ws2812pin = 6;
@jmsaavedra
jmsaavedra / urldecode.ino
Created December 14, 2013 20:08
URL encoded string to character string (for arduino here)
char *in = "!%40%23%24%25%5e%26*()_%2b";
char *out = "000000000000000000000000000000";
void setup(){
Serial.begin(9600);
while(!Serial){
;
}
Serial.println(in);
urldecode2(out,in);
@jmsaavedra
jmsaavedra / tripleClick.ino
Last active November 15, 2017 20:22
triple click detection
/* https://github.com/JChristensen/Timer */
#include <Timer.h>
Timer t_press;
int POWER_SNAP_BTN = 8;
int LED_1 = 13;
int LED_2 = 3;
int pressCount = 0;
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v2 -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xde:m -Ulfuse:w:0xff:m
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/Users/jmsaavedra/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
@jmsaavedra
jmsaavedra / ofGetAppPtrExample.md
Last active August 26, 2017 18:24
example use of ofGetAppPtr()

###ofGetAppPtr() example

from a .cpp file, for example, "particle.cpp" you can do two things:

  • a) include "ofApp.h" (so you know what's inside the ofApp)
  • b) cast the ofGetAppPtr as a ptr

you can't include ofApp.h inside another .h file, as you would recursive includes (ie, ofApp includes particle, particle includes ofApp), but putting it in the .cpp is fine.

@jmsaavedra
jmsaavedra / rPi-SD-imaging.md
Last active July 24, 2017 23:10
raspberry Pi SD card formatting and image copying

SD CARD IMAGE COPY AND RESTORE


great for RaspberryPi disk imaging and copying.

LOCATE AND UNMOUNT DISK

insert SD card into computer. to see all volumes mounted to machine:

$ diskutil list
@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
@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 / 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;