Skip to content

Instantly share code, notes, and snippets.

View kubernetes-awk-to-get-resource-usage-per-node
kubectl describe nodes | awk '/Name:/{print;getline}/Allocated resources:/{for(l=0;l<5;l++){print;getline;b=1}if(b){print "--";b=0}}'
@mikeyhu
mikeyhu / release.py
Last active Nov 11, 2015
A basic SEMVER release version manager in python
View release.py
#!/usr/bin/python
import sys
import os.path
def display_usage():
print """USAGE:
release.py [major|minor|patch|init]"""
sys.exit()
def parse_version(version):
@mikeyhu
mikeyhu / URLStatusChecker.groovy
Last active Aug 29, 2015
Check for 302 Status using groovy HttpURLClient and copy cookies from Selenium webdriver as well
View URLStatusChecker.groovy
package courtdocuments.helpers
import groovyx.net.http.HttpResponseDecorator
import groovyx.net.http.HttpURLClient
import org.openqa.selenium.WebDriver
import static groovyx.net.http.ContentType.TEXT
import static groovyx.net.http.Method.GET
/*
View keybase.md

Keybase proof

I hereby claim:

  • I am mikeyhu on github.
  • I am mikee (https://keybase.io/mikee) on keybase.
  • I have a public key whose fingerprint is FB36 1DDD 91BA 4E3C 0CE8 BE41 FBE6 3091 9083 E8EB

To claim this, I am signing this object:

View firstandlast.sh
echo -n > /tmp/committers-to-project
for project in Project1 Project2; do
cd ~/casper/$project && git log --date=short --pretty="%ad %s" >> /tmp/committers-to-project
done
sort /tmp/committers-to-project > /tmp/committers-to-project-sorted
for person in Name1 Name2; do
echo $person
grep $person /tmp/committers-to-project-sorted | sed -n '1p;$p' | sed 's/ .*$//g'
@mikeyhu
mikeyhu / GoogleAnalyticsRealtime.job.coffee
Created Nov 13, 2013
Dashing-js Job to receive Google Analytics Realtime data using CoffeeScript
View GoogleAnalyticsRealtime.job.coffee
googleapis = require 'googleapis'
email = 'MYDEVELOPERACCOUNT@developer.gserviceaccount.com'
scope = ['https://www.google.com/analytics/feeds/']
keyFile = 'MYKEY.pem'
previousMetrics = []
maxHistory = 120
current = 0
@mikeyhu
mikeyhu / GoogleAnalytics.job.coffee
Created Nov 13, 2013
Dashing-js Job to receive Google Analytics API data using CoffeeScript
View GoogleAnalytics.job.coffee
googleapis = require 'googleapis'
moment = require 'moment'
email = 'MYACCOUNT@developer.gserviceaccount.com'
scope = ['https://www.google.com/analytics/feeds/']
keyFile = 'MYKEY.pem'
formatRowsByDay = (rows)->
count = -16
@mikeyhu
mikeyhu / gist:5460397
Created Apr 25, 2013
Trying out Three.js with CoffeeScript
View gist:5460397
$scope.drawGraph = ()->
scene = new THREE.Scene()
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 )
camera.position.z = 300
scene.add camera
renderer = new THREE.WebGLRenderer()
renderer.setSize(400,400)
document.getElementById("canvasDiv").appendChild(renderer.domElement)
directionalLight = new THREE.DirectionalLight(0xffffff, 1.0)