Skip to content

Instantly share code, notes, and snippets.

@flisky
flisky / grafana-dashboard-exporter
Last active October 6, 2021 18:57 — forked from crisidev/grafana-dashboard-exporter
Command to export all grafana 3 dashboard to JSON using curl & jq
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search | jq -r '.[].uri|ltrimstr("db/")'); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash | jq '.dashboard' > dashboards/$dash.json
done
@flisky
flisky / parseQuerystring.jquery.js
Created January 26, 2012 09:44 — forked from oomlaut/parseQuerystring.jquery.js
add support to same key occurred multi times
jQuery.extend({
parseQuerystring: function(){
var nvpair = {};
var qs = window.location.search.replace('?', '');
var pairs = decodeURI(qs).split('&');
$.each(pairs, function(i, v){
var pair = v.split('=');
var key = pair[0], value = pair[1];
if(key in nvpair){
if(!$.isArray(nvpair[key])){ nvpair[key] = $.makeArray(nvpair[key]);}