Skip to content

Instantly share code, notes, and snippets.

View Rexagon's full-sized avatar
🦀

Ivan Kalinin Rexagon

🦀
View GitHub Profile
use std::io::IsTerminal;
use std::num::NonZeroUsize;
use std::path::{Path, PathBuf};
use anyhow::Result;
use serde::de::Visitor;
use serde::{Deserialize, Deserializer, Serialize};
use tracing::Subscriber;
use tracing_appender::rolling::Rotation;
use tracing_subscriber::filter::Directive;
import os
def process_file(file_path):
if "test" in file_path or "network" in file_path or "target" in file_path:
return
if not file_path.endswith(".rs"):
return
modified_lines = []
@Rexagon
Rexagon / gen-ticktock.fif
Last active May 24, 2024 13:04
Generates a simple hello-world contract
"TonUtil.fif" include
"Asm.fif" include
"Lists.fif" include
"GetOpt.fif" include
{ show-options-help 1 halt } : usage
false =: tick
false =: tock
variable extra-currencies
@Rexagon
Rexagon / config.ts
Created September 1, 2023 13:14
Get config params
import { Address, ProviderRpcClient } from "everscale-inpage-provider";
import { EverscaleStandaloneClient } from "everscale-standalone-client/nodejs";
const ever = new ProviderRpcClient({
forceUseFallback: true,
fallback: () =>
EverscaleStandaloneClient.create({
connection: {
id: 123,
type: "proto",
@Rexagon
Rexagon / tlb.pest
Created February 1, 2023 20:42
Pest grammar for TL-B
WHITESPACE = _{ " " | NEWLINE }
COMMENT = _{
("//" ~ (!NEWLINE ~ ANY)*) |
("/*" ~ (!"*/" ~ ANY)* ~ "*/")
}
tlb_scheme = _{ SOI ~ (declaration)* ~ EOI }
declaration = { constructor ~ type_arg* ~ field_group* ~ "=" ~ output_type ~ ";" }
@Rexagon
Rexagon / global_config.json
Created November 21, 2022 20:48
Broxus testnet global config
{
"@type": "config.global",
"dht": {
"@type": "dht.config.global",
"k": 6,
"a": 3,
"static_nodes": {
"@type": "dht.nodes",
"nodes": [
{
te6ccgECdQEAFD4AA7d61FeCHf8yG3+VsHLEilQ6UuYy8wcpWi1+/eB+QyLiYMAAAahJB7OYkL2Pl+S0sBbapRCERwSsVWKsZ/1WGbNouh5HwPhxSiGAAAGoP8TeAJYumenAAFSARBWHSAUEAQIbBIgLyR0Jj8WYgCdHLREDAgBxygFZfVBPmUqMAAAAAAAGAAIAAAAEW8033SNQ2/1TE9Nzuof+lf33h4/sRfFyiGy4DaJos2pa1CzcAJ5KDiw9CQAAAAAAAAAAATMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIJyjI1j6xocdf/ts8UpUE4PQBjq+eZ4ePLwpE1tDGf3pHcFUnuY03DQrIX8ExegcAhTl+187mhCPuegYR4tBS3ejwIB4HEGAgHdCgcBASAIAbFoAVqK8EO/5kNv8rYOWJFKh0pcxl5g5StFr9+8D8hkXEwZAB03C5ZU3g0onstArcVRQt2q942P0t/N68CNCNeI9IxfETHWk3wGKJa2AAA1CSD2cxbF0z04wAkBa2eguV8AAAAAAAAAAAAAAANFARhPgB374hjvHSKb7xHdyPtVEPFzv/+BeyMtxMrKJu6jDYpu8HMBASALArNoAVqK8EO/5kNv8rYOWJFKh0pcxl5g5StFr9+8D8hkXEwZAB03C5ZU3g0onstArcVRQt2q942P0t/N68CNCNeI9IxfEI8NGAAIA3C5RAAANQkg9nMUxdM9OeBTDAJTFaA4+wAAAAGAHfviGO8dIpvvEd3I+1UQ8XO//4F7Iy3Eysom7qMNim7wDg0AQ4AVmHZxK25XVSkUA1uAHGOMneWjMhSxqkQWdAyAImMM0RACBorbNXAPBCSK7VMg4wMgwP/jAiDA/uMC8gtNERB0A77tRNDXScMB+GaJ+Gkh2zzTAAGOGoECANcYIPkBAdMAAZTT/wMBkwL4QuL5EPKoldMAAfJ64tM/AfhD
@Rexagon
Rexagon / muldiv.rs
Created April 14, 2022 19:36
fat muldiv
fn lo128(a: u128) -> u128 {
a & ((1<<64)-1)
}
/// Returns the most significant 64 bits of a
fn hi128(a: u128) -> u128 {
a >> 64
}
/// Returns 2^128 - a (two's complement)
@Rexagon
Rexagon / tl.pest
Created October 23, 2021 12:29
TL pest grammar
WHITESPACE = _{ " " | NEWLINE }
COMMENT = _{
("//" ~ ANY* ~ (NEWLINE | EOI) ) |
("/*" ~ (!"*/" ~ ANY)* ~ "*/")
}
ident_char = @{ ASCII_ALPHANUMERIC | "_" }
lc_ident = @{ ASCII_ALPHA_LOWER ~ ident_char* }
uc_ident = @{ ASCII_ALPHA_UPPER ~ ident_char* }
@Rexagon
Rexagon / BuildHelpers.cmake
Created October 13, 2020 20:18
Function that converts any file into C/C++ source code.
####################################################################################################
# This function converts any file into C/C++ source code.
# Example:
# - input file: data.dat
# - output file: data.h
# - variable name declared in output file: DATA
# - data length: sizeof(DATA)
# embed_resource("data.dat" "data.h" "DATA" UNSIGNED)
####################################################################################################
function(embed_resource resource_file_name source_file_name variable_name type)