Skip to content

Instantly share code, notes, and snippets.


大彬 Shitaibin

Block or report user

Report or block Shitaibin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Shitaibin /
Created Sep 23, 2019
CGO panic memory vailation
// SM2Sign signs
func SM2Sign(signKey interface{}, msg []byte) ([]byte, error) {
	sm2Eckey := signKey.(*Sm2EcKey)

	hash := sm3.New()
	h := hash.Sum(nil)

	sig := make([]byte, 128, 128)
Shitaibin /
Last active Nov 28, 2018



func PipelineFan() {
	in := producer(10)

	c1 := square(in)
Shitaibin / pipeline-fan-ret
Created Nov 27, 2018
result of pipeline fan model
View pipeline-fan-ret
➜ awesome git:(master) ✗ time go run hi.go
go run hi.go 10.49s user 4.42s system 303% cpu 4.917 total
➜ awesome git:(master) ✗ time go run hi-simple.go
go run hi-simple.go 4.81s user 2.65s system 176% cpu 4.233 total
Shitaibin /
Last active Mar 12, 2019
Grep for big file
# I found grep is very slow for big files, I made a simpe python version
import sys
def search(file_name, wants):
with open(file_name, 'r') as file:
for line in file:
for w in wants:
if w in line:
View gtest_build_install.txt
## unzip and go into googletest directory
➜ Downloads unzip
creating: googletest-master/
inflating: googletest-master/
➜ Downloads
➜ Downloads ls
googletest-master pixman_0.30.2.orig.tar.gz redis-3.2.0 redis-3.2.0.tar.gz
View simple_malloc.c
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/resource.h>
#include <sys/types.h>
typedef struct s_block* t_block;
struct s_block {
size_t size;
Shitaibin / string_repalce.cpp
Last active Apr 6, 2016
View string_repalce.cpp
// 参考《C++编程思想卷2》
#include <iostream>
#include <string>
using namespace std;
string& replace_all(string& context, const string& from, const string& to) {
size_t look_here = 0;
size_t found_here;
Shitaibin / LIS.cpp
Last active Jun 24, 2016
动态规划合集 -- 动态规划的主程序不应该复杂,不然泛化能力差,过度拟合了
View LIS.cpp
// 最长递增子数列
// O(N^2)
// dp[i] = max{dp[j]+1 | [i] > [j], 0<=j<i}
// result: max{dp[i] | 0<=i<n}
class Solution {
static const int bufsize = 10000;
int dp[bufsize];
You can’t perform that action at this time.