Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Max Voitko mvoitko

🎯
Focusing
View GitHub Profile
@mvoitko
mvoitko / Test.java
Created Dec 7, 2016 — forked from klepikov/Test.java
Demo code for the GTAC 2013 talk "Web Performance Testing with WebDriver" by Michael Klepikov
View Test.java
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.*;
View pyproject.toml
[tool.poetry]
name = "rating-engine"
version = "0.1.0"
description = ""
authors = ["Alex Tonkonozhenko <oleksandr.tonkonozhenko@glomex.com>"]
[tool.poetry.dependencies]
python = "^3.6"
lxml = "^4.2"
numpy = "^1.14"
View gist:7563e8dcdf3716f315ded140a5aeba34
[tool.poetry]
name = "dphelper"
version = "0.1.6.dev0"
description = ""
authors = ["Alex Tonkonozhenko <oleksandr.tonkonozhenko@glomex.com>"]
[tool.poetry.dependencies]
python = "*"
psycopg2-binary = "^2.7"
glomex-utils = "^0.0"
@mvoitko
mvoitko / Dockerfile
Last active Jul 23, 2019
Python Project Dockerfile template
View Dockerfile
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 Jul 20, 2019
Lambda Base image
View Dockerfile
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 Jul 20, 2019
Apex deploy image
View Dockerfile
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 Jul 20, 2019
Docker image based on Alpine with Tensorflow
View Dockerfile
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 Jul 23, 2019
The elegant method of activating virtualenv in Python container
View Dockerfile
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 Jul 31, 2019
NestedDict class
View NestedDict.py
"""
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 Sep 15, 2020
Every Programmer Should Know These Latency Numbers
View Latencies.md

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