Skip to content

Instantly share code, notes, and snippets.

View semyont's full-sized avatar

Semyon semyont

View GitHub Profile
@Vince-Cercury
Vince-Cercury / gist:43c7afc1a6b0f580b0cb6fb27e650042
Created September 1, 2017 00:12
How to monitor an external secure etcd cluster with Prometheus Operator
# How to monitor a secure external etcd service with Prometheus Operator
This guide will help you monitor an external etcd cluster. When the etcd is not hosted inside Kubernetes.
This is often the case with the Kubernetes setup. This has been tested with kube-aws but same principals will apply to other tools.
# Step 1 - Make the etcd certificates available to Prometheus pod
Prometheus Operator (and Prometheus) allow us to specify a tlsConfig. This is required as most likely your etcd metrics end points is secure.
## a - Create the secrets in the namespace
Prometheus Operator allows us to mount secrets in the pod. By loading the secrets as files, they can be made available inside the Prometheus pod.
@coboshm
coboshm / golang_kinesis.go
Created August 21, 2017 07:54
Golang + Kinesis firehose
package main
import (
"log"
"encoding/json"
"fmt"
"os"
"math/rand"
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active March 5, 2025 14:02
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@tonywangcn
tonywangcn / gevent_sqlalchemy_example.py
Last active September 16, 2018 03:29
gevent and sqlalchemy usage example
# coding:utf-8
from gevent import monkey, sleep, spawn, joinall
monkey.patch_all()
import datetime
from sqlalchemy import Column, Integer, String, DateTime, Numeric, create_engine, VARCHAR, UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import sqlalchemy
import time
@samuelcolvin
samuelcolvin / aiohttp_vs_sanic.md
Created June 3, 2017 11:55
comparing aiohttp and sanic performance

Requirements

python 3.6, postgres, pip install aiohttp uvloop ujson asyncpg sanic

aiohttp & uvloop

➤ wrk -d 10 -c 100 -t 12 --timeout 8 http://localhost:8000  # aiohttp
Running 10s test @ http://localhost:8000
@RobertoPrevato
RobertoPrevato / aioshot.py
Last active March 11, 2022 15:19
Useful scripts
"""
aiohttp shooting
"""
import os
import asyncio
import aiohttp
import time
url = "https://example/isalive"
@mneedham
mneedham / blog.py
Last active July 11, 2022 03:04
Meetup API -> JSON -> CSV using Python's Luigi library
import json
import os
import luigi
import requests
from collections import Counter
from luigi.contrib.external_program import ExternalProgramTask
class Meetup(luigi.WrapperTask):
def run(self):
@martinburch
martinburch / demo.py
Last active October 16, 2024 14:40
Python 2 MySQL upsert
#!/usr/bin/env python
# encoding: utf-8
import MySQLdb
from upsert import upsert
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="demo", charset="utf8")
c = db.cursor()
import warnings
warnings.filterwarnings("ignore", "Unknown table.*")
@tamas-molnar
tamas-molnar / kubectl-shortcuts.sh
Last active February 22, 2025 20:23
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
@wojteklu
wojteklu / clean_code.md
Last active March 13, 2025 19:37
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules