Skip to content

Instantly share code, notes, and snippets.

View bachue's full-sized avatar

Bachue Zhou bachue

View GitHub Profile
#: Version
Daemon: 1.23.3+debug+git.7bb1f98ac.dirty+api1.5.0
Local: lotus-miner version 1.23.3+debug+git.7bb1f98ac.dirty
#: Miner Info
Enabled subsystems: [Mining Sealing SectorStorage]
StartTime: 21m1s (started at 2023-09-27 02:15:19 +0000 UTC)
Chain: [sync ok] [basefee 100 aFIL]
Miner: t01000 (2 KiB sectors)
Power: 100 Ki / 100 Ki (100.0000%)
@bachue
bachue / multi_range_download.go
Last active October 14, 2020 10:12
Qiniu MultiRange Download Example
package main
import (
"bytes"
"errors"
"fmt"
"io"
"mime"
"mime/multipart"
"net/http"
@bachue
bachue / thread_safe_struct.go
Created June 8, 2020 08:52
How to make lock-free go struct thread-safe
package main
import (
"github.com/AlekSi/pointer"
log "github.com/sirupsen/logrus"
"sync"
"sync/atomic"
"unsafe"
)
@bachue
bachue / fsnotify-test.go
Last active April 20, 2020 10:09
测试 fsnotify 库
package main
import (
"fmt"
"github.com/fsnotify/fsnotify"
"log"
"os"
"path/filepath"
)
#ifndef __ABC____H
#define __ABC____H
/* Generated with cbindgen:0.12.0 */
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
[package]
name = "abc"
version = "0.1.0"
authors = ["root"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["cdylib"]
const AWS = require('aws-sdk'),
fs = require('fs'),
{
Throttle
} = require('stream-throttle');
const uploadFiles = process.argv.slice(2);
const S3Service = new AWS.S3({
apiVersion: '2006-03-01',
@bachue
bachue / actix-web_vs_gin.md
Last active June 14, 2019 03:35
PostgreSQL 设置最大客户端数量为 1000,ulimit -n 为 65536。

Rust by actix-web 1.0

/ping 结果

This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)

Rust by actix-web

Server Software:
Server Hostname:        127.0.0.1
Server Port:            8080

Document Path:          /
Document Length:        11 bytes
@bachue
bachue / failed_test.c
Last active October 16, 2017 01:57
根据 http://blog.shengbin.me/posts/gcc-attribute-aligned-and-packed ,写了个测试用例,执行在 x86_64 上。理论上应该输出 80000 才对,实际执行的时候只有在 gcc 使用 -O1 及其以上优化时,才能成功。
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <pthread.h>
void *add_counter(void* c) {
int i;
for (i = 0; i < 10000; i++) {
(*(int*)c)++;
}