Skip to content

Instantly share code, notes, and snippets.

View arsenyinfo's full-sized avatar

Arseny Kravchenko arsenyinfo

View GitHub Profile
@arsenyinfo
arsenyinfo / Dockerfile
Last active July 30, 2018 15:53
densepose
# this Dockerfile is based on https://github.com/facebookresearch/DensePose/blob/master/docker/Dockerfile
FROM caffe2/caffe2:snapshot-py2-cuda9.0-cudnn7-ubuntu16.04
RUN mv /usr/local/caffe2 /usr/local/caffe2_build
ENV Caffe2_DIR /usr/local/caffe2_build
ENV PYTHONPATH /usr/local/caffe2_build:${PYTHONPATH}
ENV LD_LIBRARY_PATH /usr/local/caffe2_build/lib:${LD_LIBRARY_PATH}
RUN git clone https://github.com/facebookresearch/densepose /densepose
@arsenyinfo
arsenyinfo / lut3d.py
Created April 17, 2018 14:16
Apply 3D LUT to an image. It's not optimized yet, however works as an acceptable PoC
from functools import partial
import numpy as np
from tqdm import tqdm
LUT_SIZE = 33
def _convert(pixel, lut):
r, g, b = map(lambda x: round((x / 255) * LUT_SIZE - 1), pixel)
idx = r + g * LUT_SIZE + b * (LUT_SIZE ** 2)
@arsenyinfo
arsenyinfo / df_to_prom.py
Created January 17, 2017 15:30
Convert pandas DataFrame to Prometheus (https://prometheus.io) text format
from datetime import datetime
from itertools import product
from random import randint
import pandas as pd
def generate_df():
# just example
index = pd.date_range('2017-01-01', datetime.now(), freq='H')
@arsenyinfo
arsenyinfo / producthunt.py
Created March 5, 2016 20:47
This script can be useful if you need to parse products from Product Hunt into single table. It was tested with Python 3 but probably will work with Python 2.7 as well.
import logging
import pandas as pd
import requests
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%H:%M:%S', )
logger = logging.getLogger(__name__)
token = 'Bearer INSERT_YOUR_TOKEN_HERE'