Skip to content

Instantly share code, notes, and snippets.

View td-bn's full-sized avatar
🎯
Focusing

td-bn td-bn

🎯
Focusing
View GitHub Profile
#!/usr/bin/env python3
# Copyright (c) 2017-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""An example functional test
The module-level docstring should include a high-level description of
what the test is doing. It's the first thing people see when they open
the file and should give the reader information about *what* the test
is testing and *how* it's being tested
@td-bn
td-bn / repr_packed.rs
Created January 11, 2023 12:19
Repr packed Rust example
#[repr(packed)]
#[derive(Debug, Copy, Clone)]
struct Foo {
tiny: bool,
normal: u32,
small: u8,
long: u64,
short: u16,
}
@td-bn
td-bn / default_repr.rs
Created January 11, 2023 12:10
Default Rust representation example
#[derive(Debug)]
struct Foo {
tiny: bool,
normal: u32,
small: u8,
long: u64,
short: u16,
}
macro_rules! raw_dbg {(
@td-bn
td-bn / repr_C_example.rs
Last active January 11, 2023 12:02
Representation of a struct using `repr C`
#[repr(C)]
#[derive(Debug)]
struct Foo {
tiny: bool,
normal: u32,
small: u8,
long: u64,
short: u16,
}
@td-bn
td-bn / simple-proxy...Logic.sol
Created December 13, 2021 12:34
Simple Proxy
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Registry.sol";
contract Logic {
bytes32 constant SUPEROWNER = keccak256("superowner");
bytes32 constant OWNER = keccak256("owner");
@td-bn
td-bn / bootcamp...ConstantStorage.sol
Created November 2, 2021 15:29
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract Store {
uint public num;
function setNum(uint _num) public {
num = _num;
}
@td-bn
td-bn / Logic.sol
Last active November 4, 2021 14:49
Proxy contracts gist
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
contract Logic {
event Added(uint256 result);
event Fallback();
function add(uint256 a, uint256 b) external returns (uint256 result) {