Skip to content

Instantly share code, notes, and snippets.

@dtmrc
dtmrc / README.md
Created February 13, 2024 18:27 — forked from pythoninthegrass/README.md
sysctl.conf stand-in on macOS 10.15+

com.startup.sysctl.plist

As of at least macOS Catalina 10.15.3, /etc/sysctl.conf values are no longer respected and/or the file straight up doesn't exist (confirmed on macOS Monterey 12.4.)

Ran across a fio shm error: failed to setup shm segment while benchmarking SSDs. The fix was to set shmmni to 4096. The following has to happen:

  • Disable SIP
    • Disclaimer from Apple

      Warning

      Disable SIP only temporarily to perform necessary tasks, and reenable it as soon as possible. Failure to reenable SIP when you are done testing leaves your computer vulnerable to malicious code.

@dtmrc
dtmrc / gist:a816563a96e374fb3722e13e4becbc9f
Created December 25, 2023 18:26 — forked from jdaviderb/gist:9773aedc2c7aaf83653295c4c95ebec3
How solana calculate Clock::get()?.unix_timestamp;
> It's strongly desired by some users to have a network-controlled best effort timestamp associated with the production time of each block. One such example is https://en.bitcoin.it/wiki/Block_timestamp
>
> Some important properties of this timestamp are:
>
> 1. Drift of no worse than a couple hours from the actual block production time
> 2. Replaying the ledger at a later time results in the same block production time
> 3. The block production time is not controlled by a single centralized oracle, but ideally is a function that uses inputs from all validators
>
> A rough proposal would be to require validators to submit their current UTC time every N minutes. A median time is then constructed from the latest submission and block times are then computed as `last_median_time + slot_offset * 400ms` until the next median time is constructed.
>
@dtmrc
dtmrc / transaction_changes.md
Created August 11, 2022 18:56 — forked from jstarry/transaction_changes.md
Wallet Roundtable 5/18/2022

Change 1: Transaction Prioritization

  • From v1.10.14 onwards, validators will try to consume transactions in order of priority which is based on the prioritization fee paid per compute unit.
  • In order to optimize priority / fee paid, transaction should set its compute unit limit as low as possible because leftover compute units are not refunded.

Runtime Features

tx_wide_compute_cap (Implemented in v1.9.7, v1.10.0) (Activated on Devnet & Testnet)

  • Updates compute unit limits to be transaction-wide rather than reset to 200k compute units per transaction instruction. Sets the maximum transaction compute unit limit to 1.4M compute units. The default compute unit limit is also set to 1.4M compute units to avoid breaking existing transactions which rely on consuming more than 200k compute units by spreading compute across multiple instructions.
  • Adds the ComputeBudget::RequestUnits instruction which has two parameters:
    • Compute unit limit
    • Prioritization fee (lamports)
