Skip to content

Instantly share code, notes, and snippets.

View Huge's full-sized avatar
💭
Looking for work in cryptocurrency operations

Huge

💭
Looking for work in cryptocurrency operations
View GitHub Profile
# Machine Intelligence Made to Impersonate Characteristics: MIMIC
# NOTE run this $ conda install -c conda-forge mpi4py mpich to get mpi working
# accelerate launch --use_deepspeed -m axolotl.cli.train ./config_name_here
base_model: alpindale/Mistral-7B-v0.2-hf
base_model_config: alpindale/Mistral-7B-v0.2-hf
model_type: MistralForCausalLM
tokenizer_type: LlamaTokenizer
is_mistral_derived_model: true
@Maximilian-Winter
Maximilian-Winter / gbnf_grammar_generator.py
Last active April 24, 2024 22:03
GBNF grammar generator for always valid function calls and object creation in JSON with llama.cpp
import inspect
import json
import re
import typing
from inspect import isclass, getdoc
from types import NoneType
from pydantic import BaseModel, Field
from pydantic.fields import FieldInfo
from typing import Any, Type, List, get_args, get_origin, Tuple, Union, Optional
@Rhynorater
Rhynorater / nextContractAddr.js
Created October 11, 2021 06:53
Quick command-line script to predict the next contract address for an account based off its current nonce and address.
var web3 = require('web3');
var rlp = require('rlp');
var process = require( 'process' );
var nonce = parseInt(process.argv[3]);
var account = process.argv[2];
var d = web3.utils.sha3(rlp.encode([account, nonce]));
console.log("0x"+d.substring(d.length-40));
@dougbtv
dougbtv / README.md
Created May 25, 2021 15:41
Flattening contracts for verification on the Matic blockscout block explorer
@maurelian
maurelian / L2toL1Flow.md
Created January 20, 2021 00:11
Description of the withdrawal flow from Optimistic Ethereum's L2

Description of the withdrawal flow

Starting on L2:

  • Any account on L2 may call OVM_L2CrossDomainMessenger.sendMessage() with the information for the L1 message (aka xDomainCalldata)
    • (ie. _target, msg.sender, _message)
    • This data is hashed with the messageNonce storage variable, and the hash is store in the sentMessages mapping (this is not actually used AFAIK)
    • The messageNonce is then incremented.
  • The OVM_L2CrossDomainMessenger then passes the xDomainCalldata to OVM_L2ToL1MessagePasser.passMessageToL1()
  • the xDomainCalldata is hashed with msg.sender (ie. ovmCaller), and written to the sentMessages mapping.
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
// When running the script with `hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
async function main() {
// Hardhat always runs the compile task when running scripts through it.
// If this runs in a standalone fashion you may want to call compile manually
// to make sure everything is compiled
import json
from eth_utils import encode_hex
from web3 import HTTPProvider, Web3
from solc import compile_source
from web3.contract import ConciseContract
# Solidity source code
contract_source_code = '''
# please run: mkdir /tmp/img ; docker export $(docker create centos) | tar -C /tmp/img/ -xvf -
# before this script
import os
import ctypes
from multiprocessing import Process
CLONE_NEWUSER = 0x10000000
CLONE_NEWPID = 0x20000000
@gene1wood
gene1wood / google-drive-symlink.md
Last active May 23, 2024 14:54
Google Drive symlink