Skip to content

Instantly share code, notes, and snippets.

🌮
Smart Puck'in

Kevin Sidwar sidwarkd

🌮
Smart Puck'in
Block or report user

Report or block sidwarkd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sidwarkd
sidwarkd / medals.py
Created Feb 20, 2014
Tracking Olympic Medals with the Raspberry Pi
View medals.py
import sys, urllib
from time import sleep
import spidev
def spi_send(bus, data):
xfer_list = []
if type(data) == str:
for c in data:
xfer_list.append(ord(c))
elif type(data) == list:
@sidwarkd
sidwarkd / hardware.py
Created Mar 18, 2014
Streaming temperature readings with Plot.ly, TMP106, and Raspberry Pi
View hardware.py
import RPi.GPIO as GPIO
import spidev
from time import sleep, localtime, strftime, time
import sys
import smbus
class PiHardware(object):
def __init__(self):
@sidwarkd
sidwarkd / pinode_stats.js
Last active Aug 29, 2015
Nodes JS module for getting simple runtime info from the Raspberry Pi
View pinode_stats.js
'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};
@sidwarkd
sidwarkd / www
Last active Aug 29, 2015
A Physical Yo Button
View www
#!/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 / edison_pins.json
Last active Aug 29, 2015
Descriptive JSON of Edison Mini Breakout Pins
View edison_pins.json
[
{
"jumper": 17,
"pin": 1,
"name": "GP182_PWM2",
"description": "GPIO capable of PWM output.",
"tags": ["gpio", "pwm"]
},
{
"jumper": 17,
@sidwarkd
sidwarkd / hcidump.log
Created Feb 5, 2015
Logs for BLE issue with Bleno
View hcidump.log
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 / example.cs
Created Mar 16, 2015
A super simple way to get the list of project files from a Visual Studio Solution file.
View example.cs
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 / .gitignore
Created Nov 27, 2011
Very basic Node.js app using MongoLab and Heroku
View .gitignore
node_modules
@sidwarkd
sidwarkd / config.json.sample
Created Apr 1, 2015
Competitor to the Amazon Dash
View config.json.sample
{
"sparkAccessToken": "",
"sparkDeviceID": "",
"twilioAccountSID": "",
"twilioAuthToken": "",
"toPhoneNumber": "[NUMBER TO CALL]",
"fromPhoneNumber": "[YOUR TWILIO NUMBER]",
"paperTowelTwiml": "[URL TO TWIML FILE. DROPBOX WORKS GREAT]"
}
@sidwarkd
sidwarkd / gist:6303353
Created Aug 22, 2013
Bookmarklet To Extend Tweet Menu
View gist:6303353
$("ul.tweet-actions").each(function(index){
$(this).prepend('<li><a role="button" class="my-custom-link" class="js-tooltip" href="#"><b>My Option</b></a></li>');
});
$(".my-custom-link").click(function(evt){
evt.preventDefault();
var el = $(evt.target) || $(evt.srcElement);
var tweetText = el.closest(".content").find("p.tweet-text").first().text();
alert("This is the text from the tweet that you can use for something:\n\n" + tweetText);
});
You can’t perform that action at this time.