Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

大彬 Shitaibin

🎯
Focusing
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
Shitaibin / pipeline-fan-benchmark.md
Last active Nov 28, 2018
pipeline-fan-benchmark
View pipeline-fan-benchmark.md

提示性能

增加函数

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

	// FAN-OUT
	c1 := square(in)
@Shitaibin
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
Shitaibin / py_grep.py
Last active Mar 12, 2019
Grep for big file
View py_grep.py
# 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 googletest-master.zip
Archive: googletest-master.zip
aa148eb2b7f70ede0eb10de34b6254826bfb34f4
creating: googletest-master/
...
inflating: googletest-master/travis.sh
➜ Downloads
➜ Downloads ls
googletest-master googletest-master.zip 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
Shitaibin / string_repalce.cpp
Last active Apr 6, 2016
C++字符串替换函数
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
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.