Skip to content

Instantly share code, notes, and snippets.

View wklken's full-sized avatar
😄
Coding

wklken wklken

😄
Coding
View GitHub Profile
@wklken
wklken / status_code_analysis.lua
Last active November 4, 2023 07:56 — forked from non-static/status_code_analysis.lua
Lua script for wrk2 to count response code and a particular header
local counter = 1
local threads = {}
function setup(thread)
thread:set("id", counter)
table.insert(threads, thread)
counter = counter + 1
end
function init(args)
##
## HTTP Router benchmarks -- Jan 9, 2019 with Go 1.11.4 on Linux X1 Carbon laptop
##
## This benchmark suite is based on https://github.com/julienschmidt/go-http-routing-benchmark
## using the most up-to-date version of each pkg as of today. Each router has their own
## pros and cons, so consider the designs of each router to suit your application.
##
## We use the most up-to-date version of each router available in the tests below.
##
@wklken
wklken / docker_images.sh
Created February 25, 2019 09:11 — forked from hydra1983/docker_images.sh
Save and load docker images in batch
#!/bin/bash
readonly DB_FILE="$(pwd)/images.db"
readonly IMG_DIR="$(pwd)/images"
save-images() {
echo "Create ${DB_FILE}"
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}"
echo "Read ${DB_FILE}"
@wklken
wklken / mock_requests.py
Created November 28, 2018 07:41 — forked from evansde77/mock_requests.py
Example of mocking requests calls
#!/usr/bin/env python
"""
mocking requests calls
"""
import mock
import unittest
import requests
from requests.exceptions import HTTPError
@wklken
wklken / elasticsearch-cheatsheet.txt
Created February 20, 2017 07:36 — forked from stephen-puiszis/elasticsearch-cheatsheet.txt
Elasticsearch Cheatsheet - An Overview of Commonly Used Elasticsearch API Endpoints and What They Do
# Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands
# cat paths
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
@wklken
wklken / request.sh
Last active September 1, 2016 19:27 — forked from nuxlli/unix_socket_request.sh
Examples of http request (in unix domain socket) with bash and [nc|socat]
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@wklken
wklken / tornado-unix-socket.py
Created January 12, 2016 06:59 — forked from superduper/tornado-unix-socket.py
Tornado web server with unix socket support
import tornado.ioloop
import tornado.web
from tornado.options import options, define
from tornado.netutil import bind_unix_socket
from tornado.httpserver import HTTPServer
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")