Skip to content

Instantly share code, notes, and snippets.

View tkellen's full-sized avatar
👽
out there

Tyler Kellen tkellen

👽
out there
View GitHub Profile
@tkellen
tkellen / gist:f796539baedcf0c1a001
Last active August 29, 2015 14:15
grunt-runner
var runner = require('grunt-runner');
var concat = require('grunt-contrib-concat');
var config = {
src: 'path/to/src',
concat: {
targetOne: {
src: '<%= src %>/one/*.js',
dest: 'output1.js'
},
targetTwo: {
const _ = require('lodash');
const depMap = require('./depmap');
function depMapper (table) {
var deps = depMap[table].reverse();
return _.uniq(_.chain(deps).reduce(function (result, dep) {
result.push(depMapper(dep));
return result;
}, []).flatten().value().concat(deps));
};
@tkellen
tkellen / poller.sh
Created April 2, 2015 19:29
poll for something and exit when good
#!/bin/bash
POLL_INTERVAL=1
TIMEOUT_COUNT=5
COUNTER=1
FILE="stop.txt"
printf "waiting for stop.txt to appear"
while true; do
@tkellen
tkellen / gist:df0421ca8a888029f243
Created May 8, 2015 20:31
wrap a method so it can be cancelled
function cancellable(fn) {
var cancelled = false;
var wrapped = function() {
if (!cancelled) {
fn.apply(null, arguments)
}
};
wrapped.cancel = function() {
cancelled = true;
};
@tkellen
tkellen / gist:1179334
Created August 29, 2011 20:32
fixed height header 100% iframe
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>whatever</title>
<style type="text/css">
html,body { overflow:hidden; height: 100%; margin:0; padding:0; }
#top { position:fixed; height:40px; width:100%; background-color:#000 }
</style>
</head>
@tkellen
tkellen / gist:2206123
Created March 26, 2012 15:54
requirejs library for node and browser with and without amd
(function(global, define) {
var loader = false;
// detect if there is an amd loader on the global namespace
if(typeof global.define === 'function') {
loader=true;
}
{{ALMOND_SHIMMED_LIBRARY}}
if(typeof module !== 'undefined' && module.exports) {
@tkellen
tkellen / gist:2888811
Created June 7, 2012 13:28
function pointer in c
// this code will run mode_one once, then mode_two forever.
#include <stdio.h>
// a pointer to the mode you want to call
void (*modePtr)();
// function prototypes
void mode_one();
void mode_two();
@tkellen
tkellen / Tyler.prg
Created October 13, 2015 12:55
My first program
** Tyler's A.K.A. Hobbes First Program
** File Name: Tyler.Prg
SET STATUS OFF
SET SCOREBOARD OFF
SET TALK OFF
** Section To name memory variables
name=space(25)
male=.t.
@tkellen
tkellen / pr.py
Created December 19, 2015 21:05
simple dynamic inventory file for hookshot / ansible integration
#!/usr/bin/env python
import sys
import os
try:
import json
except ImportError:
import simplejson as json
@tkellen
tkellen / all.yml
Created January 31, 2016 15:55
ansible bastion host configuration via extra-vars
host_key_checking: true
host_key_checking_option: "{{ (host_key_checking == true) | ternary('','-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no') }}"
bastion_host: false
bastion_user: "{{ lookup('env', 'USER') }}"
bastion_ssh_arg: -o ProxyCommand='ssh {{host_key_checking_option}} -W %h:%p -q {{bastion_user}}@{{bastion_host}}' {{host_key_checking_option}}
ansible_ssh_extra_args: "{{ bastion_host | ternary(bastion_ssh_arg, '') }}"