Skip to content

Instantly share code, notes, and snippets.

View jwthomp's full-sized avatar

Jeff Thompson jwthomp

View GitHub Profile
@jwthomp
jwthomp / kubecontext.1s.py
Last active March 5, 2020 16:50
kubecontext.1s.py Update to work
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <bitbar.title>Kubeconfig Context Changer</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Chris Opland</bitbar.author>
# <bitbar.author.github>copland</bitbar.author.github>
# <bitbar.desc>Displays active kubeconfig context and allows you to easily change contexts.</bitbar.desc>
# <bitbar.dependencies>python,kubectl</bitbar.dependencies>
@jwthomp
jwthomp / ViewMemory.sh
Created December 7, 2016 18:02
View memory on OS X from cli
Place in .profile
ViewMemory() {
vm_stat | perl -ne '/page size of (\d+)/ and $size=$1; /Pages\s+([^:]+)[^\d]+(\d+)/ and printf("%-16s % 16.2f Mi\n", "$1:", $2 * $size / 1048576);'
}
alias free=ViewMemory
@jwthomp
jwthomp / Main.elm
Created May 16, 2016 01:03
Main.elm
import Html exposing (..)
import Html.App exposing (beginnerProgram, program)
import Html.Events exposing (onClick)
import Task
import Debug
type alias Model = Int
type Msg
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import Html.App
type alias Model = Int
type Msg = Increment | Decrement
update : Msg -> Model -> Model
# Switch prefix from C-b to C-b
set -g prefix C-a
unbind C-b
# Update delay time to be very short
set -s escape-time 1
# Set the base-index to 1 instead of 0, so we can use prefix 1 to get to the first window
set -g base-index 1
setw -g pane-base-index 1
/*----------------------------------
* Kefir.Bus
*/
var Bus = function() {
Kefir.Pool.call(this);
}
Bus.prototype = Object.create(Kefir.Pool.prototype);
Bus.prototype.constructor = Bus;
Bus.prototype.push = function(x) {
@jwthomp
jwthomp / test2.js
Created October 1, 2015 22:05
Bacon.js component playground
var Bacon = require("./vendor/Bacon.min.js");
var GameObject = function() {
this.bus = new Bacon.Bus();
this.eventStreams = [];
this.eventHandlers = [];
this.data = {};
}
GameObject.prototype.registerEventType = function(eventType) {
@jwthomp
jwthomp / designer.html
Created April 30, 2015 15:36
designer
<link rel="import" href="../ace-element/ace-element.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@jwthomp
jwthomp / gist:2400439
Created April 16, 2012 18:11
simple noir server
(ns dungeonverse.core
(:use noir.core)
(:require [noir.server :as server]))
(def the-server (atom nil))
(defpage "/welcome" []
"Welcome to Noir!")
(defn start [] (reset! the-server (server/start 8080 [:base-url "stf.gameoire.com"])))
@jwthomp
jwthomp / monad.erl
Created January 25, 2012 04:46
Erlang Monad
-module(monad).
-export([ monad_context/2, putst/1, getst/0, lift/0, return/1 ]).
-export([ test/0 ]).
%%%%%%%%%%%%%%%%%%%%% Erlang Monad %%%%%%%%%%%%%%%%%%%%%%
%% Working on a simple monad implementation for Erlang %%
%% %%
%% Just for fun I tried whipping up a simple erlang %%
%% monad. It uses the process dictionary and I haven't %%
%% implemented lift and many children of a monad state %%