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
// example of a dependency graph described using Graphviz dot notation
// see the rendering of graphiviz here - http://imgur.com/a/kiUR2
digraph G {
sales_missing_info
None[label="",shape=point]
open[label="Open"]
sales_missing_info[label="Missing Info.",color=darkgreen,fontcolor=darkgreen]
@kesor
kesor / cloudtrail-parser.js
Created January 5, 2017 06:08
parsing cloudtrail log files
#!/usr/bin/env node
const fs = require('fs');
function displayEC2Event(event, type) {
if (event.errorCode) {
// -- errors is when someone is using his fat thumbs
console.log('ERROR: ', event.errorCode, event.errorMessage);
} else {
let items = event.responseElements.instancesSet.items;
@kesor
kesor / cloudwatch-logs-to-elastic.js
Created February 14, 2017 12:29
Lambda function to send events from AWS CloudWatch Logs to ElasticSearch.
var http = require('http');
var zlib = require('zlib');
var ts = [ 0 ];
var DEBUG = false; // set to `true` to enable timestamps in results
// private IP of the ELK server in "Default VPC"
var endpointHost = '172.31.10.250';
var endpointPort = 9200;
@kesor
kesor / cloudformation-yaml-to-json.py
Last active January 22, 2019 17:39
Convert CloudFormation YAML format to JSON format
#!/usr/bin/env python
import sys, yaml, json
def funcparse(loader, node):
node.value = {
yaml.constructor.ScalarNode: loader.construct_scalar,
yaml.constructor.SequenceNode: loader.construct_sequence,
yaml.constructor.MappingNode: loader.construct_mapping,
}[type(node)](node)
node.tag = node.tag.replace(u'!Ref', 'Ref').replace(u'!', u'Fn::')
@kesor
kesor / nginx-passwd.sh
Created May 21, 2017 09:22
nginx passwd generate
#!/bin/sh
USERNAME=kopter
PASSWORD=$(openssl rand -base64 12)
SALT=$(openssl rand -base64 3)
SHA1=$(printf "$PASSWORD$SALT" | openssl dgst -binary -sha1 | xxd -ps | sed 's#$#'"`echo -n $SALT | xxd -ps`"'#' | xxd -r -ps | base64)
HEADER=$(printf "$USERNAME:$PASSWORD" | base64)
printf "user: $USERNAME | password: $PASSWORD | %s:{SSHA}%s | Authorization: Basic $HEADER\n" $USERNAME $SHA1
import os
import boto3
import datetime
import dateutil
DEFAULT_MAX_MEM = 3000
LOW_CLUSTER_CPU_TH = 20
HIGH_CLUSTER_CPU_TH = 65
CONTAINERS_MAX_MEM = {
'cluster1': 1200,
@kesor
kesor / AWS Security Resources.md
Last active February 4, 2021 23:52 — forked from chanj/AWS Security Resources
AWS Security Resources
!^k::
SetTitleMatchMode 2
WinActivate, ahk_class Qt5QWindowIcon ; OBS
WinMove, A,, -6, 1080, 880, 366
WinActivate, Recent Events - Google Chrome ; StreamLabs
WinMove, A,, 1930, 1078, 640, 400
WinActivate, Twitch - Google Chrome ; Chat
WinMove, A,, 860, 1080, 1084, 367
WinActivate, Poloniex - Bitcoin/Digital Asset Exchange - API - Google Chrome
WinMove, A,, 0, 0, 1280, 1080
@kesor
kesor / extensions.md
Last active August 23, 2017 07:38
vscode extensions

Used

  • msjsdiag.debugger-for-chrome - for FE debugging
  • PeterJausovec.vscode-docker - syntax highlight for Dockerfile and docker-compose.yml with hub image name completion and lint
  • EditorConfig.editorconfig - set indent style&size, tab width, eol, final newline and trim whitespace properties in an .editorconfig
  • spoonscen.es6-mocha-snippets - before/after/describe/each/...
  • dbaeumer.vscode-eslint - ESLint. + Define a task in tasks.json as described in the documentation of the plugin
  • flowtype.flow-for-vscode - syntax color highlight for JavaScript ES6/ES7
  • donjayamanne.githistory - git history graph in vscode
  • lukehoban.go - maybe someday
  • spywhere.guides - better guides than the built-in ones
@kesor
kesor / example-iam-policy-vpc-deny.json
Created January 17, 2018 18:22
example iam policy for vpc deny
{
"Effect": "Deny",
"Action": [ "ec2:AttachInternetGateway", "ec2:DetachInternetGateway" ],
"Resource": "arn:aws:ec2:REGION:ACCOUNTNUMBER:*",
"Condition": {
"StringEquals": {
"ec2:vpc": "arn:aws:ec2:REGION:ACCOUNTNUMBER:vpc/VPC-ID"
}
}
}