Skip to content

Instantly share code, notes, and snippets.

@chenlujjj
chenlujjj / enum.go
Created March 31, 2021 15:21
枚举类型的惯用写法(包括和字符串的相互转换)
package main
import (
"errors"
"fmt"
"strings"
)
var ErrInvalidFruit = errors.New("invalid fruit")
@chenlujjj
chenlujjj / balance.go
Created March 21, 2021 14:30
example code from "Concurrency is not Parallelism" talk by Rob Pike
package main
import (
"container/heap"
"fmt"
"math/rand"
"time"
)
const nRequester = 100
@chenlujjj
chenlujjj / linux-http-tcp.md
Created July 27, 2019 07:38 — forked from v5tech/linux-http-tcp.md
linux下查看http 并发和 tcp连接数

linux查看httpd进程数

ps -ef | grep httpd | wc -l

查看Apache的并发请求数及其TCP连接状态

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
@chenlujjj
chenlujjj / git_submodules.md
Created April 22, 2019 11:43 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@chenlujjj
chenlujjj / tut.md
Created January 23, 2019 07:24 — forked from rain1024/tut.md
Install pdflatex ubuntu

PdfLatex is a tool that converts Latex sources into PDF. This is specifically very important for researchers, as they use it to publish their findings. It could be installed very easily using Linux terminal, though this seems an annoying task on Windows. Installation commands are given below.

  • Install the TexLive base
sudo apt-get install texlive-latex-base
  • Also install the recommended and extra fonts to avoid running into the error [1], when trying to use pdflatex on latex files with more fonts.
@chenlujjj
chenlujjj / Jenkinsfile.groovy
Created November 20, 2018 05:42 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
2018-04-18 21:38:53:301 - info: [HTTP] <-- POST /wd/hub/session/40dd06a7-e027-4067-8c2a-4e525a939d2b/element/27ea5535-3287-451e-be07-26cfec63b344/click 200 1143 ms - 76
2018-04-18 21:38:53:310 - info: [HTTP] --> POST /wd/hub/session/40dd06a7-e027-4067-8c2a-4e525a939d2b/element {"using":"xpath","sessionId":"40dd06a7-e027-4067-8c2a-4e525a939d2b","value":"//android.widget.TimePicker//android.widget.NumberPicker[1]"}
2018-04-18 21:38:53:311 - info: [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//android.widget.TimePicker//android.widget.NumberPicker[1]","40dd06a7-e027-4067-8c2a-4e525a939d2b"]
2018-04-18 21:38:53:312 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-04-18 21:38:53:313 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-04-18 21:38:53:313 - info: [debug] [BaseDriver] Waiting up to 0 ms for conditi
2018-04-17 14:34:51:700 - info: [HTTP] --> POST /wd/hub/session/03aea446-d813-420d-ae05-01290fd38ff6/element {"using":"id","sessionId":"03aea446-d813-420d-ae05-01290fd38ff6","value":"com.app.app:id/ib_captor_bottom_setting"}
2018-04-17 14:34:51:700 - info: [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["id","com.app.app:id/ib_captor_bottom_setting","03aea446-d813-420d-ae05-01290fd38ff6"]
2018-04-17 14:34:51:701 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-04-17 14:34:51:701 - info: [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-04-17 14:34:51:701 - info: [debug] [BaseDriver] Waiting up to 0 ms for condition
2018-04-17 14:34:51:701 - info: [debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8200/wd/hub/session/1ce7e3aa-99e6-4699-ba9c-313fe34fa87d/element] with body: {"strategy":"id","selector":"c