Skip to content

Instantly share code, notes, and snippets.

@zwily
zwily / gist:5322615
Last active December 15, 2015 20:59
class GraphiteUrl
constructor: (base, attrs = {}) ->
@base = base
@attrs = attrs
@targets = []
attr: (k, v) ->
@attrs[k] = v
target: (target) ->

programStations is an Ember.ArrayController

  console.log programStations.mapProperty('id')
  programStations.forEach (programStation, index) ->
    console.log "#{index}: #{programStation.get 'id'}

outputs:

@zwily
zwily / gist:5959853
Last active December 19, 2015 13:09

CPUUtilization Based:

1 week ago 1 week ago
+ 1 hour
Now In 1 hour
(Prediction)
Avg CPU avg_cpu 50% 45% 52%
Num Nodes nodes 2 4 2
See if the present is matching the past
Total CPU
total_cpu = avg_cpu * nodes
100 104
100 and 104 are close enough together to assume that the future will match the past
Calculate total cpu for 1w ago + 1h
class AwsController < ApplicationController
def call
service = AWS.const_get(params[:service]).new(params[:service_params] || {})
result = service.client.send(params[:method].to_sym, params[:options] || {})
respond_to do |format|
format.json { render :json => result.data }
end
end
end
@zwily
zwily / sortable_table.js
Last active August 29, 2015 14:03
simple sortable table react component
/** @jsx React.DOM */
var React = require('react'),
types = React.PropTypes,
_ = require('underscore');
module.exports = React.createClass({
propTypes: {
columns: types.arrayOf(
types.shape({
@zwily
zwily / sshsa.rb
Last active September 19, 2016 16:34
#!/usr/bin/env ruby
# sshsa (SSH Switch Agent)
#
# sshsa manages multiple ssh-agents with different sets of keys. It
# lets you switch between them with one command. It was written on OS X
# with Keychain stuff in mind, so probably won't work unmodified on
# Linux.
#
# To use:

Keybase proof

I hereby claim:

  • I am zwily on github.
  • I am zwily (https://keybase.io/zwily) on keybase.
  • I have a public key whose fingerprint is 4BEE 0C59 A509 E13B 5F1F 253B D41E B637 61AA 492F

To claim this, I am signing this object:

whoizach-laptop-2:~ zach $ whois noticeablyunprofessional.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: NOTICEABLYUNPROFESSIONAL.COM
Registrar: GODADDY.COM, LLC
This is a table testing
Oh hi there blah
This is a table | testing
---------------- | --------
Oh hi there | blah