Skip to content

Instantly share code, notes, and snippets.

View nazariyv's full-sized avatar
🔭
You study mathematics because it is the poetry of the universe

naz nazariyv

🔭
You study mathematics because it is the poetry of the universe
View GitHub Profile
@nazariyv
nazariyv / gist:c6a8e3b8c4b57d6f9469feeb9a7f3fd0
Created February 26, 2019 16:05 — forked from amcgregor/gist:405354
Python timeit benchmarking for realistic optimizations.
# All units in usecs (µsec) comparing Python 2.7 | 3.7.
# Last updated: 2019-02-11
# MacBook Pro (15-inch, 2016)
# macOS 10.14.3
# 2.7 GHz Intel Core i7
# 16 GB 2133 MHz LPDDR3
python -m timeit "200 <= 250 < 300" # 0.0354 | 0.059
python2.7 -m timeit "250 in xrange(200, 300)" # 1.25
@nazariyv
nazariyv / README.md
Created July 9, 2020 13:32 — forked from excavador/README.md
automatically add alias ip address to loopback

Motivation

You have often several docker containers and applications which work together on local development. You need the following communications:

  • docker container to localhost
  • localhost to docker container
  • docker container to docker container

You have a way to connect localhost-to-docker using -p (port-mapping) docker option. For instance, you can start PostgreSQL container using -p 0.0.0.0:5432:5432 and then connect like to normal PostgreSQL

@nazariyv
nazariyv / README.md
Last active July 9, 2020 13:47 — forked from excavador/README.md
automatically add alias ip address to loopback

Motivation

You often have several docker containers and applications which work together in the locel development environment. You need the following communications:

  • docker container to localhost
  • localhost to docker container
  • docker container to docker container

You have a way to connect localhost-to-docker using -p (port-mapping) docker option. For instance, you can start PostgreSQL container using -p 0.0.0.0:5432:5432 and then connect like to normal PostgreSQL

@nazariyv
nazariyv / README.md
Created October 22, 2020 09:23 — forked from danburzo/README.md
Get all event listeners on the page in Google Chrome
const {
html,
render,
useState,
useEffect,
useLayoutEffect
} = await import('https://unpkg.com/htm/preact/standalone.module.js');
const {
@nazariyv
nazariyv / wsl-setup.md
Created April 5, 2021 18:59 — forked from imfing/wsl-setup.md
WSL + ZSH + Hyper Setup

My WSL Setup

A guide to setup your WSL with Hyper and zsh

Download & Install the WSL

  • Follow the very thorough instructions here

Get a prettier terminal

  • Download Hyper.js here - I went with the 'hyperblue' theme.
@nazariyv
nazariyv / decorator.py
Created October 6, 2021 19:38 — forked from jaantollander/decorator.py
Template for Python decorator function and class
import functools
def decorator(function):
"""A general decorator function"""
@functools.wraps(function)
def wrapper(*args, **kwargs):
# Write decorator function logic here
# Before function call