Skip to content

Instantly share code, notes, and snippets.

View davidmfoley's full-sized avatar

Dave Foley davidmfoley

View GitHub Profile
@davidmfoley
davidmfoley / README.md
Last active August 29, 2015 14:11 — forked from porjo/README.md

Forked from: https://gist.github.com/mmoulton/6224509

Docker stats collection for collectd

This script can be used to feed collectd with cpu and memory usage statistics for running docker containers using the collectd exec plugin.

This script will report the used and cached memory as well as the user and system cpu usage by inspecting the appropriate cgroup stat file for each running container.

Usage

@davidmfoley
davidmfoley / gist:7830876
Created December 6, 2013 19:37
Use ember-runtime in node
diff --git a/app/server/vendor/ember-runtime.js b/app/server/vendor/ember-runtime.js
index e13ae47..f3eda6e 100644
--- a/app/server/vendor/ember-runtime.js
+++ b/app/server/vendor/ember-runtime.js
@@ -10,6 +10,11 @@
// Version: 1.4.0-beta.1+canary.2c163d50
+var ENV = {EXTEND_PROTOTYPES: false};
+var Ember = {ENV: ENV};
@davidmfoley
davidmfoley / test.coffee
Created March 5, 2013 17:59
Coffeescript 1.6.1 bug
class Foo
'bar:baz' : =>
new Foo
@davidmfoley
davidmfoley / fetch.sh
Created September 6, 2012 14:59
update git repos in all subdirectories
DIR=$( cd "$( dirname "$0" )" && pwd )
pushd $DIR
for d in `ls -d */`
do
echo "$d"
pushd "$d" > /dev/null
git remote update --prune
popd > /dev/null
done
popd > /dev/null
@davidmfoley
davidmfoley / mocha-lint.rb
Created August 8, 2012 19:20
Detect indentation errors in mocha coffeescript specs
#! /usr/bin/env ruby
current_filename = ''
allowed_indent = 0
def indent_of line
line.index /[a-z]/
end
ARGF.lines do |line|
@davidmfoley
davidmfoley / gist:3260110
Created August 4, 2012 21:38
rake spec on RubyMotion Hello World app
$ rake spec
Build ./build/iPhoneSimulator-5.1-Development
Simulate ./build/iPhoneSimulator-5.1-Development/Hello_spec.app
Application 'Hello'
- has one window [FAILED]
Bacon::Error: 0.==(1) failed
spec.rb:553:in `satisfy:': Application 'Hello' - has one window
spec.rb:567:in `method_missing:'
spec.rb:183:in `block in run_spec_block'
@davidmfoley
davidmfoley / gist:3041435
Created July 3, 2012 18:04 — forked from re5et/gist:3036720
JavaScript Window global var differ.
var Differ = function(thing){
this.thing = thing;
};
Differ.prototype.cacheVars = function(){
this.cache = {};
for(var prop in this.thing){
this.cache[prop] = this.thing[prop];
}
};
@davidmfoley
davidmfoley / gist:2955240
Created June 19, 2012 16:53
macys.com customer support chat
I received an email from macys.com to an email address that I never use (an email address provided by my ISP),
regarding my macys.com account. After changing the passwords on both the email account and the macys.com account,
I attempted to find a way to alert their credit card department of at worst, potential fraud, and at best, an
incorrect email address in one of their customer records. Unable to submit a "contact us" because I didn't have
the account number (which is masked on the site), and not wanting to sit on hold on the telephone, I figured,
what the hell, I'll give the chat support a go...
Chat Transcript
Please wait while we find an agent to assist you...
@davidmfoley
davidmfoley / gist:2931107
Created June 14, 2012 15:50
summarize git commits and lines changed by author
git log --shortstat -C | awk '/Author:/ {author = $NF; if (!(author in lines)) {authors[length(authors)] = author; lines[author] = 0; commits[author] = 0} } /files changed/ {lines[author] += ($4 + $6); commits[author]++} END {for (i =0; i < length(authors); i++) {printf "%s lines in %s commits - %s\n", lines[authors[i]],commits[authors[i]], authors[i]}}' |sort -n -r
@davidmfoley
davidmfoley / octopress_heroku_publish.sh
Created May 18, 2012 16:20
Deploy octopress to heroku without crufting your repo with generated files
#! /bin/sh
# For octopress/heroku: generate site, deploy, and tag as "deploy-yyyy-mm-dd"
# This allows you to keep your public/ assets out of git,
# and only add them just before deploying
BRANCH=`git symbolic-ref -q HEAD | sed 's/refs\/heads\///'`
SHA=`git rev-parse --short HEAD`