Skip to content

Instantly share code, notes, and snippets.

@whitlockjc
whitlockjc / keybase.md
Created Mar 31, 2014
Proving my GitHub for Keybase
View keybase.md

Keybase proof

I hereby claim:

  • I am whitlockjc on github.
  • I am whitlockjc (https://keybase.io/whitlockjc) on keybase.
  • I have a public key whose fingerprint is 9AC5 D0B9 B22B 4294 B2C4 9527 6811 E747 E3DF 6D9D

To claim this, I am signing this object:

View formatted_uptime.sh
uptime | sed 's/,//g' | cut -f 4- -d ' ' | sed 's/ [0-9][0-9]* users .*//' | sed 's/\(.*\):\(.*\)/\1 hours \2 mins/'
@whitlockjc
whitlockjc / frame-geometry.el
Created Jan 15, 2015
Emacs package for storing/restoring window geometry
View frame-geometry.el
;;; frame-geometry.el --- Emacs package for storing/restoring window geometry
(setq frameg-file (expand-file-name "frame-geometry" user-emacs-directory))
(defun save-frameg ()
"Gets the current frame's geometry and saves to ~/.emacs.d/frame-geometry."
(let ((frameg-font (frame-parameter (selected-frame) 'font))
(frameg-left (frame-parameter (selected-frame) 'left))
(frameg-top (frame-parameter (selected-frame) 'top))
(frameg-width (frame-parameter (selected-frame) 'width))
@whitlockjc
whitlockjc / TerminalHelper.scpt
Last active Aug 29, 2015
Better/Working version of TerminalHelper.scpt for Visual Studio Code for Mac
View TerminalHelper.scpt
-- This file resides at /Applications/Visual Studio Code.app/Contents/Resources/app/client/vs/workbench/contrib/debug/bin/TerminalHelper.scpt
on run argv
set working_dir to missing value
set runtimeArgs to missing value
set runtimeName to missing value
set programArgs to missing value
set env_vars to ""
repeat with i from 1 to (count of argv)
set a to (item i of argv)
@whitlockjc
whitlockjc / json-refs-leaning-up.md
Last active Aug 29, 2015
Interesting stuff learned about browserify and lodash while leaning up json-refs.
View json-refs-leaning-up.md

I was recently building a release of json-refs when I realized that the on disk file size was much larger than I expected. I use browserify to build my browser builds since I write json-refs for io.js/node.js. I started looking into the browserify build graph and that is when I noticed something interesting. Below are my findings.

Note: I realize I might be fixing a problem that does not matter and there could even be flaws in how json-refs is using browserify. I also realize that removing lodash is not something you can always do. This is just one of those cases where I wasn't using anything in lodash that wasn't in ES5 and I didn't need json-refs to work in pre-ES5 environments. This is not a hit on lodash, lodash is awesome. Please leave any feedback in the comments.

@whitlockjc
whitlockjc / main.js
Created Dec 12, 2012
Example showing how to use Require.js to load Backbone.js and its dependencies (jQuery and Underscore.js).
View main.js
require.config({
paths: {
jquery: 'libs/jquery/jquery.min',
underscore: 'libs/underscore/underscore.min',
backbone: 'libs/backbone/backbone.min',
bootstrap: 'libs/bootstrap/bootstrap.min'
},
shim: {
'underscore': {
exports: '_'
@whitlockjc
whitlockjc / html-ejs.el
Last active Dec 21, 2015
Use mmm-mode to enable EJS Template highlighting in html-mode
View html-ejs.el
;; ...
;; Use mmm-mode to enable EJS (http://embeddedjs.com) Template highlighting in html-mode
;; Turn on mmm-mode
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
;; mmm-mode class for EJS Templates
(mmm-add-classes
@whitlockjc
whitlockjc / DevelopingAgainstKubernetesOnOSX.md
Last active Jul 26, 2016
Developing Against Kubernetes on OS X
View DevelopingAgainstKubernetesOnOSX.md

When developing against/for Kubernetes, there are two major technologies that you need to have setup:

  • [Docker][docker]
  • [Kubernetes][kubernetes]

I have what I believe to be a very, very simple local development setup using these two technologies that I want to share with you. That being said, let's get started.

Prerequisites

@whitlockjc
whitlockjc / Kubernetes_Authentication_With_UAA.md
Last active Aug 18, 2016
Proof of a post I'm writing for the Apigee blog on using CloudFoundry's UAA for Kubernetes authentication via OIDC.
View Kubernetes_Authentication_With_UAA.md

Kubernetes Authentication with UAA

Recently at Apigee we have started using [Kubernetes][kubernetes] and while working on securing access to it, we learned a few things that we felt could be useful to other Kubernetes consumers. This post will discuss how we were able to use CloudFoundry's [UAA][uaa] as an [OpenID Connect Provider][oidc] for Kubernetes authentication. If you are not using UAA but you are using an [OAuth2][oauth2] provider for your authentication needs, stick around because this post could be useful to you as well.

Note: This post provides background on the process we took and how we successfully wired things up. If you do not care about this and just want to know the steps required to use UAA, and possibly other OAuth 2.0 providers, as an OIDC

@whitlockjc
whitlockjc / local-up-cluster.sh.diff
Last active Jan 10, 2017
Work in progress to get "hack/local-up-cluster.sh" working with a Dockerized "kubelet" on Docker for Mac.
View local-up-cluster.sh.diff
diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh
index 92b13eab89..9a85c463c5 100755
--- a/hack/local-up-cluster.sh
+++ b/hack/local-up-cluster.sh
@@ -22,12 +22,14 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
DOCKER_OPTS=${DOCKER_OPTS:-""}
DOCKER=(docker ${DOCKER_OPTS})
DOCKERIZE_KUBELET=${DOCKERIZE_KUBELET:-""}
+DOCKERIZED_KUBELET_IMAGE=${DOCKERIZED_KUBELET_IMAGE:-"gcr.io/google_containers/kubelet:local-up-cluster"}
ALLOW_PRIVILEGED=${ALLOW_PRIVILEGED:-""}