This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1/ install ubuntu live server (skip docker here and manually post-install (during ubuntu install it will use snap socker and it's utter shit and will cause you headaches), openssh) | |
2/ set static ip (/etc/netplan/static.yaml): | |
network: | |
version: 2 | |
renderer: networkd | |
ethernets: | |
<your-interface>: | |
addresses: | |
<your-local-static-ip> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def int_to_privkey(n): | |
hex_n = hex(n)[2:] # convert to hexadecimal and strip the "0x" prefix | |
return hex_n.rjust(64, '0') # pad with zeros to the left until it's 64 characters long | |
int_to_privkey(random.randing(0, 2 ** 256 - 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Two pointers: one input, opposite ends | |
```python3 | |
def fn(arr): | |
left = ans = 0 | |
right = len(arr) - 1 | |
while left < right: | |
# do some logic here with left and right | |
if CONDITION: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def number_to_base(n, b): | |
if n == 0: | |
return [0] | |
digits = [] | |
while n: | |
digits.append(int(n % b)) | |
n //= b | |
return digits[::-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Dict, Tuple | |
from brownie import accounts, chain | |
from dataclasses import dataclass | |
# ! 1. losing threshold to be set manually here | |
# ! 2. bids to be set manually here | |
# ! 3. set the account to rkl refunder account in main | |
# if the bid is below this value, it has lost the auction | |
# it is possible that there may be two bids for the same |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
def decorator(function): | |
"""A general decorator function""" | |
@functools.wraps(function) | |
def wrapper(*args, **kwargs): | |
# Write decorator function logic here | |
# Before function call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to read the logs that cron produced due to running something: cat /var/mail/$USER | |
to read the logs of when and if cron launched jobs: sudo cat /var/log/cron | |
to restart the cron service: sudo systemctl restart crond |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://crontab.guru/every-5-minutes | |
crontab -e | |
sudo service crond restart | |
sudo cat /var/log/cron | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The tutorials below explain how to start the IPFS node on AWS. Of note are the networking (the ports required to open) as well as | |
setting up the IPFS env var to persist the data: | |
https://medium.com/textileio/tutorial-setting-up-an-ipfs-peer-part-i-de48239d82e0 | |
https://talk.fission.codes/t/a-loosely-written-guide-to-hosting-an-ipfs-node-on-aws/234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# references | |
# 1. https://uniswap.org/docs/v2/javascript-SDK/getting-pair-addresses/ | |
# 2. https://ethereum.stackexchange.com/questions/90539/how-to-get-the-non-packed-soliditykeccak-hash-in-python-web3 | |
# deps | |
# Python 3.9.5 | |
# 1. eth-abi==2.1.1 | |
# 2. web3==5.18.0 | |
NewerOlder