Skip to content

Instantly share code, notes, and snippets.

@matthen
matthen / hello_world.py
Last active November 25, 2024 21:51
Hello world in python, using genetic algorithm
"""Hello world, with a genetic algorithm.
https://twitter.com/matthen2/status/1769368467067621791
"""
import random
import time
from dataclasses import dataclass
from itertools import chain
from typing import Iterable, List

Beacon light sync top level overview

This document gives a top level view of the blsync PR in order to help the review/merge process. It describes the most important mechanisms and data structures and how they are used in this PR (sometimes also how they are going to be used later).

The current PR implements an MVP feature called blsync that can light sync the beacon chain from a beacon node that supports the light_client REST API namespace (Lodestar or Nimbus) and drive an EL node through the engine API. Its components are sometimes more general purpose though as they are also intended to be part of the new full featured PoS capable Geth light mode. Note that a significant part of this PR (more specifically light.LightChain, merkle.MultiProof, sync.HeaderSync, sync.StateSync) are only used here in order to get the finalized block hash out of the beacon state. It is a possible option to strip down the PR even further by removing this featu

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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Ethereum helper methods
# source this in your .bashrc or .zshrc file with `. ~/.ethrc`
# --- Solidity sandbox ---
# https://github.com/maurelian/solidity-sandbox
scratch() {
dir=$(pwd)
cd ~/Documents/projects/solidity-sandbox || exit
bash newTest.sh $1
cd "$dir" || exit
@aleph-v
aleph-v / buy.ts
Created May 24, 2021 15:54
Example trade which buys pt
import { Vault__factory } from "typechain/factories/Vault__factory";
import { ethers } from "hardhat";
import * as readline from "readline-sync";
const BALANCER_VAULT_ADDRESS = "";
const PT_POOL_ADDRESS = "";
const PT_ADDRESS = "";
const UNDERLYING_ADDRESS = "";
const UNDERLYING_DECIMALS = 18;
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" monitorInterval="5">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="%white{%d{yyyy-MM-dd HH:mm:ss.SSS}} | %-25.25t | %-5level | %-30.30c{1} | %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="org.quartz" level="INFO"/>
@frostiq
frostiq / interest-rates-ingestion-API.txt
Last active July 31, 2021 20:53
LoanScan interest rates ingestion API spec
Interest rates ingestion endpoint is a HTTP GET endpoint available via https protocol
e.g. "https://example.com/rates?api-key=XXXXXXXXXXX"
If this endpoint requires an API key, it should be accepted as a query string parameter, HTTP headers are not supported
The response should be a JSON object that corresponds to the following example:
{
    "lendRates": [
        {
            "apy": 0.0100005, // Annual Percentage Yield, multiplier format
            "apr": 0.01, // Annual Percentage Rate, multiplier format
@psignoret
psignoret / ADAL_with_vanilla_JS.md
Last active May 11, 2021 14:15
Minimal sample app using ADAL.JS and vanilla JavaScript

Using ADAL.JS with vanilla JavaScript

A minimal sample app using ADAL.JS and plain old vanilla JavaScript to obtain an access token from Azure Active Directory and use that access token to make an API request. In this case, the API we're requesting a token for is the Microsoft Graph API, which is used to retrieve the signed-in user's basic profile.

You can see (and test) this live at: https://bl.ocks.org/psignoret/raw/50e88652ae5cb6cc157c09857e3ba87f/

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active January 15, 2026 07:26
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: