Skip to content

Instantly share code, notes, and snippets.

@ecaron
ecaron / Rbenv failing on Vagrant+Fusion
Created January 6, 2014 06:29
This is a dump of the error from puppet/Vagrant that our Mac developers are getting when using Vagrant with VMWare Fusion. The problem is resolvable by changing rbenv's cflags to none.
Notice: /Stage[main]//Rbenv::Plugin[sstephenson/ruby-build]/Exec[install-sstephenson/ruby-build]/returns: executed successfully
Notice: /Stage[main]//Rbenv::Plugin[sstephenson/ruby-build]/Exec[rbenv-permissions-sstephenson/ruby-build]: Triggered 'refresh' from 1 events
Notice: /Stage[main]/Rbenv/File[/etc/profile.d/rbenv.sh]/ensure: defined content as '{md5}1895fedb6a7fdc5feed9b2cbbb8bbb60'
Notice: /Stage[main]//Rbenv::Build[2.0.0-p247]/Exec[own-plugins-2.0.0-p247]/returns: executed successfully
Notice: /Stage[main]//Rbenv::Build[2.0.0-p247]/Exec[git-pull-rubybuild-2.0.0-p247]/returns: executed successfully
Notice: /Stage[main]//Rbenv::Build[2.0.0-p247]/Exec[rbenv-install-2.0.0-p247]/returns: Downloading ruby-2.0.0-p247.tar.gz...
Notice: /Stage[main]//Rbenv::Build[2.0.0-p247]/Exec[rbenv-install-2.0.0-p247]/returns: -> http://dqw8nmjcqpjn7.cloudfront.net/c351450a0bed670e0f5ca07da3458a5b
Notice: /Stage[main]//Rbenv::Build[2.0.0-p247]/Exec[rbenv-install-2.0.0-p247]/returns: Installing ruby-2.0.0-p247...
Notice:
@ecaron
ecaron / gist:9736a8815093931da212
Created June 11, 2014 19:44
Simple bash script for Firefox+Linux+SSH
#!/bin/bash
url=$1
protocol=${url//:*/}
machine=${url//*:\/\//}
machine=${machine%/}
/usr/bin/gnome-terminal -e "$protocol $machine"
@ecaron
ecaron / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
require "optparse"
require "uri"
require "net/http"
###
# This script is taken from http://samsaffron.com/archive/2013/11/13/live-restarts-of-a-supervised-unicorn-process
# It has been modified from the original to:
# 1) Have more intelligent validation of the URL
# 2) Support HTTPS requests
# 3) Colorized output based on type of request
@ecaron
ecaron / cssh-ec2-connector.sh
Last active August 29, 2015 14:15
Dynamic shell script to use cssh to connect to multiple EC2 boxes by tag-name, via AWS CLI
#!/bin/bash
# Requirements:
# * AWS CLI installed and activated
# * cssh installed
#
# Usage:
# * Run "cssh-ec2-connector.sh some-tag-name" to have system open windows to all instances
# * Edit the ec2Tags array to have a list of frequently used instances for repeat use
[
{"name":"productsActive",
"description":"All our products except something and something",
"frequency":"daily",
"xmlPath":" https://api.bestbuy.com/bulk/v2/products/productsActive.xml.tar.gz",
"jsonPath":" https://api.bestbuy.com/bulk/v2/products/productsActive.json.tar.gz"
},
{"name":"productsActiveDigital",
"description":"All current digital downloads",
"frequency":"daily",
@ecaron
ecaron / productsActive.head
Created January 7, 2016 20:39
HEAD productsActive.json.tar.gz
HTTP/1.1 200 OK
Date: Thu, 31 Dec 2015 06:00:33 GMT
Expires: Thu, 31 Dec 2015 12:00:33 GMT
Last-Modified: Thu, 31 Dec 2015 05:00:33 GMT
Content-type: application/x-gzip
Content-Length: 3148141412
// Code for V2
var sendgrid = require('sendgrid')(sendgrid_api_key);
sendgrid.send({
to: 'example@example.com',
from: 'other@example.com',
subject: 'Hello World',
text: 'My first email through SendGrid.'
}, function(err, json) {
if (err) { return console.error(err); }
console.log(json);
@ecaron
ecaron / button.py
Created July 31, 2016 20:59
Python script for listening to Raspberry Pi button push
import requests
import time
import RPi.GPIO as GPIO
url = 'http://nightlight/' # I map this to my internal DNS hosting the node app
gpio_pin=18 # The GPIO pin the button is attached to
longpress_threshold=5 # If button is held this length of time, tells system to leave light on
GPIO.setmode(GPIO.BCM)
GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
'use strict';
if (!process.env.API_KEY) {
console.warn('API_KEY must be defined as an environment variable');
process.exit();
}
var bby = require('bestbuy')(process.env.API_KEY);
var async = require('async');
var _ = require('lodash');