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 / .gitignore
Created November 27, 2011 03:35
Very basic Node.js app using MongoLab and Heroku
node_modules
@sidwarkd
sidwarkd / gist:6303353
Created August 22, 2013 04:56
Bookmarklet To Extend Tweet Menu
$("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);
});
@sidwarkd
sidwarkd / isgovtdown.py
Last active December 24, 2015 14:39 — forked from eduardkoller/isgovtdown.py
Modified to add command line option for running on a Raspberry Pi using GPIO 17 and 18 to control status LEDs. Run from the command line with the argument "pi" to activate status LEDs. Assumes you have already installed the RPi.GPIO library.
#!/usr/bin/env python
#
# file: isgovtdown.py
#
# description: checks usa.gov for the "Government has shut down" message
#
# usage: ./isgovtdown.py [pi]
# Passing argument 'pi' causes status LEDs to be used
#
# or in a crontab:
@sidwarkd
sidwarkd / medals.py
Created February 20, 2014 07:38
Tracking Olympic Medals with the Raspberry Pi
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 / pi_stats.js
Last active December 22, 2023 14:23
Python and NodeJS example code for getting memory and cpu usage information on the Raspberry Pi
'use strict'
// A very simple nodeJS script that demonstrates how you can access
// memory usage information similar to how free -m works on the
// Raspberry Pi. Goes with µCast #14. http://youtu.be/EqyVlTP4R5M
// Usage: node pi_mem.js
// Example Output
//
@sidwarkd
sidwarkd / hardware.py
Created March 18, 2014 05:32
Streaming temperature readings with Plot.ly, TMP106, and Raspberry Pi
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 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};
@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 / 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 / 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