Skip to content

Instantly share code, notes, and snippets.

View sidwarkd's full-sized avatar
🌮
Smart Puck'in

Kevin Sidwar sidwarkd

🌮
Smart Puck'in
View GitHub Profile
@sidwarkd
sidwarkd / twilio.json
Created December 10, 2016 07:58
Particle Webhook Config File Template for Twilio Integration
{
"eventName": "[EVENT TO LISTEN FOR]",
"url": "https://api.twilio.com/2010-04-01/Accounts/[ACCOUNT SID]/Messages",
"requestType": "POST",
"auth": {
"username": "[ACCOUNT SID]",
"password": "[AUTH TOKEN]"
},
"form": {
"From" : "[YOUR TWILIO NUMBER]",
@sidwarkd
sidwarkd / fridgeye_nextion.ino
Created December 1, 2016 08:33
Arduino Sketch for Fridgeye App on Nextion Display
// Include the Nextion Arduino library
#include "Nextion.h"
long lastUpdate;
int SENSOR = A0; // Alias A0 as SENSOR
// t0 element from the Nextion GUI Editor was on
// page 0 with an id of 2.
NexText t0 = NexText(0, 2, "t0");
@sidwarkd
sidwarkd / server.js
Last active December 11, 2016 19:17
Simple Node Server For Onion Omega
const http = require('http');
const hostname = '0.0.0.0';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello from the Onion Omega\n');
});
@sidwarkd
sidwarkd / Observable.cs
Created May 11, 2016 22:12
Observable Class for UWP Data Binding
public class Observable : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void Changed([CallerMemberName]string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
@sidwarkd
sidwarkd / config.json.sample
Created April 1, 2015 13:17
Competitor to the Amazon Dash
{
"sparkAccessToken": "",
"sparkDeviceID": "",
"twilioAccountSID": "",
"twilioAuthToken": "",
"toPhoneNumber": "[NUMBER TO CALL]",
"fromPhoneNumber": "[YOUR TWILIO NUMBER]",
"paperTowelTwiml": "[URL TO TWIML FILE. DROPBOX WORKS GREAT]"
}
@sidwarkd
sidwarkd / example.cs
Created March 16, 2015 19:35
A super simple way to get the list of project files from a Visual Studio Solution file.
public static void GetProjectFilesFromSolution(string solutionFile)
{
if (File.Exists(solutionFile))
{
string cwd = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(solutionFile));
// This is a hack for reading solution files but is better than the almost 100 lines of code
// necessary to load a special MS assembly and parse the file the 'right way'
string[] solutionContents = File.ReadAllLines(solutionFile);
@sidwarkd
sidwarkd / hcidump.log
Created February 5, 2015 17:34
Logs for BLE issue with Bleno
HCI sniffer - Bluetooth packet analyzer ver 2.4
device: hci0 snap_len: 1028 filter: 0xffffffff
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x0c
Error: Command Disallowed
> HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x00
> HCI Event: Command Complete (0x0e) plen 4
@sidwarkd
sidwarkd / edison_pins.json
Last active August 29, 2015 14:13
Descriptive JSON of Edison Mini Breakout Pins
[
{
"jumper": 17,
"pin": 1,
"name": "GP182_PWM2",
"description": "GPIO capable of PWM output.",
"tags": ["gpio", "pwm"]
},
{
"jumper": 17,
@sidwarkd
sidwarkd / www
Last active August 29, 2015 14:03
A Physical Yo Button
#!/usr/bin/env node
var app = require('../app');
var io = null;
app.set('port', process.env.PORT || 3000);
app.get('/new', function(req, res){
io.emit('yoReceived', req.query.username);
res.json(req.query);
});
@sidwarkd
sidwarkd / pinode_stats.js
Last active August 29, 2015 13:58
Nodes JS module for getting simple runtime info from the Raspberry Pi
'use strict'
// An example of accessing system information on the Raspberry Pi with NodeJS
var fs = require('fs');
var PiStats = function(){
var stats = {};
var _currentCPUInfo = {total:0, active:0};
var _previousCPUInfo = {total:0, active:0};