Skip to content

Instantly share code, notes, and snippets.

View gakonst's full-sized avatar

Georgios Konstantopoulos gakonst

View GitHub Profile
@sbarratt
sbarratt / scrape_ftx.py
Last active July 10, 2023 03:35
A script to export all FTX history
import pandas as pd
import time
import requests
import time
import hmac
from requests import Request
import sys
import json
import os
coverage_report:
name: Generate coverage report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
@karmacoma-eth
karmacoma-eth / quine.etk
Last active March 18, 2023 18:28
EVM quine
# quine.etk
# ⬜ => ⬜
# A quine is a computer program which takes no input and produces a copy of its own source code as its only output.
# 0x80...f3 is the compiled code excluding the push16 instruction (from dup1 to return)
push16 0x8060801b17606f5953600152602136f3
# --- stack ---
dup1 # code code
push1 128 # 128 code code
@yorickdowne
yorickdowne / HallOfBlame.md
Last active June 28, 2024 13:47
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.

The drive lists are ordered by interface and then by capacity and alphabetically by vendor name, not by preference. The lists are not exhaustive at all. @mwpastore linked a filterable spreadsheet in comments that has a far greater variety of drives and their characteristics. Filter it by DRAM yes, NAND Type TLC, Form Factor M.2, and desired capacity.

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.

# add this to your hardhat config
# compilers: [
# {
# version: "0.8.13",
# settings: {
# viaIR: true,
# outputSelection: {
# "*": {
# "*": ["irOptimized"],
# },
@fxfactorial
fxfactorial / example.go
Created February 14, 2022 16:22
ABI encode struct in golang
package main
import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
@spalladino
spalladino / Loans.sol
Created March 20, 2021 16:57
Strawman for flashloans for flashbots
pragma solidity ^0.7.0;
// Each mining pool that intends to provide flash loans deploys a Loaner contract and transfers ETH to it
// When testing each bundle, the diff in balance in this contract is taking into account for calculating effective gas price
// The contract loans funds only on blocks mined by the miner and on zero-gasprice txs
contract Loaner {
address immutable owner;
constructor(address _owner) {
owner = _owner;
@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 }
@dskindell
dskindell / .skhdrc
Last active January 23, 2024 18:46
OSX yabai & skhd Configuration
####### Shortcut Hotkeys #############
# open terminal
lalt - return : $HOME/.config/skhd/open_terminal.sh --single-instance
lalt + shift - return : $HOME/.config/skhd/open_terminal.sh
#alt - t : osascript -e 'tell application "iTerm2" to create window with default profile'
# restart Yabi, SpaceBar, and SKHD
#lalt + lcmd - r : \
# launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"; \
# skhd --reload
@maurelian
maurelian / composability.md
Last active October 20, 2022 16:55
Composability Gotchas

Ethereum Composability Security Guidelines

The following is an informal compendium of ways you can screw up when mixing and matching smart contracts:

ERC20