Skip to content

Instantly share code, notes, and snippets.

View rashidkpc's full-sized avatar
🚲

Rashid Khan rashidkpc

🚲
View GitHub Profile
server {
listen *:80 ;
server_name kibana.myhost.org;
access_log /var/log/nginx/kibana.myhost.org.access.log;
location ~ ^/_aliases$ {
proxy_pass http://127.0.0.1:9200;
proxy_read_timeout 90;
}
location ~ ^/.*/_search$ {
@rashidkpc
rashidkpc / Developer Console
Created May 26, 2013 16:33
Dashboards for Costin
{
"title": "PHP Developer",
"rows": [
{
"title": "Options",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
{
"title": "American Gun Deaths since Newtown, CT",
"rows": [
{
"title": "Options",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
# This command returns a terms facet of size 12
# eg, every term in the terms index. Ordered by count they are:
# term12 (120) term11 (110) term10 (100) term9 (90) term8 (80) term7 (70)
# term6 (60) term5 (50) term4 (40) term3 (30) term2 (20) term1 (10)
curl -XGET 'http://localhost:9200/terms/_search?pretty' -d '{
"facets": {
"terms": {
"terms": {
"field": "term",
@rashidkpc
rashidkpc / gist:6691070
Created September 24, 2013 20:53
Dashboard
{
"rows": [
{
"title": "Query",
"height": "40px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
{
{
"rows": [
{
"title": "Query",
"height": "40px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
{
link "#{node['kibana']['installdir']}/current/app/dashboards/default.json" do
to "logstash.json"
only_if { !File::symlink?("#{node['kibana']['installdir']}/current/app/dashboards/default.json") }
end
@rashidkpc
rashidkpc / js_unicode_sparklines.js
Last active August 29, 2015 14:05
Javascript unicode sparklines
var sparkline = function(input) {
var numbers = input.split(/[\s,]+/);
var bar = [0,1,2,3,4,5,6].map(function (n) { return String.fromCharCode(9601+n);});
var min = Math.min.apply(Math, numbers);
var max = Math.max.apply(Math, numbers);
var div = (max - min) / (bar.length - 1)
if (min === max) return Array(numbers.length).join(_.last(bar))
return numbers.map(function (p) {return bar[Math.round(((p - min) / div))]}).join('');
}
@rashidkpc
rashidkpc / digital_transmit.cpp
Created March 21, 2015 04:58
AM digital transmission + wiringPi
// This uses those super cheap 433mhz modules to receive a 32 bit integer
// You should be able to implement many 315 & 433mhz protocols in this, though more complex lock logic may be required
#include <wiringPi.h>
#include <time.h>
#include <iostream>
#include <bitset>
using namespace std;
@rashidkpc
rashidkpc / durations.cpp
Created March 21, 2015 19:22
Pulse based signal debugger
/*
This is useful for debugging systems that use low/high durations for communicating digital information.
I wrote this specific one for figuring out a wireless temperature/humidity gauge, thus to the 352+1
*/
#include <iostream>
#include <time.h>
#include <string.h>