Skip to content

Instantly share code, notes, and snippets.

View kesor's full-sized avatar
🏠
Working from home

Evgeny Zislis kesor

🏠
Working from home
View GitHub Profile
@kesor
kesor / README.md
Last active February 4, 2018 23:51
generating a simple api-gateway using swagger-codegen nodejs-server

API Gateway w/Swagger Codegen

I need a simple API Gateway that will use Swagger as its input format. A very simple way to achieve this is to use swagger-codegen and create a nodejs-server that will simply proxy (and optionally modify) requests it receives to some other host.

Node.js request proxy

Array.prototype.assoc = function(obj) { return ARR.find( function(iArr) { return iArr[0] == obj } ) }
const ARR = [ [ "a", "b", "c" ], [ 1, 2, 3 ], [ "a", 2 ] ]
ARR.assoc("a")
// > [ 'a', 'b', 'c' ]
@kesor
kesor / output of stracestats
Last active June 6, 2018 11:32
strace output for a very very long logstash startup
# 0% of syscalls and syscall time are removed for brevity
...
...
...
fstat
num calls: 1714 1% of syscalls
package main
import (
"encoding/json"
"fmt"
)
type ServiceDescriptionPayload struct {
Address string `json:"address"`
}
@kesor
kesor / test-peer-discovery.go
Created August 28, 2018 08:05
peer discovery
package main
import (
"fmt"
"os"
"strings"
"time"
)
func printFatal(e error) {
@kesor
kesor / tsm.diff
Last active December 9, 2018 21:42
TradeSkillMaster Crafting Operation restock quantity from CustomPrice source
diff --git a/Core/Service/Crafting/Core.lua b/Core/Service/Crafting/Core.lua
index c2e2bf3..752013f 100644
--- a/Core/Service/Crafting/Core.lua
+++ b/Core/Service/Crafting/Core.lua
@@ -548,7 +548,10 @@ function Crafting.RestockHelp(link)
end
+ local maxRestock = TSMAPI_FOUR.CustomPrice.GetValue(opSettings.maxRestock, itemString)
+ local minRestock = TSMAPI_FOUR.CustomPrice.GetValue(opSettings.minRestock, itemString)
+
@kesor
kesor / setup-helm.sh
Last active January 24, 2019 20:26
Setup HELM/Tiller with TLS verification and Cluster Admin RBAC role link
#!/bin/bash
HELM_TILLER_SA=tiller
HELM_TILLER_NS=kube-system
tiller_tls() {
[ ! -f tiller-ca.crt ] && \
openssl req -x509 -new -newkey rsa:2048 -keyout tiller-ca.key -nodes -sha256 -days 3650 -out tiller-ca.crt -subj "/CN=tiller-ca"
[ ! -f tiller.crt ] && {
echo subjectAltName=IP:127.0.0.1 > extfile.cnf
@kesor
kesor / cloudtrail-template-elasticsearch.json
Last active February 5, 2022 02:59
An ElasticSearch Index template for CloudTrail events
PUT _template/cloudtrail
{
"index_patterns": ["cloudtrail-*"],
"settings": {
"number_of_shards": 1,
"mapping": {
"total_fields": {
"limit": 10000
}
}
@kesor
kesor / keybase.md
Created August 19, 2019 10:09
keybase.md

Keybase proof

I hereby claim:

  • I am kesor on github.
  • I am kesor (https://keybase.io/kesor) on keybase.
  • I have a public key ASBXaH4PUfL6oeNFmPX5ZOyZ-9aO21ZE9wc-gtK5o4dnZQo

To claim this, I am signing this object:

@kesor
kesor / xml2json.js
Last active November 18, 2019 22:48
Slightly cleaned up version of xml2json by Stefan Goessner/2006 http://goessner.net
/* This work is licensed under Creative Commons GNU LGPL License.
License: http://creativecommons.org/licenses/LGPL/2.1/
Version: 0.9
Author: Stefan Goessner/2006
Web: http://goessner.net/
Original file: https://goessner.net/download/prj/jsonxml/
*/
function xml2json(xml) {