@dtmrc
dtmrc / writes.csv
Created April 15, 2022 04:15 — forked from riptl/writes.csv
Kafka write size breakdown for 10k Solana txns
program txs data_size data_pct
9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin 738 82565664 0.823
Vote111111111111111111111111111111111111111 2241 8361171 0.083
mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68 155 3316696 0.033
cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ 4 3205916 0.032
FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH 380 1258560 0.013
SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f 554 659660 0.007
ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD 34 276886 0.003
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA 1017 164319 0.002
Sysvar1111111111111111111111111111111111111 24 144192 0.001
@dtmrc
dtmrc / crawl_for_nfts_from_validated_creator.ts
Created April 15, 2022 03:54 — forked from oboxodo/crawl_for_nfts_from_validated_creator.ts
Transaction crawling for a list of mints from a given verified creator
// This is alpha code trying to replace a getProgramAccounts call with a Transaction Crawling algorithm to find all mints from a Metaplex Candy Machine.
// DISCLAIMER: Use at your own risk.
//
// This code was originally based on the code from @samuelvanderwaal in https://github.com/metaplex-foundation/get-collection/blob/39116b680301c23c91e3960578c4a37c1c8e07c3/get-collection-ts/index.ts
// The purpose of that code is different, but I learnt a lot from it.
//
// Also got some inspiration from @0xAlice's code in https://github.com/penta-fun/sol-nft-tools/blob/8931ae422fa47b79008d57b01a30aeefd97b8cb6/util/get-nft-mints.ts
import { ConfirmedSignatureInfo, Connection, PublicKey } from "@solana/web3.js";
import { programs } from "@metaplex/js";
@dtmrc
dtmrc / magiceden.txt
Created April 15, 2022 03:48 — forked from justin-me/magiceden.txt
MagicTicket Hashlist
This file has been truncated, but you can view the full file.
[
"ASUEz4iKcLErm9BjEbAtT8m9FL7JdaqsbTEdqA1S6yqV",
"FpDfucNwbNLGPi45YXZo1nSW2cdPQ4pSmtucAxUqYWPW",
"4zza3HrGVfxudGrGWWsgpEd5ep3PvFqvGtzV8gtF6ktm",
"AbuyMoWopZF4CUo5ruJaPyW6rF9tV4uYFsTw2KkDeL2r",
"DonU5zbcYuJEBgaGqTe7cDGFJYMTXPxkVFgZ6QGumjA2",
"4xibjS8qFvdRRZJLdyAqcDbCFBSoo8ugEP2ziaNweryw",
"B7MUYS4DGvYFUs5ttBCtvsGsrJB2m5QmTPyHJqFKr7an",
"3e2hMxheEvAsiqREXrHxsrSumGREcktqVELso7BNgZ91",
"6wsjTLoxhzUB4rRALgKZPxb9V42nFZn6hYL71Bmin66D",
"RT @ramiberlin: @martinsweeney00 @xrpstik @Tyga @LilTunechi @DrakeBell @Drake @Bitboy_Crypto @HM_Ericsson #xSTIK no1 voted #NFT Project on\u2026"
"RT @ramiberlin: @xDREAMS_NFT @stormpopz @xrpstik #xSTIK no1 voted #NFT Project on #XRPL\n#NFTs #NFTGiveaway #NFTCommunity #nftart #NFTartis\u2026"
"RT @ramiberlin: @martinsweeney00 @xrpstik @Tyga @LilTunechi @DrakeBell @Drake @Bitboy_Crypto @HM_Ericsson #xSTIK no1 voted #NFT Project on\u2026"
"RT @ramiberlin: @xDREAMS_NFT @stormpopz @xrpstik #xSTIK no1 voted #NFT Project on #XRPL\n#NFTs #NFTGiveaway #NFTCommunity #nftart #NFTartis\u2026"
"@xDREAMS_NFT @stormpopz @xrpstik #xSTIK no1 voted #NFT Project on #XRPL\n#NFTs #NFTGiveaway #NFTCommunity #nftart #NFTartist #NFTdrop #crypto #cryptocurrency #Bitcoin #ETH #Ethereum #GameFi #gaming #opensea #OpenSeaNFT #invest #blockchain @xrpstik #MONEY @XLS20Art #XRP #XRPLcommunity #XRPArmy #XRPLedger https://t.co/AqjtPtFs6H"
"RT @CryptoAsAWay: Play #pump for me ... several hours I need :P\n\n#crypto #cryptocurrency #blockch
@dtmrc
dtmrc / magicedenrpc.js
Created April 15, 2022 03:47 — forked from PieterSpruijt/magicedenrpc.js
Fetch data from Magic Eden Rpc without getting cloudflare captchas
/**
* @file Fetch data from Magic Eden Rpc without getting cloudflare captchas
* @author Pieter Spruijt <pieter@spruijtstudios.com>
*/
/*
First install the package
npm install cloudscraper
*/
@dtmrc
dtmrc / api-throttling-429-error-handling.js
Created February 8, 2022 21:58 — forked from benogle/api-throttling-429-error-handling.js
An example script consuming an API with various throttling and 429 "too many requests" error handling strategies.
// An example script consuming an API with various throttling and 429 error
// handling strategies.
//
// Blog post with more context
// https://www.useanvil.com/blog/2021-03-29-throttling-and-consuming-apis-with-429-rate-limits
//
// License: MIT
import fetch from 'node-fetch'
import mapLimit from 'async/mapLimit'