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
@nazariyv
nazariyv / cursor
Created August 25, 2024 12:53 — forked from swayducky/cursor
This fixes using "cursor" command in WSL
#!/usr/bin/env sh
# LATEST VERSION OF THIS SCRIPT: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4
# FORKED FROM: https://gist.github.com/ddwang/0046da801bcb29d241869d37ad719394
# 1) No longer has a hard-coded COMMIT
# 2) Auto-symlinks a "code" script to avoid wslCode.sh breaking
# HOW TO INSTALL:
# 1) Remove "c:\Users\<USER_NAME>\AppData\Local\Programs\cursor\resources\app\bin" from Windows Environment Settings
# 2) Modify this script with your Windows <USER_NAME> (NOT your WSL username) in the VSCODE_PATH variable
{"version":"0.1.0","name":"pump","instructions":[{"name":"initialize","docs":["Creates the global state."],"accounts":[{"name":"global","isMut":true,"isSigner":false},{"name":"user","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false}],"args":[]},{"name":"setParams","docs":["Sets the global state parameters."],"accounts":[{"name":"global","isMut":true,"isSigner":false},{"name":"user","isMut":true,"isSigner":true},{"name":"systemProgram","isMut":false,"isSigner":false},{"name":"eventAuthority","isMut":false,"isSigner":false},{"name":"program","isMut":false,"isSigner":false}],"args":[{"name":"feeRecipient","type":"publicKey"},{"name":"initialVirtualTokenReserves","type":"u64"},{"name":"initialVirtualSolReserves","type":"u64"},{"name":"initialRealTokenReserves","type":"u64"},{"name":"tokenTotalSupply","type":"u64"},{"name":"feeBasisPoints","type":"u64"}]},{"name":"create","docs":["Creates a new coin and bonding curve."],"accounts":[{"name":"mint","isMut":true,"isSigner":true},{"n