Skip to content

Instantly share code, notes, and snippets.

View an-ivannikov's full-sized avatar

Aleksandr Ivannikov an-ivannikov

View GitHub Profile
@an-ivannikov
an-ivannikov / Protonmail.md
Created June 10, 2023 10:29 — forked from githubcom13/Protonmail.md
Configure the protonmail bridge linux client on Ubuntu 20.04 and Debian 10 server

Protonmail on Ubuntu 20.04 and Debian 10 server

#protonmail #debian #linux

Before you start

Currently protonmail bridge for linux is distributed as part of an open beta program, but soon it will be made public (https://protonmail.com/bridge/install).

Consider that the bridge linux client requires a paid protonmail account to work.

Get the protonmail bridge linux installer

@an-ivannikov
an-ivannikov / QuickSort.sol
Created March 5, 2023 22:45 — forked from subhodi/QuickSort.sol
Quick sort in Solidity for Ethereum network
pragma solidity ^0.4.18;
contract QuickSort {
function sort(uint[] data) public constant returns(uint[]) {
quickSort(data, int(0), int(data.length - 1));
return data;
}
function quickSort(uint[] memory arr, int left, int right) internal{
@an-ivannikov
an-ivannikov / get-uniswap-init-code-hash.js
Last active June 19, 2022 12:04
Get Uniswap Init Code Hash
const ValueswapV2Pair = artifacts.require('ValueswapV2Pair.sol');
module.exports = async (callback) => {
console.log(
'ValueswapV2Pair bytecode hash (Look for INIT_CODE_HASH):\n%s',
(web3.utils.keccak256(ValueswapV2Pair.bytecode)).substring(2)
);
callback();
}
@an-ivannikov
an-ivannikov / GethBEHAVE.md
Created May 29, 2022 22:28 — forked from yorickdowne/GethBEHAVE.md
Pruning Geth 1.10.x

Overview

Geth (Go-Ethereum) as of January 2022 takes about 500 GiB of space on a fast/snap sync, and then grows by ~ 10 GiB/week. This will fill a 1TB SSD in ~6 months, to the point where space usage should be brought down again with an offline prune.

Happily, Geth 1.10.x introduces "snapshot offline prune", which brings it back down to about its original size. It takes roughly 4 hours to prune the Geth database, and this has to be done while Geth is not running.

Caveat that while several folx have used offline pruning successfully, there is risk associated with it. The two failure modes we have seen already are:

  • There is 25 GiB or less of free disk space
https://abi.hashex.org/
The problem is that you first need to compile the `uniswap-v2-core` contracts
Next, you need to get `INIT_CODE_HASH` from the bytecode of the `UniswapV2Pair.sol`
```js
// file ./get-init-code-hash.js
const UniswapV2Pair = artifacts.require('UniswapV2Pair.sol');
module.exports = async (callback) => {
console.log(
'UniswapV2Pair bytecode hash (Look for INIT_CODE_HASH):\n%s',
> https://www.codebales.com/cannot-find-in-scope
```
Clean build folder (shift + command + k)
Close Xcode completely
Delete 'DerivedData' content (/Library/Developer/Xcode/DerivedData)
Open Xcode and your project again
Try to build and run it again
```
@an-ivannikov
an-ivannikov / gist:c497183c6f3c8a77c3c7cc9dbc7179d0
Created October 26, 2021 20:37
VirtualBox Mac - Kernel driver not installed (rc=-1908)
# VirtualBox Mac - Kernel driver not installed (rc=-1908)
> https://vc.ru/dev/287597-virtualbox-na-mac-kernel-driver-not-installed-rc-1908-proverennoe-reshenie
@an-ivannikov
an-ivannikov / Component.js
Last active February 20, 2021 04:54
Synchronizing Request and Filter Parameters in React
import * as React from 'react';
import { useLocation, useHistory } from 'react-router-dom';
import queryString from 'query-string';
export default function Component(props) {
const history = useHistory();
const location = useLocation();
const initSearch = location.search;
@an-ivannikov
an-ivannikov / 1-check-telegram-auth-data.js
Last active May 10, 2022 11:42
Checking Telegram Auth Data in Express.js
const { createHash, createHmac } = require('crypto');
function checkTelegramAuthData({ token, hash, ...data }) {
const secret = createHash('sha256')
.update(token)
.digest();
const stringToCheck = Object.keys(data)