Skip to content

Instantly share code, notes, and snippets.

@shortjared
shortjared / server.rb
Last active December 21, 2015 23:58
A simple example of continuously reading from a serial based device and using websockets to send data to all registered clients on the server.
# coding: utf-8
require 'sinatra'
require 'sinatra-websocket'
require 'serialport'
set :server, 'thin'
set :sockets, []
## Setup to read from your device via serial port
ser = SerialPort.new("/dev/your_device", 9600, 8, 1, SerialPort::NONE)
@shortjared
shortjared / RecipeApi.php
Last active December 30, 2015 20:39
API for Recipe Website, user validation.
<?php
class RecipeApi extends \Restful {
// /**
// * Don't wrap output in `{"success":bool,"data":"..."}`.
// */
var $wrap = false;
// /**
// * Create a new recipe or ingredient.
@shortjared
shortjared / notes.md
Last active August 29, 2015 14:23
Telegraf-Ubuntu-InfluxDB Notes

Ubuntu (Because Ubuntu is life)

Install Current Version of Influx DB As of writing... 0.9 https://influxdb.com/download/index.html

wget https://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb 
sudo dpkg -i influxdb_latest_amd64.deb 
@shortjared
shortjared / aws-cli-install.sh
Created June 23, 2015 13:41
S3 Sourced Config Example
apt-get install -y zip unzip && \
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && \
unzip awscli-bundle.zip && \
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
@shortjared
shortjared / instructions.md
Created July 19, 2015 23:36
InfluxDB - Ubuntu Install / Setup (as of V0.9.1)

Get and Install Latest Version of InfluxDb

wget http://influxdb.s3.amazonaws.com/influxdb_0.9.1_amd64.deb
sudo dpkg -i influxdb_0.9.1_amd64.deb

Add influx to path, because package install doesn't do it for some stupid reason

PATH=$PATH:/opt/influxdb

Keybase proof

I hereby claim:

  • I am shortjared on github.
  • I am jshort (https://keybase.io/jshort) on keybase.
  • I have a public key ASBPLqR8Mvup923TTaN06a7nnjghxddDT7SE1uB3vQtJNQo

To claim this, I am signing this object:

@shortjared
shortjared / aws-lambda-cron-webhooks.js
Last active June 2, 2017 17:44
AWS Lambda Scheduled Webhook Calls
const http = require('http');
const https = require('https');
var webhookURLs = {
// Every minute
'* * * * *': [
'http://requestb.in/testing-here'
],
// Every half hour
#!/usr/bin/env ruby
require 'json'
require 'algoliasearch'
# Copy the algolia from prior commit to a tmp file for comparison
`git show $(git rev-parse HEAD~1):algolia.json > old-algolia.json`
current_algolia = JSON.parse(File.read('algolia.json'))
old_algolia = JSON.parse(File.read('old-algolia.json'))
@shortjared
shortjared / serverless.yml
Created June 15, 2017 18:33
sensitive env vars passed as params
# serverless.yml
service:
name: myService
awsKmsKeyArn: arn:aws:kms:us-east-1:XXXXXX:key/some-hash # Optional KMS key arn which will be used for encryption for all functions
frameworkVersion: ">=1.0.0 <2.0.0"
provider:
name: aws
#!/bin/sh
# Install Homebrew
which brew > /dev/null 2>&1
if [ $? -eq 1 ]; then
#Cheat, if we don't have brew, install xcode command line utils too
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else