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 / dump-zabbix.sh
Last active August 29, 2015 14:17
zabbix database dump with config data only
mysqldump --single-transaction --no-create-info \
--ignore-table zabbix.history \
--ignore-table zabbix.history_str \
--ignore-table zabbix.history_log \
--ignore-table zabbix.history_uint \
--ignore-table zabbix.history_text \
--ignore-table zabbix.trends \
--ignore-table zabbix.trends_uint \
--ignore-table zabbix.auditlog \
--ignore-table zabbix.auditlog_details \
@flisky
flisky / asyncio intro.md
Last active August 6, 2020 03:56
Introduce to AsyncIO

AsyncIO

Prerequisite

Overviews

PEP: 3165
python module name: asyncio, new in Python 3.4
reference implementation: tulip
backport: trollius ( python >= 2.6)

@flisky
flisky / ldap-referral-chase.md
Created July 9, 2014 10:13
LDAP Chase Referrals

记一次LDAP调试之旅

说明: 公司LDAP服务器 M$的ActiveDirectory

现象:

命令行使用正常返回

ldapsearch -x -H ldap://ldap.$$$$.com -b "DC=$$$$,DC=com" -s sub -D '...@$$$$.com' -W '(sAMAccountName=...)'

参数说明:

@flisky
flisky / django-server-config.md
Created July 7, 2014 03:48
Django部署方案

Django服务部署

## About Me

  • 09年底至今,主要工作内容:基于Django的Web开发,从0.96版本到1.7,向Django及相关社区贡献了50+ commits
  • 期间涉猎了javascript, golang, clojure等开发语言,对nginx, tornado, nodejs等工具的异步模型有一定了解
  • 熟悉Linux下开发,了解部署,但之前未接触过Django的服务部署调优
@flisky
flisky / paginator.py
Last active August 29, 2015 14:01
countless django paginator for django-rest-framework
import collections
from django.utils import six
from django.core.paginator import PageNotAnInteger, EmptyPage
class Paginator(object):
def __init__(self, object_list, per_page, orphans=0,
allow_empty_first_page=True):
@flisky
flisky / goroutine by example
Created November 5, 2013 03:25
Goroutine By Example
Goroutine By Example
====================
尹吉峰 2013/11/05
Python Thread
-------------
```python
import time
import threading
@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]);}