Skip to content

Instantly share code, notes, and snippets.

View richardkmichael's full-sized avatar

Richard Michael richardkmichael

  • 23:51 (UTC -08:00)
View GitHub Profile
@richardkmichael
richardkmichael / .blade.yml
Last active March 5, 2021 16:39
Sprockets 3.6 CoffeeScript processor with sourcemaps.
load_paths:
- src
logical_paths:
- simple.js
build:
logical_paths:
- simple.js
path: dist
@richardkmichael
richardkmichael / pickle-jsonPickle.py
Created February 6, 2019 00:51
Using jsonpickle instead of pickle has benefits.
# jsonpickle is human readable for inspection (security, etc.) before unpickling.
# It is smaller, when native.
#
# 246099 cd33.jpkl
# 1432509 cd33.pkl
#
# 241K cd33.jpkl
# 1.4M cd33.pkl

KVM OSX Guest 10.11 (El Capitan) with Clover

  • Some notes about this approach:
    • An OSX Installer USB drive for Install OS X El Capitan is created
    • Clover is then installed on the USB drive
    • Clover Configurator is then run on the USB drive
    • The USB drive contents are copied to the VM host
    • VNC is used to connect to the guest UI
  • The qxl virtual video device is used (part of the standard kvm qemu install)
@richardkmichael
richardkmichael / gist:c3f9251630f7da63fbe7
Created August 24, 2015 19:25
Broken DateTime based Range#include?
[38] pry(main)> RUBY_DESCRIPTION
=> "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin12.0]"
[41] pry(main)> d = "2015-01-01"
=> "2015-01-01"
# Broken Range#include? with DateTime objects, they don't understand the time portion of the day.
[42] pry(main)> n = DateTime.parse "#{d} 9am"
=> #<DateTime: 2015-01-01T09:00:00+00:00 ((2457024j,32400s,0n),+0s,2299161j)>
@richardkmichael
richardkmichael / bash-completion-notes.md
Last active August 29, 2015 14:24
Install bash-completion:master for `shopt -s failglob` with TAB-completion.

bash-completion:master has fixes for TAB-completion breakage when using shopt -s failglob (helpful with shopt -s dotglob).

$ ls -l bash: no match: words[0]=${!ref}${COMP_WORDS[i]}

Unfortunately, Homebrew's bash-completion will always use version 1.3, pinned because of OSX pinning to bash 3.2.x. Also, the homebrew-version/bash-completion2 package is 2.1, which is very old.

So, let's quickly install bash-completion from source until we have time to fix homebrew.

#!/bin/bash
# Post-update hook, it receives a list of updated refs on STDIN ($@); including tags.
# -e = exit if any command exits non-zero ; -u exit if undefined variable name ; -o pipefail
set -euo pipefail
GIT_DIR="$( readlink -nf ${PWD} )"
REPO_NAME="$( basename ${GIT_DIR} .git )"
DEPLOY_LOG_DIR="${GIT_DIR}/../deploy-logs"
/*
Creates a computed property that persists into local storage, all
instances share the same value for the same property.
App.AuthController = Ember.Controller.extend({
token: Em.computed.stored()
});
controller = App.__container__.lookup('controller:auth')
contorller.set('token', 'abc123foo456bar')

Ember.Console

This is a set of helpers for finding the application's currently active models/routes/controllers/etc. This isn't a straightforward process because of how Ember (rightly) encapsulates application objects, but it's useful in debugging environments to be able to quickly access them. And with the beta release of Ember Data, the store is not easily accessible without helpers either.

Usage

All helpers can be called directly if you provide them an application instance:

#!/bin/bash
#
# pgpool-II replication manager
#
# Interfaces with pgpool's pcp command-line tools to provide access to common functions for managing
# load-balancing and failover.
#
# [email protected]
# 2011-08-28
@richardkmichael
richardkmichael / config.rb
Last active August 29, 2015 13:58
RBX compile with clang/clang++ fail.
module Rubinius
config = {}
config[:build_tool_gems] = [["rubinius-ast", "2.1.2"], ["rubinius-compiler", "2.1.0"], ["rubinius-melbourne", "2.1.0.0"], ["rubinius-processor", "2.1.1"], ["rubinius-toolset", "2.2.0"]]
config[:build_c_ext_gems] = [["ffi2-generators", "0.1.1"], ["rubysl-etc", "2.0.3"], ["rubysl-fileutils", "2.0.3"], ["rubysl-mkmf", "2.0.1"], ["rubysl-shellwords", "2.0.0"]]
config[:bootstrap_gems] = [["rubysl-date", "2.0.6"], ["rubysl-delegate", "2.0.1"], ["rubysl-digest", "2.0.3"], ["rubysl-etc", "2.0.3"], ["rubysl-fcntl", "2.0.4"], ["rubysl-fileutils", "2.0.3"], ["rubysl-monitor", "2.0.0"], ["rubysl-openssl", "2.1.0"], ["ruby
sl-optparse", "2.0.1"], ["rubysl-stringio", "2.0.0"], ["rubysl-strscan", "2.0.0"], ["rubysl-tempfile", "2.0.1"], ["rubysl-thread", "2.0.2"], ["rubysl-tmpdir", "2.0.1"], ["rubysl-uri", "2.0.0"], ["rubysl-yaml", "2.0.4"], ["rubysl-zlib", "2.0.1"]]
config[:runtime_gems] = [["json", "1.8.1"], ["rake", "10.2.2"], ["rdoc", "4.1.1"], ["ffi2-generators", "0.1.1"], ["rubiniu