Skip to content

Instantly share code, notes, and snippets.

Laurent Coustet zehome

View GitHub Profile
@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>
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: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);
@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 / cross_request_origin_graphite.md
Last active Dec 21, 2015
Enable cross request for graphite/gunicorn
View cross_request_origin_graphite.md

Create this file in your graphite installation directory: lib/python2.7/site-packages/graphite/crossmiddleware.py

import re
 
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
 
from django import http
View gist:6b8d4ae596bc216f2a56
settings = {
core = {
real_name = "xx";
user_name = "xx";
nick = "xx";
recode_out_default_charset = "ISO-8859-15";
recode_autodetect_utf8 = "Yes";
recode_transliterate = "Yes";
};
"fe-text" = { actlist_sort = "refnum"; };
@zehome
zehome / upgrade_openbsd58_openbsd59.yml
Last active Jun 29, 2016
Dirty incomplete upgrade OpenBSD 5.8 to 5.9 using ansible 2
View upgrade_openbsd58_openbsd59.yml
---
- hosts: all
gather_facts: yes
vars:
mirror: http://ftp.eu.openbsd.org/pub/OpenBSD
release: 5.9
arch: amd64
tasks:
- name: installboot on sd0
command: installboot -v sd0
@zehome
zehome / mlvpn_updown.sh
Created May 25, 2016
mlvpn updown.sh for linux without tunnel ip address required
View mlvpn_updown.sh
#!/bin/sh
# up/down script for MLVPN.
#
# MLVPN calls this script with at least 2 arguments:
# $1 : interface name
# $2 : "command"
# command can be:
# - "tuntap_up"
# - "tuntap_down"
@zehome
zehome / upgrade_openbsd60.yml
Created Sep 19, 2016
Upgrade to OpenBSD 6.0 using ansible
View upgrade_openbsd60.yml
---
- hosts: all
gather_facts: yes
vars:
mirror: http://ftp.fr.openbsd.org/pub/OpenBSD
release: 6.0
arch: amd64
files:
- SHA256
- SHA256.sig
@zehome
zehome / gitlab_upgrade.sh
Created Dec 26, 2016
Upgrading source installation of gitlab in one script
View gitlab_upgrade.sh
#!/bin/bash
set -e
version="v8.15.1"
systemctl stop gitlab
cd /home/git/gitlab
echo Stash
You can’t perform that action at this time.