Skip to content

Instantly share code, notes, and snippets.

@slashk
slashk / color-renderlet.js
Created February 14, 2014 13:55
John's Color renderlet
var colorRenderlet = function (_chart) {
function setAttr(selection, keyName) {
selection.style("fill", function (d) {
if (d[keyName] == "Apples")
return "red";
else if (d[keyName] == "Kiwis")
return "green";
else if (d[keyName] == "Lemons")
return "yellow";
@slashk
slashk / gist:6f83b02cff880dbad2b3
Created March 25, 2015 18:57
regression in docker-machine 0.2
$ docker-machine --version
docker-machine version 0.2.0 (5575c6d)
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
builder virtualbox Running tcp://192.168.99.100:2376
dev virtualbox Stopped
$ docker-machine -D create -d virtualbox test
DEBU[0000] executing: /usr/bin/VBoxManage
DEBU[0000] STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 4.3.26
(C) 2005-2015 Oracle Corporation
/*
* basic unordered list widget
* returns <li>01/15/08: Events name (CA)</li> with link
*/
function eventCallback(obj) {
var events = obj;
var outputHTML = "<ul>";
var baseurl = "http://www.mtbcalendar.com/events/"
for (var i=0; i<events.length; i++){
<div id="mtbcalendar"></div>
<script src="http://www.mtbcalendar.com/javascripts/basicwidget.js" type="text/javascript"></script>
<script src="http://www.mtbcalendar.com/tags/norcal.json?callback=eventCallback&amp;future=1" type="text/javascript"></script>
@slashk
slashk / adsense_prowler.rb
Created September 3, 2010 18:58
fetches your daily and monthly adsense totals and sends them to your iphone via Prowl
#!/usr/bin/env ruby
# created by admin AT mtbcalendar D0T com on 09-02-2010.
#### CUSTOMIZE THE VARIABLES BELOW
ADSENSE_LOGIN = "ENTER YOUR ADSENSE EMAIL LOGIN HERE"
ADSENSE_PASS = "ENTER YOUR ADSENSE PASSWORD HERE"
PROWL_API_KEY = "ENTER YOUR PROWL API HERE"
### DON'T CHANGE ANYTHING BELOW HERE
# install these gems with:
(amd64)ubuntu@core:~$ snappy list -v
Name Date Version Developer
ubuntu-core 2016-02-25 16 ubuntu*
docker 2016-07-02 1.6.2.005 canonical*
generic-amd64 2016-02-25 1.4 canonical*
@slashk
slashk / k8s-cluster-token-generator.go
Created March 2, 2017 17:49
k8s cluster token generator for kubeadm
package main
import (
"fmt"
"math/rand"
)
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
func RandStringBytes(n int) string {
@slashk
slashk / chrome-tab-to-reminder.applescript
Last active March 2, 2017 18:07
Create reminder from Chrome tab
set importance to 9
tell application "Google Chrome"
set tabname to get title of active tab of window 1
set taburl to get URL of active tab of window 1
close active tab of window 1
end tell
display dialog "Job Priority" buttons {"Low", "Medium", "High"} default button 1 with icon caution with title tabname giving up after 10
-- priority : (1=High, 5=Medium, 9=Low, 0=None)
if the button returned of the result is "High" then
set importance to 1
@slashk
slashk / calico-1-6-no-ipip.yaml
Created April 23, 2017 02:36
yaml manifest to create non-ipip calico kubernetes clusters with kubeadm
# This ConfigMap is used to configure a self-hosted Calico installation.
kind: ConfigMap
apiVersion: v1
metadata:
name: calico-config
namespace: kube-system
data:
# The location of your etcd cluster. This uses the Service clusterIP
# defined below.
etcd_endpoints: "http://10.96.232.136:6666"
@slashk
slashk / Datadog Usage API Costs
Last active September 2, 2022 16:12
remove push arg
#!/bin/bash
# This script uses the Datadog API to pull down monthly costs by charge type (commit/on-demand) and product name into CSV
# run it like this (after you setup your datadog app / api keys as env variables as DD_APP_KEY and DD_API_KEY):
#
# % ./dd_monthly_cost_by_prod_charge.sh
#
# Output looks like this:
#
# product name, charge type, cost