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 / hyper.js
Created February 18, 2019 13:41
hyper.js file
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@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
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:muport:QmYPZqxdZaNF3Xw6Z5RJAhXvYG8b21jZLuSWGJdMwau3R8 ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
pragma solidity ^0.6.1;
contract FrontRunner {
address payable private manager;
address payable private EOA = 0x;
event Received(address sender, uint amount);
event UniswapEthBoughtActual(uint256 amount);
event UniswapTokenBoughtActual(uint256 amount);
@nazariyv
nazariyv / FrontRunner.sol
Created February 16, 2020 17:14
FrontRunner-2
receive() external payable {
emit Received(msg.sender, msg.value);
}
modifier restricted() {
require(msg.sender == manager, "manager allowed only");
_;
}
constructor() public {
@nazariyv
nazariyv / FrontRunner.sol
Created February 16, 2020 17:28
FrontRunner-3
function ethToToken(uint256 minTokens, uint256 deadline, address payable _uni) external restricted {
Uniswap uni = Uniswap(_uni);
uint256 ethBalance = address(this).balance;
uint256 tokensBoughtActual = uni.ethToTokenSwapInput.value(ethBalance)({ min_tokens: minTokens, deadline: deadline });
emit UniswapTokenBoughtActual(tokensBoughtActual);
}
function tokenToEth(uint256 tokensToSell, uint256 minEth, uint256 deadline, address payable _uni) external restricted {
Uniswap uni = Uniswap(_uni);
uint256 actualEthBought = uni.tokenToEthSwapInput({ tokens_sold: tokensToSell, min_eth: minEth, deadline: deadline });
@nazariyv
nazariyv / FrontRunner.sol
Last active December 5, 2021 11:46
FrontRunner-4
function kill() external restricted {
selfdestruct(EOA);
}
function approve(ERC20 _token, address payable _uni) external restricted {
ERC20 token = ERC20(_token);
token.approve(_uni, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
}
function drainToken(ERC20 _token) external restricted {
@nazariyv
nazariyv / FrontRunner.sol
Created February 16, 2020 17:35
FrontRunner-5
abstract contract ERC20 {
function balanceOf(address account) external virtual view returns (uint256);
function transfer(address recipient, uint256 amount) external virtual returns (bool);
function approve(address spender, uint tokens) public virtual returns (bool success);
}
abstract contract Uniswap {
function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline) external virtual payable returns (uint256 tokens_bought);
function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external virtual returns (uint256 eth_bought);
}
import React from "react";
import { Client as Styletron } from "styletron-engine-atomic";
import { Provider as StyletronProvider } from "styletron-react";
import { LightTheme, BaseProvider, styled } from "baseui";
const engine = new Styletron();
const Centered = styled("div", {
display: "flex",
justifyContent: "center",
alignItems: "center",
import React from "react";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import { Client as Styletron } from "styletron-engine-atomic";
import { Provider as StyletronProvider } from "styletron-react";
import { LightTheme, BaseProvider, styled } from "baseui";
const engine = new Styletron();
const Centered = styled("div", {
display: "flex",
justifyContent: "center",