Skip to content

Instantly share code, notes, and snippets.

@EyePulp
EyePulp / Vagrantfile
Created September 20, 2013 16:12
Vagrantfile error
Vagrant.configure("2") do |config|
config.vm.synced_folder File.dirname(__FILE__)+'/../', "/vagrant-project/"
config.vm.define "project_foo" do |app|
app.vm.box = "precise64"
app.vm.box_url = "http://files.vagrantup.com/precise64.box"
@EyePulp
EyePulp / autossh.yaml
Created November 8, 2013 22:31
Wondering about variable scopes -- If I include the same playbook (autossh.yaml, as seen below) twice, what is the scope of the variables defined with each call? Would the second include call continue to have all the values defined from the first call? e.g. would the second include in playbook.yaml have a defined or undefined value for AUTOSSH_P…
---
# set up an ssh tunnel
# using the following variables
# {{AUTOSSH_PUBLIC_KEY_SRC}}
# {{AUTOSSH_PUBLIC_KEY_DEST}}
# {{AUTOSSH_PRIVATE_KEY_SRC}}
# {{AUTOSSH_PRIVATE_KEY_DEST}}
# {{AUTOSSH_UPSTART_SRC}}
# {{AUTOSSH_UPSTART_DEST}}
# {{AUTOSSH_UPSTART_SERVICE}}
define([], function() {
/* See also: "Learning Javascript Design Patterns" by Addy Osmani
* http://addyosmani.com/resources/essentialjsdesignpatterns/book/
*
* for examples on how to use pubsub as event aggregator (Mediator)
*
*/
var pubsub = function(){};
(function(q) {
var topics = {}, subUid = -1;
@EyePulp
EyePulp / resin.img.burner.sh
Created September 10, 2015 21:44
Make resin.io SD image burning a little less painful on a Mac
#!/bin/bash
echo "------------------------------------------------------------------------"
if [[ "$#" -ne 2 ]]; then
echo "IMG Burner -- Built for macbook pros w/ the SD card slot on the right."
echo " - Insert a blank SD card"
echo " - run with two args - img file and destination disk (typically disk2, disk3, etc. NEVER disk1 or sda1)"
echo " - run $ mount to see what disks are available"
echo " - Example: $ ./resin.img.burn.sh path/to/resin.img disk2"
exit
fi
@EyePulp
EyePulp / create_table_query_from_redshift_table.sql
Last active August 29, 2016 23:17
Create a viable copy of a table schema for moving redshift table data between DB's -- doesn't copy secondary index details (would be nice to get it improved to do that though) Edit the "source_table_name" string at the bottom to the table you want the structure for. This script DOES NOT create the table - merely creates the SQL statement necessa…
select pk.pkey, tm.schemaname||'.'||tm.tablename, 'create table '||tm.schemaname||'.'||tm.tablename
||' ('
||cp.coldef
-- primary key
||decode(pk.pkey,null,'',pk.pkey)
-- diststyle and dist key
||decode(d.distkey,null,')\n diststyle '||dist_style||' ',d.distkey)
--sort key
|| (select decode(skey,null,'',skey) from (select