Skip to content

Instantly share code, notes, and snippets.

View mac-idempotent-setup.sh
#!/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
@shortjared
shortjared / serverless.yml
Created Jun 15, 2017
sensitive env vars passed as params
View serverless.yml
# 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
View algolia-sync.rb
#!/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 / aws-lambda-cron-webhooks.js
Last active Jun 2, 2017
AWS Lambda Scheduled Webhook Calls
View aws-lambda-cron-webhooks.js
const http = require('http');
const https = require('https');
var webhookURLs = {
// Every minute
'* * * * *': [
'http://requestb.in/testing-here'
],
// Every half hour
View keybase.md

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 / instructions.md
Created Jul 19, 2015
InfluxDB - Ubuntu Install / Setup (as of V0.9.1)
View instructions.md

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
@shortjared
shortjared / aws-cli-install.sh
Created Jun 23, 2015
S3 Sourced Config Example
View aws-cli-install.sh
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 / notes.md
Last active Aug 29, 2015
Telegraf-Ubuntu-InfluxDB Notes
View notes.md

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 / RecipeApi.php
Last active Dec 30, 2015
API for Recipe Website, user validation.
View RecipeApi.php
<?php
class RecipeApi extends \Restful {
// /**
// * Don't wrap output in `{"success":bool,"data":"..."}`.
// */
var $wrap = false;
// /**
// * Create a new recipe or ingredient.
@shortjared
shortjared / server.rb
Last active Dec 21, 2015
A simple example of continuously reading from a serial based device and using websockets to send data to all registered clients on the server.
View server.rb
# 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)