Skip to content

Instantly share code, notes, and snippets.

@matthen
matthen / hello_world.py
Last active August 29, 2024 12:50
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
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 November 5, 2024 18:44
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:

@niranjan-nagaraju
niranjan-nagaraju / tcpdump_tcpreplay.org
Last active October 14, 2024 17:16
TCPReplay/TCPRewrite/TCPPrep/TCPDump Cheatsheet

TCPReplay/TCPRewrite/TCPPrep/TCPDump Cheatsheet

tcprewrite

Rewrite IP/Mac addresses, -C optionally to fix checksums

  1. tcpprep, first:C2S, Second S2C, Generate cache file