Skip to content

Instantly share code, notes, and snippets.

$ cat ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.elasticsearch</string>
<key>ProgramArguments</key>
#!/bin/sh
#
# usage: heroku_pg_pull [appname] [local database name]
#
function heroku_pg_pull(){
echo "! WARNING: Data in the local database '$2' will be destroyed."
echo " Type '$2' to overwrite data in local database '$2'"
read -p "> " local_database_name
echo
if [ "$local_database_name" == "$2" ]; then
$ git remote -v
bam git@heroku.com:bam.git (push)
bam git@heroku.com:bam.git (fetch)
$ heroku repo:rebuild -r bam
Running `bash` attached to terminal... up, run.5637
set -e
mkdir -p tmp/repo_tmp/unpack
cd tmp/repo_tmp/unpack
git init --bare .
@khoan
khoan / vimrc
Created October 14, 2014 04:43
set nocompatible
syntax on
filetype indent plugin on
set autoindent softtabstop=2 expandtab shiftround shiftwidth=2
set backspace=indent,eol,start
set relativenumber hidden wildmenu lazyredraw
@khoan
khoan / top3 feed result.md
Last active August 29, 2015 14:16
Top 3 feed processing on 4 Mar 2015 16:07 and 5 Mar 2015 13:43

first import

title does not match for men4418599: Menu bottle grinder set sml ss (existing), Menu bottle grinder set small stainless top (new)
title does not match for e822004: corkscrew guidedsteel black dc (existing), corkscrew steel black (new)
title does not match for n353110: NM krenit bowl orange 38dia3dc (existing), NM krenit bowl orange 38dia (new)
title does not match for 5710498820305: AJ melamine plate A-Z-no W 3dc (existing), AJ melamine plate A-Z (new)
title does not match for aam32-gr: parrot bottle corkscrew green (existing), parrot corkscrew green (new)
title does not match for aam32-az: parrot bottle corkscrew blue (existing), parrot corkscrew blue (new)
title does not match for 8033050833443: niles beach towel 100x180 -170 (existing), niles beach twl 100x180-170 (new)

part one - human kindness

A couple of AFP officers stopped at a property west of Canberra and talked to an old Aboriginal standing on the road. He told the old Aboriginal, "Morning sir, I need to inspect this land for illegally grown drugs." The elder reluctantly said, "okay, but don't go into that field over there...", as he nodded his head towards the location. The AFP officer verbally exploded & said, "Look sir, I have the authority of the federal government with me!". Reaching into his rear back pocket, the AFP officer removed his badge & proudly displayed it to the old Aboriginal. "See this badge?! This badge means I can go wherever I want, whenever I want................on any land! No questions asked, no answers given! Do you understand mate?"

part two - the badge

The elder nodded kindly, apologized & went about his business. Moments later he heard loud - fearful screams; he looked up & saw the AFP officer running for his life, being chased by a large Bull. With every step the Bull was gaini

@khoan
khoan / middleman-build-error.sh
Created May 5, 2015 13:28
unable to build with minify_css activated
$ middleman build
WARN: Unresolved specs during Gem::Specification.reset:
rack (< 2.0, >= 1.4.5)
rack-test (~> 0.6.2)
thor (< 2.0, >= 0.15.2)
activesupport (>= 3.1, ~> 4.1.0)
i18n (>= 0.6.7, ~> 0.6, ~> 0.6.9)
celluloid (>= 0.15.2)
rb-inotify (>= 0.9)
WARN: Clearing out unresolved specs.
RUBY_GC_HEAP_INIT_SLOTS=282533
RUBY_GC_HEAP_FREE_SLOTS=847599
RUBY_GC_HEAP_GROWTH_FACTOR=1.03
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=113013
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=2.0
RUBY_GC_MALLOC_LIMIT=74114549
RUBY_GC_MALLOC_LIMIT_MAX=133406188
RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.32
RUBY_GC_OLDMALLOC_LIMIT=90433854
RUBY_GC_OLDMALLOC_LIMIT_MAX=162780937
@khoan
khoan / spec_elasticsearch_helper.rb
Last active August 29, 2015 14:22
make testing fast by stubbing out any call to elasticsearch cluster unless spec is tagged
# ruby 2.20
#
# gems
# rspec-3.2.0
# webmock-1.18.0
# elasticsearch-extensions-0.0.15
# elasticsearch-persistence-0.1.4
# Rake needs to be loaded for elasticsearch cluster
require 'rake'
@khoan
khoan / smc fan control
Last active August 29, 2015 14:24
start smc fan control for all users
$ cat /Library/LaunchAgents/com.maxfanadjustment.smcfancontrol
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.smcFanControl</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/smcfancontrol.app/Contents/Resources/smc</string>