// SM2Sign signs
func SM2Sign(signKey interface{}, msg []byte) ([]byte, error) {
sm2Eckey := signKey.(*Sm2EcKey)
hash := sm3.New()
hash.Write(msg)
h := hash.Sum(nil)
sig := make([]byte, 128, 128)
View a.md
View pipeline-fan-benchmark.md
提示性能
增加函数
func PipelineFan() {
in := producer(10)
// FAN-OUT
c1 := square(in)
View pipeline-fan-ret
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ 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 |
View py_grep.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
View string_repalce.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 参考《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; |
View LIS.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 最长递增子数列 | |
// 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]; | |