Skip to content

Instantly share code, notes, and snippets.

View mvoitko's full-sized avatar
🎯
Focusing

Max Voitko mvoitko

🎯
Focusing
View GitHub Profile
@mvoitko
mvoitko / Test.java
Created December 7, 2016 15:20 — forked from klepikov/Test.java
Demo code for the GTAC 2013 talk "Web Performance Testing with WebDriver" by Michael Klepikov
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import org.json.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.logging.*;
[tool.poetry]
name = "rating-engine"
version = "0.1.0"
description = ""
authors = ["Alex Tonkonozhenko <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.6"
lxml = "^4.2"
numpy = "^1.14"
@mvoitko
mvoitko / gist:7563e8dcdf3716f315ded140a5aeba34
Created January 30, 2019 21:34
dphelper/pyproject.toml
[tool.poetry]
name = "dphelper"
version = "0.1.6.dev0"
description = ""
authors = ["Alex Tonkonozhenko <[email protected]>"]
[tool.poetry.dependencies]
python = "*"
psycopg2-binary = "^2.7"
glomex-utils = "^0.0"
@mvoitko
mvoitko / Dockerfile
Last active July 23, 2019 12:30
Python Project Dockerfile template
FROM python:3.7.3-stretch
COPY app /app
RUN pip install pip==19.0.3
RUN pip install poetry==1.0.0a2
RUN source $HOME/.poetry/env
RUN poetry install
RUN useradd --create-home appuser
@mvoitko
mvoitko / Dockerfile
Created July 20, 2019 11:29
Lambda Base image
ARG PYTHON_VERSION
FROM lambci/lambda:build-python$PYTHON_VERSION
RUN pip install -U pip
RUN pip install poetry==1.0.0a2
COPY bin/entrypoint /bin
ENV AWS_REGION="eu-west-1"
@mvoitko
mvoitko / Dockerfile
Created July 20, 2019 11:33
Apex deploy image
ARG PYTHON_VERSION
FROM {registry_url}/lambda-base-image:$PYTHON_VERSION-0.5.0
RUN curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sh
ADD bin/download_terraform.sh /bin
RUN /bin/download_terraform.sh
@mvoitko
mvoitko / Dockerfile
Created July 20, 2019 11:37
Docker image based on Alpine with Tensorflow
FROM python:3.6-alpine
ARG ENV
WORKDIR /app
RUN pip install -U pip
RUN pip install awscli
RUN mkdir train && \
aws s3 cp s3://{bucket}/{model_file}.model train/{model_file}.model
@mvoitko
mvoitko / Dockerfile
Created July 23, 2019 12:29
The elegant method of activating virtualenv in Python container
FROM ubuntu:18.04
RUN apt-get update && apt-get install \
-y --no-install-recommends python3 python3-virtualenv
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m virtualenv --python=/usr/bin/python3 $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install dependencies:
COPY requirements.txt .
@mvoitko
mvoitko / NestedDict.py
Created July 31, 2019 08:06
NestedDict class
"""
Module for managing nested dictionary collections.
"""
# nestdict.py by Adam Szieberth (2013)
# Python 3.3+
class NestedDict(dict):
"""
Class for managing nested dictionary structures. Normally, it works
@mvoitko
mvoitko / Latencies.md
Last active September 15, 2020 23:02
Every Programmer Should Know These Latency Numbers

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs