Skip to content

Instantly share code, notes, and snippets.

View amanelis's full-sized avatar
🧙‍♀️

amanelis

🧙‍♀️
View GitHub Profile
@btschwertfeger
btschwertfeger / spot_orderbook.py
Last active March 9, 2024 19:57
A realtime order book for trading Spot on the Kraken cryptocurrency exchange using the pyhton-kraken-sdk
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
# GitHub: https://github.com/btschwertfeger
#
"""
This module provides an example on how to use the Spot websocket
client of the python-kraken-sdk (https://github.com/btschwertfeger/python-kraken-sdk)
to retrieve and maintain a valid Spot order book for a specific
@yorickdowne
yorickdowne / HallOfBlame.md
Last active May 23, 2024 03:21
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on IOPS, I/O Per Second. Budget SSDs will struggle to an extent, and some won't be able to sync at all.

This document aims to snapshot some known good and known bad models.

For size, 4TB comes recommended as of mid 2024. The smaller 2TB drive should last an Ethereum full node until early 2025 or thereabouts, with crystal ball uncertainty. Remy wrote a migration guide to 4TB.

High-level, QLC and DRAMless are far slower than "mainstream" SSDs. QLC has lower endurance as well. Any savings will be gone when the drive fails early and needs to be replaced.

@0xAlcibiades
0xAlcibiades / Multicall.sol
Created March 22, 2022 00:19
A Pre EIP-1559 MEV/Multicall in pure Yul integrated with ApeBank and with Native GasTokens
// SPDX-License-Identifier: MIT
object "Multicall" {
code {
// Deploy the contract
// Store gas token burn cost in zero slot
sstore(0, 0)
sstore(1, 0)
sstore(2, 0)
datacopy(0x0, dataoffset("MulticallRuntime"), datasize("MulticallRuntime"))
@fxfactorial
fxfactorial / extract_top_peers.py
Created February 4, 2022 02:47 — forked from bogatyy/extract_top_peers.py
Extract top peers
from collections import defaultdict
GETH_LOGFILE = 'geth-log.txt'
def extract_parameter(source_str, before_str, after_str):
start_pos = source_str.find(before_str) + len(before_str)
return source_str[start_pos:source_str.find(after_str, start_pos)]
object "Contract" {
code {
datacopy(0, dataoffset("runtime"), datasize("runtime"))
return(0, datasize("runtime"))
}
object "runtime" {
code {
if iszero(calledByOwner()) { revert(0, 0) }
switch selector()
case 0x00 {
@bogatyy
bogatyy / extract_top_peers.py
Created June 30, 2021 22:46
Extract top peers
from collections import defaultdict
GETH_LOGFILE = 'geth-log.txt'
def extract_parameter(source_str, before_str, after_str):
start_pos = source_str.find(before_str) + len(before_str)
return source_str[start_pos:source_str.find(after_str, start_pos)]
@yorickdowne
yorickdowne / GethBEHAVE.md
Last active May 23, 2024 03:03
Pruning Geth 1.10.x, 1.11.x, 1.12.x

Note: PBSS in Geth >=1.13.0 removes the need to prune manually.


Old content for reference

Overview

Geth (Go-Ethereum) as of July 2022 takes about 650 GiB of space on a fast/snap sync, and then grows by ~ 14 GiB/week with default cache, ~ 8 GiB/week with more cache.

@ansemjo
ansemjo / ubuntu-cleaner.sh
Last active May 20, 2024 18:55
Clean up unwanted packages on a fresh installation of Ubuntu 20.04 LTS
#!/usr/bin/env bash
set -eu
# mark a few packages as explicitly installed
mark-wanted() {
apt install -y \
bash git tmux vim htop \
unattended-upgrades \
software-properties-common;
}
@cryptoscopia
cryptoscopia / dydxFlashLoanTemplate.sol
Created October 21, 2020 06:42
A single-file simplest possible template for a contract that obtains a flash loan from dydx, does things, and pays it back.
// SPDX-License-Identifier: AGPL-3.0-or-later
// The ABI encoder is necessary, but older Solidity versions should work
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// These definitions are taken from across multiple dydx contracts, and are
// limited to just the bare minimum necessary to make flash loans work.
library Types {
enum AssetDenomination { Wei, Par }
@anubhavgirdhar
anubhavgirdhar / EIP712.sol
Created August 5, 2020 16:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.5.0;
contract EIP712 {
mapping(address => uint256) public nonces;
struct EIP712Domain {
string name;
string version;
uint256 chainId;