Skip to content

Instantly share code, notes, and snippets.

View solesensei's full-sized avatar
on a coffee break

Dima Goncharenko solesensei

on a coffee break
View GitHub Profile
@solesensei
solesensei / fspace.sh
Created February 17, 2020 19:15
Script counts files in directory | Calculating nonfree space
#!/bin/bash
# Script counts files and nonfree space recursively
# add to alias fspace="bash path/to/script"
# usage: fspace [--files|-f] [--depth|-d num (2 - default)]
function usage ()
{
echo "Usage:"
echo "fspace [--files|-f] [--depth|-d num] - print non-free space of each directory recursively"
@solesensei
solesensei / vim_monokai.sh
Created February 17, 2020 19:14
Install vim monokai theme script
#!/bin/bash
# Installing vim and downloading theme vim-monokai
# source monokai: https://github.com/sickill/vim-monokai
echo -ne "Downloading Monokai theme..."\\r
sleep 0.5
wget https://raw.githubusercontent.com/sickill/vim-monokai/master/colors/monokai.vim &> /dev/null
echo "Downloaded Monokai theme! "
@solesensei
solesensei / Dockerfile
Created February 17, 2020 19:11
Nginx | Frontend | Backend | Swagger | Docker Compose | Environment Variables
FROM ubuntu:bionic
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get update -y && apt-get install -y --no-install-recommends build-essential gettext-base nodejs nginx supervisor && rm -rf /var/lib/apt/lists/*
ENV APPDIR /app
COPY . $APPDIR
WORKDIR $APPDIR
RUN npm i && npm run build
@solesensei
solesensei / lru_cache.py
Last active February 17, 2020 11:00
LRU cache decorator | Async LRU cache decorator | Python 3.7
from functools import wraps
def lru_cache(maxsize=None):
_cache = {}
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
key = tuple(args) + tuple(sorted(kwargs.items()))
@solesensei
solesensei / detect_day_night.py
Last active April 19, 2019 08:07
Simple script to detect time of day on images
import os
import cv2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# ------------- Parametrs -------------
img_root = "/mnt/w/prj/data/bdd100k/"
csv_new = "bdd100k_train.csv"
col_names = ['image_filename', 'lighting', 'pixels_light']
@solesensei
solesensei / interactive_input.py
Last active April 3, 2019 07:57
Python script which make you able to edit stdout printed text
# Script make you able to edit printed text
# stdin and stdout at the same time
# https://asciinema.org/a/238478
# https://gist.github.com/SoleSensei/05a97bbe8b75cd2368a8e6d5e00d6047
import sys
from getch import getch
def flush_append(char):
# just append char to the end
sys.stdout.write(char)
@solesensei
solesensei / prolog_func.pl
Last active April 3, 2019 08:03
Some useful basic Prolog functions by SoleSensei
% Some useful basic Prolog functions
% CMC MSU, 7 sem
% ? member(X, Y) - check if element X is in list Y
member(X, [X|L]).
member(X, [Y|L]) :- member(X, L)
% ? concat(L1,L2,L3) - concatenate lists L3 = L1L2
concat(L1, [], L1).
concat(L1, [X|L2], [X|L3]) :- concat(L1,L2,L3)
@solesensei
solesensei / Travelling Salesman Problem.pdf
Last active November 26, 2018 20:42
Travelling Salesman Problem TeX ( Задача Коммивояжера)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
  1. Целями стандарта являются (отметьте правильное)
  • +Соответствие качества современному уровню развития технологий
  • +Защита потребителя
  • Лоббирования национальные интересов
  • +Защита инвестиций
  • +Совместимости и взаимозаменяемости собъектами стандартизации той же категории
  • Продвижение продуктов на рынке
  • +Единства измерений
  • +Обеспечение безопасности объекта стандартизации для окружающей среды

@solesensei
solesensei / MathPhys13.pdf
Last active January 11, 2018 17:00
Equations of Mathematical Physics. 13
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.