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 / gist:5549876
Last active December 17, 2015 04:19
Open3.popen3 cmd do |sin, sout, serr, wait_thr|
loop do
rs, _, _ = IO.select([sout,serr]) # no multi-assign in conditions
break if (sout.eof? and serr.eof?) or (sout.closed? and serr.closed?)
next if rs.empty?
rs.each do |readable_io|
log readable_io.gets # read a line from it
end
end
exit_status = wait_thr.value
@kesor
kesor / graphite_magic
Last active December 18, 2015 09:19
Graphite deviation from average of last couple of weeks
target=diffSeries(
app.important.stuff,
averageSeries(
timeShift(app.important.stuff, "-7d"),
timeShift(app.important.stuff, "-14d"),
timeShift(app.important.stuff, "-21d")
)
)
@kesor
kesor / client.yaml
Last active December 19, 2015 00:09
# /etc/puppet/config/client.yaml
---
client: example.com
environment: vagrant
@kesor
kesor / varnish.txt
Last active December 19, 2015 12:19
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
if (req.request == "POST") {
return (pipe);
}
if (req.url ~ "^/(s/|favicon.ico|download/resources/|download/batch/|images/icons/)") {
# Description:
# Allows Hubot to search a Graphite server for saved graphs
#
# Dependencies:
# A HuBot robot brain of some kind. MongoDB/Redis/...
#
# Configuration
# HUBOT_HIPCHAT_TOKEN
# GRAPHITE_URL (e.g. https://graphite.example.com)
# GRAPHITE_AUTH (e.g. user:password for Basic Auth)
@kesor
kesor / LICENSE
Created March 13, 2012 15:15
Making Amazon AWS API Queries
Copyright (c) 2013, Evgeny Zislis
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
// 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;
!^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