Skip to content

Instantly share code, notes, and snippets.

Viacheslav Vasilyev avoidik

Block or report user

Report or block avoidik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
avoidik /
Last active Jun 3, 2019
GCC on Windows with MSYS2

Install mingw using msys2 into c:\Tools\msys64\

  • install msys2
  • execute msys2_shell and then pacman -S mingw-w64-x86_64-gcc to install GCC
  • then perform pacman -S mingw-w64-x86_64-sqlite3 to install sqlite3 native library
  • add c:\Tools\msys64\mingw64\bin to PATH environment
avoidik / FiddlerClientCertPicker.cs
Created May 27, 2019 — forked from ericlaw1979/FiddlerClientCertPicker.cs
Fiddler client certificate picker extension
View FiddlerClientCertPicker.cs
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Fiddler;
[assembly: Fiddler.RequiredVersion("")]
namespace ClientCertPicker
public class ClientCertPicker: IFiddlerExtension
avoidik /
Created May 16, 2019 — forked from iMilnb/
AWS Terraform configuration: Stream CloudWatch Logs to ElasticSearch


This snippet is a sample showing how to implement CloudWatch Logs streaming to ElasticSearch using terraform. I wrote this gist because I didn't found a clear, end-to-end example on how to achieve this task. In particular, I understood the resource "aws_lambda_permission" "cloudwatch_allow" part by reading a couple of bug reports plus this stackoverflow post.

The js file is actually the Lambda function automatically created by AWS when creating this pipeline through the web console. I only added a endpoint variable handling so it is configurable from terraform.

avoidik /
Created Mar 27, 2019 — forked from akiatoji/
Add CloudWatch Memory/Disk monitoring to EC2

AWS EC2 Memory and Disk monitoring/alert

AWS kind of sucks when it comes to monitoring Memory and Disk usage on EC2, as in they don't provide it out of the box. AWS instead gives you a set of perl scripts to do this via CloudWatch custom metrics.

Details are here:

Monitoring Memory and Disk Metrics for Amazon EC2 Linux Instances

The following is the actual steps used to get Disk/Memory stats into CloudWatch

avoidik /
Created Feb 26, 2019
Vault patch secrets
# old cli - kv v1
vault read -format json -field data secret/foo/bar | \
jq '.baz = "qux"' | \
vault write secret/foo/bar -
# new cli - kv v2
vault kv patch ...
#!/usr/bin/env python3
from Crypto.Cipher import AES
from Crypto import Random
from Crypto.Protocol.KDF import PBKDF2
def make_key(password, salt = None):
if salt is None:
avoidik /
Created Feb 19, 2019 — forked from li0nel/
EC2 Create Role for Docker Compose
# Create an IAM role
aws iam create-role --role-name Laravel-EC2-Role \
--assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Sid":"","Effect":"Allow","Principal":{"Service":""},"Action":"sts:AssumeRole"}]}'
# Add an IAM policy granting access to CloudWatch
aws iam put-role-policy --role-name Laravel-EC2-Role --policy-name Laravel-CloudWatch-EC2-Permissions \
--policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["logs:CreateLogStream","cloudwatch:PutMetricData","ec2:DescribeTags","logs:DescribeLogStreams","logs:CreateLogGroup","logs:PutLogEvents","ssm:GetParameter"],"Resource":"*"}]}'
# Add an IAM policy granting access to your S3 bucket
aws iam put-role-policy --role-name Laravel-EC2-Role --policy-name Laravel-S3-EC2-Permissions \
avoidik / AWS Swarm
Created Feb 19, 2019 — forked from ghoranyi/AWS Swarm
Create a Docker 1.12 Swarm cluster on AWS
View AWS Swarm

This gist will drive you through creating a Docker 1.12 Swarm cluster (with Swarm mode) on AWS infrastructure.


You need a few things already prepared in order to get started. You need at least Docker 1.12 set up. I was using the stable version of Docker for mac for preparing this guide.

$ docker --version
Docker version 1.12.0, build 8eab29e

You also need Docker machine installed.

# load OpenSSL.crypto
from OpenSSL import crypto
# open it, using password. Supply/read your own from stdin.
p12 = crypto.load_pkcs12(open("/path/to/cert.p12", 'rb').read(), passwd)
# get various properties of said file.
# note these are PyOpenSSL objects, not strings although you
# can convert them to PEM-encoded strings.
p12.get_certificate() # (signed) certificate object
avoidik /
Created Feb 12, 2019 — forked from aiguofer/
Creating a Python requests session using a passphrase protected Client side Cert
import ssl
from requests.adapters import HTTPAdapter
CFG_FILE = '<path_to_cfg>'
secure_hosts = [
class SSLAdapter(HTTPAdapter):
def __init__(self, certfile, keyfile, password=None, *args, **kwargs):
You can’t perform that action at this time.