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 / 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 / go-singleton.go
Created August 20, 2020 20:04
go-singleton
var once sync.Once
// type global
type singleton map[string]string
var instance singleton
func NewClass() singleton {
once.Do(func() { // <-- atomic, does not allow repeating
instance = make(singleton) // <-- thread safe
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreihwe4xgtbj6r6jhca47r23a5e77jlk4kl2rpic72c4wqs2vocpebm ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@nazariyv
nazariyv / merkle-patricia-trie.ipynb
Last active August 27, 2020 09:28
1-ethereum-components
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nazariyv
nazariyv / merkle-patricia-trie.ipynb
Created August 27, 2020 10:29
Ethereum Primitives #1.2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nazariyv
nazariyv / MyFlashLoan.sol
Created September 13, 2020 13:18
Flash loan contract
pragma solidity ^0.6.6;
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/FlashLoanReceiverBase.sol";
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPoolAddressesProvider.sol";
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPool.sol";
contract Flashloan is FlashLoanReceiverBase(0x2bdf0d8b4c67C1e9CC5989bf507E2a307B1aE3e1) {
constructor(address _addressProvider) public {}
/**
@nazariyv
nazariyv / MyFlashLoan.sol
Created September 13, 2020 13:39
Full template of a contract that can flashloan from Aave. You also need to add your own logic in terms of what you want to do with the lent amounts in the executeOperation function
pragma solidity ^0.6.6;
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/FlashLoanReceiverBase.sol";
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPoolAddressesProvider.sol";
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/ILendingPool.sol";
contract Flashloan is FlashLoanReceiverBase {
constructor(address _addressProvider) FlashLoanReceiverBase(_addressProvider) public {}
/**
@nazariyv
nazariyv / git.txt
Created September 17, 2020 11:09
GIT SETUP
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "[email protected]"
@nazariyv
nazariyv / OceanMVP.tsx
Created September 29, 2020 00:13
usePublish infinite loop
import React, { useMemo } from 'react';
import { useOcean, usePublish } from '@oceanprotocol/react';
import { Metadata } from "@oceanprotocol/lib"
type MVPProps = {
dtName?: string;
dtSymbol?: string;
}
const MVP: React.FC<MVPProps> = ({ dtName, dtSymbol }) => {
@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