Skip to content

Instantly share code, notes, and snippets.

View trjordan's full-sized avatar

TR Jordan trjordan

  • Slack
  • Bay Area
  • X @_tr
View GitHub Profile
@trjordan
trjordan / gist:2721175
Created May 17, 2012 19:43
Confidence intervals
import cProfile
import sys
import math
import numpy
import random
def mean(values):
if values:
return sum(values) / len(values)
else:
@trjordan
trjordan / gist:2962204
Created June 20, 2012 21:04
Testing signature preserving
from functools import wraps
from decorator import decorator
def mywrapper1(func, *args, **kwargs):
"""A decorator"""
print 'Wrappedly 1', args, kwargs
return func(*args, **kwargs)
def mywrapper2(*args, **kwargs):
print 'Wrappedly 2', args, kwargs
@trjordan
trjordan / Front.php
Created January 4, 2013 14:38
Front.php from Magento Core 1.7
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@trjordan
trjordan / gist:4475869
Last active December 10, 2015 18:38
Tracing a set of Resque jobs.
# In the web request
def start_job(*args)
# Log the fact that we're starting a job, and send the job with the current
# task id
ctx = Oboe::Context.toString
Oboe::API.log_entry('job', { :Async => true })
task_id = Oboe::Context.toString unless not Oboe::Context.isValid
Oboe::Context.fromString(ctx)
Resque.enqueue(Processdoc, task_id, *args)
@trjordan
trjordan / plot_api_data.py
Last active December 12, 2015 08:09
matplotlib script to create a couple of charts from AppNeta TraceView's API.
#!/usr/bin/env python
#
# Unwrap the data from the Data API, and make a couple of plots.
# 1) Plot of volume and latency
# 2) Plot of scalability of the current application
#
# Assumes data from the week-long view (i.e., 4-hour chunks of data). If this
# isn't true, the labels will be wrong.
#
# Try running it like this:
@trjordan
trjordan / traceview.coffee
Last active December 20, 2015 10:30
Hubot plugin for AppNeta's Traceview.
# Description:
# Display latency information from TraceView applications.
#
# Dependencies:
#
# Configuration:
# HUBOT_TV_ACCOUNTS
#
# Commands:
# hubot (traceview|tv) me <account> latency (for|in) <applications> - Return latency information for TraceView applications in an account
@trjordan
trjordan / pathview.coffee
Last active December 20, 2015 10:30
Hubot plugin for AppNeta PathView.
# Description:
# Display network path performance from PathView Cloud.
#
# Dependencies:
#
# Configuration:
# HUBOT_PVC_SUBDOMAIN
# HUBOT_PVC_ACCOUNT
# HUBOT_PVC_PASSWORD
#

Keybase proof

I hereby claim:

  • I am trjordan on github.
  • I am trjordan (https://keybase.io/trjordan) on keybase.
  • I have a public key ASCpBnh-J3rI2O32gMdFKNimICD1bmJL7jxup-a3fiVvdQo

To claim this, I am signing this object:

@trjordan
trjordan / cds.yaml
Created February 8, 2018 21:05
Example CDS configuration
version_info: "0"
resources:
- "@type": type.googleapis.com/envoy.api.v2.Cluster
name: some_service
connect_timeout: 1.0s
lb_policy: ROUND_ROBIN
type: EDS
eds_cluster_config:
eds_config:
api_config_source: