Skip to content

Instantly share code, notes, and snippets.

blueprint:
name: Lutron Caseta Four Button Pico Actions
description: Short and long press automations for Pico four button remotes.
Release actions will always fire.
Short press actions will fire on button release if long press actions are defined,
and immediately on button press otherwise.
Long press actions will fire on release timeout.
domain: automation
input:
pico_remote:
#if 0
#include <SPI.h>
#include <PN532_SPI.h>
#include "PN532.h"
PN532_SPI pn532spi(SPI, 10);
PN532 nfc(pn532spi);
#elif 1
#include <PN532_HSU.h>
#include <PN532.h>
@micahr
micahr / brighten.js
Created January 13, 2015 08:08
PWM Dimming with Relay
var blaster = require('pi-blaster.js'),
steps = 5,
MIN = 0,
MAX = 400,
MIN_VAL = 0.01,
MAX_VAL = 0.99;
blaster.setPwm(18,0);
blaster.setPwm(17,1);
@micahr
micahr / stoplight.js
Created August 5, 2014 23:41
Build Stoplight
#! /usr/bin/node
var Gpio = require('onoff').Gpio,
request = require('request'),
http = require('http'),
jenkinsUrl = '',
red = new Gpio(17, 'out'),
yellow = new Gpio(18,'out'),
green = new Gpio(27,'out');
@micahr
micahr / meter.js
Last active August 29, 2015 14:04
Response Time Meter
#! /usr/bin/node
var blaster = require('pi-blaster.js'),
_ = require('lodash'),
fs = require('fs'),
request = require('request'),
responseTimeUrl = '';
pin = 18,
RIGHT = 0.07,
LEFT = 0.258,
#helpers.py
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from string import letters, digits
import random
def create_anonymous_user(request, first_name, last_name):
if request and first_name:
# create a random username
"""
The HOSTMAP variable is a dictionary of lists. The keys represent
roles of a server, the values represent the hostnames of machines that
fill those roles. If you are reading this, you likely know what you're
doing. If you don't know what you're doing, you probably want to put
your hostname into local_dev. Ensure it has a comma at the end, and
the hostname is a string.
You can get your hostname by typing `hostname` into a terminal.
"""
"""
Here's my sample Django settings for a project I recently did. Visit http://damonjablons.wordpress.com to see the explanation.
"""
import os
import socket
# Set DEBUG = True if on the production server
if socket.gethostname() == 'your.domain.com':
DEBUG = False
======================================================
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10
======================================================
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu
8.10. The article is targeted at a production environment, but keep in mind
this is a more generalized environment. You may have different requirements,
but this article should at least provide the stepping stones.
The article will use distribution packages where nesscary. As of 8.10 the