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 / kops-bootstrap.sh
Created May 11, 2021 15:26
kops AMI provision script
#!/bin/bash
set -euxo pipefail
export CALICO_VERSION="${CALICO_VERSION:-3.13.4}"
export CNI_VERSION="${CNI_VERSION:-0.8.7}"
export CONTAINERD_VERSION="${CONTAINERD_VERSION:-1.4.3}"
export DOCKER_VERSION="${DOCKER_VERSION:-20.10.0}"
export FILEBEAT_VERSION="${FILEBEAT_VERSION:-7.5.1}"
export FLANNEL_VERSION="${KUBERNETES_VERSION:-0.11.0}"
@kesor
kesor / spec.json
Created March 31, 2021 14:28
Vega-Lite Seattle Weather
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Plot showing a 30 day rolling average with raw values in the background.",
"width": 800,
"height": 600,
"data": {"url": "data/seattle-weather.csv"},
"transform": [{
"window": [
{
"field": "temp_max",
@kesor
kesor / profile_middleware.py
Last active March 16, 2021 15:37
Django cProfile middleware
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
import cProfile
import pstats
import marshal
from cStringIO import StringIO
class ProfileMiddleware(object):
def __init__(self):
if not settings.DEBUG:
@kesor
kesor / AWS Security Resources.md
Last active February 4, 2021 23:52 — forked from chanj/AWS Security Resources
AWS Security Resources
function get_cluster_name() {
if ! kubectl config current-context ; then
echo "ERROR: Could not read kubeconfig context" 2>&1
exit 1
fi
}
CLUSTER_NAME=$(get_cluster_name)
@kesor
kesor / docker_workshop_microservices_cheat_sheet.md
Last active September 27, 2020 17:54
docker workshop cheat sheet #2 - microservices
filebeat.autodiscover:
providers:
# documented at https://www.elastic.co/guide/en/beats/filebeat/master/configuration-autodiscover.html
- type: kubernetes
host: ${NODE_NAME}
hints.enabled: true
hints.default_config:
type: container
paths:
- /var/log/containers/*${data.kubernetes.container.id}.log
@kesor
kesor / kops-cluster-update-errors.txt
Created September 1, 2020 12:09
kops cluster update duplicate IAM roles
I0901 15:06:00.194412 65709 factory.go:68] state store s3://mybucket.domain.com/mycluster
I0901 15:06:00.194584 65709 s3context.go:337] GOOS="darwin", assuming not running on EC2
I0901 15:06:00.194592 65709 s3context.go:170] defaulting region to "us-east-1"
I0901 15:06:00.987020 65709 s3context.go:210] found bucket in region "us-east-1"
I0901 15:06:00.987048 65709 s3fs.go:284] Reading file "s3://mybucket.domain.com/mycluster/mycluster.domain.com/config"
I0901 15:06:01.770731 65709 s3fs.go:321] Listing objects in S3 bucket "mybucket.domain.com" with prefix "mycluster/mycluster.domain.com/instancegroup/"
I0901 15:06:01.978948 65709 s3fs.go:349] Listed files in s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup: [s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup/master-us-east-1a s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup/nodes s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup/second]
I0901 15:06:01.978996 65709
@kesor
kesor / ffmpeg-grab-cam-display.sh
Created August 20, 2020 15:29
Record display, webcam and pulseaudio using ffmpeg
#!/bin/sh
# 1. create v4l2loopback device /dev/video42 using
# $ sudo modprobe v4l2loopback video_nr=42 max_buffers=2 exclusive_caps=1
ts=$(date +%Y-%m-%dT%H:%M:%SZ-%s)
PREFIX=/mnt/data/Videos
CAMERA_INPUT=/dev/video0
@kesor
kesor / docker-compose.yaml
Last active July 13, 2020 10:51
Docker Compose for ElasticSearch + Kibana 7.8
# Create an EBS volume and attach to the EC2 instance
# Format as XFS and mount at /mnt/elastic-data
# /dev/nvme2n1 on /mnt/elastic-data type xfs (rw,relatime,attr2,inode64,noquota)
# For ElasticSearch to work - got to change this sysctl:
#
# sudo sysctl vm.max_map_count=262144
#
# $ cat docker-compose.yml