Skip to content

Instantly share code, notes, and snippets.

@alextes
alextes / new-builder.md
Last active December 13, 2023 10:28
Guide for new builders to get the most out of the ultra sound relay.

New Builder Guide

First steps

  1. collocate next to OVH Roubaix (France)
  2. use SSZ submissions instead of JSON
  3. submit blocks more frequently (we don't have ratelimitting; please don't abuse)

Optimistic Relaying

See: builder-onboarding.md

@alextes
alextes / fixcurrent.lua
Last active September 20, 2023 13:09
FixCurrent script for code actions in neovim in Lua
return function()
local params = vim.lsp.util.make_range_params() -- get params for current position
params.context = {
diagnostics = vim.lsp.diagnostic.get_line_diagnostics(),
only = { "quickfix" },
}
local actions_per_client, err = vim.lsp.buf_request_sync(
0,
"textDocument/codeAction",
@alextes
alextes / README.md
Last active December 1, 2022 18:24 — forked from palewire/README.md
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

@alextes
alextes / etag_middleware.rs
Last active November 30, 2023 20:00
ETag middleware for use with Axum. It'd be nice to write a proper implementation as a Tower service.
async fn etag_middleware<B: std::fmt::Debug>(
req: Request<B>,
next: Next<B>,
) -> Result<Response, StatusCode> {
let if_none_match_header = req.headers().get(header::IF_NONE_MATCH).cloned();
let path = req.uri().path().to_owned();
let res = next.run(req).await;
let (mut parts, mut body) = res.into_parts();
let bytes = {
@alextes
alextes / abi.json
Last active June 16, 2022 21:10
Script to decode deposits and withdrawals in the MapleFinance Maven11 USDC pool.
[ { "inputs": [ { "internalType": "address", "name": "_poolDelegate", "type": "address" }, { "internalType": "address", "name": "_liquidityAsset", "type": "address" }, { "internalType": "address", "name": "_stakeAsset", "type": "address" }, { "internalType": "address", "name": "_slFactory", "type": "address" }, { "internalType": "address", "name": "_llFactory", "type": "address" }, { "internalType": "uint256", "name": "_stakingFee", "type": "uint256" }, { "internalType": "uint256", "name": "_delegateFee", "type": "uint256" }, { "internalType": "uint256", "name": "_liquidityCap", "type": "uint256" }, { "internalType": "string", "name": "name", "type": "string" }, { "internalType": "string", "name": "symbol", "type": "string" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "in
This file has been truncated, but you can view the full file.
{
"id": "3",
"name": "Curve",
"address": "0xD533a949740bb3306d119CC777fa900bA034cd52",
"symbol": "CRV",
"url": "https://curve.fi",
"description": "Curve is a decentralized exchange liquidity pool on Ethereum designed for extremely efficient stablecoin trading",
"chain": "Ethereum",
"logo": "https://icons.llama.fi/curve.png",
"audits": "2",
This file has been truncated, but you can view the full file.
{
"id": "111",
"name": "AAVE",
"address": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
"symbol": "AAVE",
"url": "https://aave.com\r\n",
"description": "Aave is an Open Source and Non-Custodial protocol to earn interest on deposits and borrow assets",
"chain": "Ethereum",
"logo": "https://icons.llama.fi/aave.png",
"audits": "2",
This file has been truncated, but you can view the full file.
[
{
"id": "118",
"name": "MakerDAO",
"address": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
"symbol": "MKR",
"url": "https://makerdao.com/",
"description": "Builders of Dai, a digital currency that can be used by anyone, anywhere.\r\n",
"chain": "Ethereum",
"logo": "https://icons.llama.fi/makerdao.jpg",
@alextes
alextes / make_twitter_entities_elements.ts
Created March 25, 2022 13:25
Turning a plain text Twitter bio into one containing urls, mentions, hashtags, and cashtags using TypeScript and React.
// Types describing the various objects found in twitter's entities.
type LinkableUrl = {
display_url: string;
end: number;
expanded_url: string;
start: number;
};
type LinkableMention = {
start: number;
@alextes
alextes / Day1.purs
Last active December 2, 2021 22:54
Solutions to Day 1 of Advent of Code in PureScript
module Day1 (getPuzzleInput, getSolution1, getSolution2) where
import Prelude
import Data.Array as Array
import Data.Foldable as Foldable
import Data.Int as Int
import Data.String (Pattern(..))
import Data.String as Str
import Effect (Effect)
import Node.Encoding (Encoding(..))