Skip to content

Instantly share code, notes, and snippets.


Zaar Hai haizaar

View GitHub Profile
haizaar / gist:4125404
Created Nov 21, 2012 — forked from clintongormley/gist:4096675
Nested documents
View gist:4125404

Create an index with a nested mapping:

curl -XPUT ''  -d '
   "mappings" : {
      "test" : {
         "properties" : {
            "title" : {
               "type" : "string"
haizaar / 1. Execution results CPython 3.4.2
Last active Aug 29, 2015
dictionary tree traversal with path keeping
View 1. Execution results CPython 3.4.2
inline: 0.388133 seconds
iterate_tree: 0.772798
iterate_tree2: 0.707333
iterate_tree3: 0.564626
iterate_tree3_noyield: 0.498388
iterate_tree3_nofeedback: 0.353944
iterate_tree5: 0.650102
iterate_tree5_noyield: 0.566557
iterate_tree5_nofeedback: 0.435601
iterate_tree6: 0.562908
haizaar / Dockerfile - cpu loader
Last active Feb 12, 2020
Simple CPU loader in Python for Kebernetes GKE
View Dockerfile - cpu loader
FROM python:3.5-alpine
CMD nice -n ${NICENESS:-0} python -u
haizaar / Dockerfile - mem loader
Last active Feb 12, 2020
Simple Memory loader in Python for Kebernetes GKE
View Dockerfile - mem loader
FROM python:3.5-alpine
CMD python -u
haizaar / nginx-ip-watch
Last active Apr 24, 2016
Reverse proxy to Kubernetes cluster NodePort through nginx
View nginx-ip-watch
#!/usr/bin/env python
import os
import subprocess
import argparse
import json
from oauth2client.client import GoogleCredentials
from googleapiclient import discovery
haizaar / Dockerfile
Last active Sep 21, 2018
Wiola minimal setup
View Dockerfile
# NOTE: This is a really quick & dirty version
FROM openresty/openresty:
RUN apk add --no-cache cmake openssl-dev git
RUN /usr/local/openresty/luajit/bin/luarocks install wiola 0.9.1-2
CMD ["/usr/local/openresty/bin/openresty"]
View asyncio-client-debug-log.txt
$ python
2019-01-15T00:14:01 Entering re-connect loop
2019-01-15T00:14:01 trying transport 0 using connect delay 0
2019-01-15T00:14:01 connecting once using transport type "websocket" over endpoint "tcp"
[('logOctets', False, 'WampWebSocketClientFactory'),
('logFrames', False, 'WampWebSocketClientFactory'),
('trackTimings', False, 'WampWebSocketClientFactory'),
('utf8validateIncoming', True, 'WampWebSocketClientFactory'),
('applyMask', True, 'WampWebSocketClientFactory'),
haizaar / Dockerfile
Created Jan 18, 2019
Crossbar Dockerfile alphine
View Dockerfile
FROM python:3.7.2-alpine AS builder
RUN apk add --no-cache --virtual .build-deps \
build-base \
libffi-dev \
openssl-dev \
ENV PYROOT /pyroot
haizaar / bench.lua
Last active May 11, 2019
Lua "class" performance
View bench.lua
-- Plain function for baseline
local func = function(x)
return x
-- Closure
local IClass = function(id)
local foo = function()
return id
haizaar /
Created Aug 26, 2019
A script to create multi-file GCP Deployment Manager composite type
import json
import time
import click
import googleapiclient.discovery
import googleapiclient.errors