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 <oleksandr.tonkonozhenko@glomex.com>"]
[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 <oleksandr.tonkonozhenko@glomex.com>"]
[tool.poetry.dependencies]
python = "*"
psycopg2-binary = "^2.7"
glomex-utils = "^0.0"
@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 / 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 / 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
Find the number of times f() is called as a function of the input size n.
a. for (i = n; i > 1; i /= 2)
f()
a. O(log n)
b. for (i = 0; i * i < n; i++)
f()
b. O(sqrt n)