Skip to content

Instantly share code, notes, and snippets.

@yipu3
yipu3 / raydium_pool_mint_pair.rs
Last active April 26, 2024 14:28
Fetch the mint pair of a Raydium V4 AMM pool in rust
use solana_account_decoder::UiAccountEncoding;
use solana_client::{nonblocking::rpc_client::RpcClient, rpc_config::RpcAccountInfoConfig};
use solana_sdk::pubkey::Pubkey;
use std::str::FromStr;
#[derive(Clone, Default, PartialEq, Debug)]
pub struct PoolPair {
base_mint: String,
quote_mint: String,
}
@yipu3
yipu3 / fetch_near_addresses_under_a_tweet.bash
Last active April 26, 2024 14:29
Fetch Near addresses under a tweet. Set env variable `ACCESS_TOKEN` using your Twitter Bearer Token and input `conversation_id` of the tweet as a command argument.
conversation_id=$1
log="$conversation_id.log"
output="$conversation_id.txt"
rm -f $log && touch $log
rm -f $output && touch $output
data=$(curl --request GET --url "https://api.twitter.com/2/tweets/search/recent?query=conversation_id:$conversation_id" --header Authorization:\ Bearer\ $ACCESS_TOKEN)
echo $data >> $log
@yipu3
yipu3 / latency.txt
Created July 31, 2018 09:42 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@yipu3
yipu3 / wordCountTime.txt
Created May 16, 2018 03:41
三节点机器运行wordCount,hadoop、spark耗时对比
spark:0m5.934s
hadoop:0m20.939s
@yipu3
yipu3 / test_disk_read_write.txt
Last active April 2, 2018 07:32
测试磁盘读写速度
测试磁盘读取速度:
sudo hdparm -Tt /dev/sdb1
Timing cached reads:从linux cache读(不从磁盘读)
Timing buffered disk reads:从磁盘顺序读
测试结果:
/dev/sdb1:
Timing cached reads: 18374 MB in 2.00 seconds = 9196.61 MB/sec
Timing buffered disk reads: 456 MB in 3.00 seconds = 151.75 MB/sec