Skip to content

Instantly share code, notes, and snippets.

View mfornet's full-sized avatar
🌎
on earth

Marcelo Fornet mfornet

🌎
on earth
View GitHub Profile

Testing references in MD1. YAR2.

And a similar repeated reference in markdown1.

Footnotes

  1. Markdown This reference has a link to learn more about the language 2

  2. Yet another refernce

import torch
import torch.nn as nn
def build_model():
return nn.Sequential(
nn.Linear(1, 1, bias=False),
nn.Sigmoid(),
)
import random
import os
import json
import sys
from typing import List
if __name__ == '__main__':
# Load two random files from the folder data
file1 = random.choice(os.listdir('data/training'))
file2 = random.choice(os.listdir('data/evaluation'))
@mfornet
mfornet / cuda_error.h
Created March 31, 2023 14:31
enum cudaError
enum __device_builtin__ cudaError
{
/**
* The API call returned with no errors. In the case of query calls, this
* also means that the operation being queried is complete (see
* ::cudaEventQuery() and ::cudaStreamQuery()).
*/
cudaSuccess = 0,
/**
@mfornet
mfornet / pile-uri.txt
Created February 23, 2023 10:01
aria2 uri to download pile dataset
https://the-eye.eu/public/AI/pile/test.jsonl.zst
https://the-eye.eu/public/AI/pile/val.jsonl.zst
https://the-eye.eu/public/AI/pile/SHA256SUMS.txt
https://the-eye.eu/public/AI/pile/train/00.jsonl.zst
dir = train
https://the-eye.eu/public/AI/pile/train/01.jsonl.zst
dir = train
https://the-eye.eu/public/AI/pile/train/02.jsonl.zst
dir = train
https://the-eye.eu/public/AI/pile/train/03.jsonl.zst
@mfornet
mfornet / blank.txt
Created February 14, 2023 21:31
Blank
this file was intentionally left blank

stakes.txt contains the amount of stake per validator on NEAR mainnet as of writing this document. This file can be recomputed using:

export NEAR_ENV=mainnet
near validators current | tee stakes.txt

The output of running the script main.py using this version of the file stakes.txt is:

This file has been truncated, but you can view the full file.
running 1 test
INFO - initialized a new JSONRPC client connector
INFO - returned a new JSONRPC client handle
INFO - request payload: {
"id": "b6861e30-b4c5-40e7-837d-c3166fcbc77b",
"jsonrpc": "2.0",
"method": "status",
"params": null
}
INFO - request payload: {
@mfornet
mfornet / block_70972580.json
Created July 30, 2022 17:29
Aurora mainnet block
{
"chain_id": 1313161554,
"hash": "0x5294c883e6ad190be96e0b4caa9804fe009acfd0305c670c7494ba7b0a3a2043",
"parent_hash": "0xec02dc8ca27e9e5b28f1c3368357bc5423992f089650913940c38d8577718bd2",
"height": 70972580,
"miner": "0x622b39b9f59fa464ac5caed8498378c837839eb5",
"timestamp": 1659201420239469394,
"gas_limit": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"gas_used": "0xb4a2a",
"logs_bloom": "0x01200000000c0000000000008010008000000000000000100000600010000000000000000000000000100000200040000000000001040000000000000020000000400010000000010000000800080024000000000000000000010000000000000000000a050000000000000000000000601000000000000000000010000000010000010000000084000000010000000080000010000000080000004000000000020000000008080000040000000100000000000000000000000000009008000008000002000002000000000010000000000000080000001400000000000000800010000000000000000000100400002000208000020000080000000000000000",
@mfornet
mfornet / fast_bit_truncate.py
Created June 11, 2022 00:12
Find proper shift to bring a number down to less than `n` bits
def shift_slow(n, bits):
shift = 0
while n >= 2**bits:
n >>= 1
shift += 1
return shift
def compute_logbits(bits):
# Compute logbits