Skip to content

Instantly share code, notes, and snippets.

View sundy-li's full-sized avatar
🏠
Working from home

sundyli sundy-li

🏠
Working from home
View GitHub Profile
@sundy-li
sundy-li / memory_bench.rs
Last active January 16, 2021 03:39
memory_bench.rs
use std::sync::{Mutex, Arc};
use std::env;
use std::time::Instant;
use std::sync::mpsc::channel;
use threadpool::ThreadPool;
// test memory bandwidth
fn main() {
@sundy-li
sundy-li / gist:9764fb0abe21aa4ce220a96bbd778042
Created November 6, 2020 10:06
clickhouse_slow_query.sh
# ClickHouse的top工具,实时查看运行的SQL,运行了多久,来自哪里
# 注意事项:查询SQL的时候,要把客户端里的空格去掉,要判断是否为空,否则影响while read的读取位置
# TODO:清屏很暴力,鼠标滚动就不见了 limit限制
password="xxxx"
ls /usr/bin/clickhouse-client >/dev/null 2>&1
@sundy-li
sundy-li / config.json
Last active November 4, 2020 13:19
gen_tool.go
{
"instance_id" : 1,
"data_dir" : "/data1/clickhouse",
"log_dir": "/data/logs/clickhouse-server",
"tcp_port": 9000,
"http_port": 8123,
"interserver_http_port": 9009,
"max_concurrent_queries": 500,
package main
import (
"fmt"
"io/ioutil"
"math/rand"
"github.com/RoaringBitmap/roaring"
)
@sundy-li
sundy-li / test
Created October 20, 2020 08:49
test-jdbc
/**
*
*/
public class SparkJdbcMain {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
SparkSession spark = SparkSession
.builder()
.appName("spark-jdbc-test")
.enableHiveSupport()
@sundy-li
sundy-li / latency.txt
Created March 29, 2019 09:28 — 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
@sundy-li
sundy-li / install_zk.sh
Created May 19, 2017 07:06
install_zk_cluster
#!/bin/bash --login
## install zookeeper from url
#env
id=$1
hosts=("server.1=lp2:2888:3888" "server.2=lp3:2888:3888" "server.3=lp4:2888:3888")
version=3.4.10
dir="/data/local"
@sundy-li
sundy-li / ctx.go
Last active May 7, 2017 11:05
golang-context
package gomarker
type service func() result
func invokeService(ctx content.Content, s service) chan result {
c := make(chan result)
go func() {
c1 := make(chan result)
go func() {
c1 <- s()
@sundy-li
sundy-li / gossh
Created March 29, 2017 01:34
gossh
#!/bin/bash
# __________
# /''T''|[___|___]
# Sundyli
# [---T--L-OlllllllO-]
# ooOO2016-08-25 11:47ooOO
# ()_)"""()_)/"**")_) 什么时候才能有辆悍马呢?
# _| _ _ / '| /~~ _ _ _ _ .| _ _ _ _
# _|</(_)(_)(_).|.| (|/(_|| | |(_|||.(_(_)| | |
# / __ _|
@sundy-li
sundy-li / backup_data.sh
Last active March 29, 2017 00:30
backup_data.sh
#!/bin/bash
## backup use ssh
# bash backup_data.sh /data/tmp/wx.csv wx chuxing@s1:/data/boomer/
source=$1
zip=$2
remote=$3