Skip to content

Instantly share code, notes, and snippets.

Laurent Coustet zehome

Block or report user

Report or block zehome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zehome
zehome / gist:6213872
Created Aug 12, 2013
Django reverse proxy for graphite
View gist:6213872
# Requirement: httplib2
import httplib2
class Httplib2ProxyMixin(object):
def _proxy(self, method, uri, body=None):
assert(method in ("GET", "POST"))
http = httplib2.Http()
resp, content = http.request(uri, method,
headers={'cache-control': 'no-cache'},
body=body)
@zehome
zehome / gist:6122038
Last active Dec 20, 2015
use simple hash function to avoid re-sending all targets as alias
View gist:6122038
diff --git a/jquery.tswidget.js b/jquery.tswidget.js
index b30e77a..f300745 100755
--- a/jquery.tswidget.js
+++ b/jquery.tswidget.js
@@ -4,6 +4,9 @@ function strip_ending_slash(str) {
}
return str;
}
+function hash_target(target) {
+ return target.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a;},0);
View gist:6028730
--- a/app.py
+++ b/app.py
@@ -436,7 +436,7 @@ def build_graphs_from_targets(targets, query={}):
graph_config['targets'].append(targets[0])
else:
t = {
- 'target': 'sumSeries(%s)' % (','.join([t['graphite_metric'] for t in targets])),
+ 'target': 'sumSeries(%s)' % (','.join([t['target'] for t in targets])),
'graphite_metric': [t['graphite_metric'] for t in targets],
'variables': targets[0]['variables']
@zehome
zehome / gist:6011570
Created Jul 16, 2013
activate timeseries highcharts in graph-explorer
View gist:6011570
diff --git a/templates/snippet.graph-deps.tpl b/templates/snippet.graph-deps.tpl
index c484ba7..431b0a7 100644
--- a/templates/snippet.graph-deps.tpl
+++ b/templates/snippet.graph-deps.tpl
@@ -9,6 +9,8 @@
<script src="../timeserieswidget/flot/jquery.flot.selection.js"></script>
<script src="../timeserieswidget/flot/jquery.flot.time.js"></script>
<script src="../timeserieswidget/flot/jquery.flot.stack.js"></script>
+<script src="../timeserieswidget/highcharts/highcharts.js"></script>
+<script src="../timeserieswidget/highcharts/modules/exporting.js"></script>
You can’t perform that action at this time.