-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated By Github Actions With Build 251 of Build my gitbook and depl…
…oy to gh-pages For Github Pages
- Loading branch information
0 parents
commit 0e6bd91
Showing
500 changed files
with
524,480 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build my gitbook and deploy to gh-pages | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
master-to-gh-pages: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout master | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
ref: master | ||
|
||
- name: install nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 10.14.1 | ||
|
||
- name: configue gitbook | ||
run: | | ||
npm install | ||
npm install -g gitbook-cli | ||
gitbook install | ||
npm install -g gitbook-summary | ||
- name: generate _book folder | ||
run: | | ||
book sm | ||
ln -s -f SUMMARY.md Content.md | ||
gitbook build | ||
cp SUMMARY.md _book | ||
- name: push _book to branch gh-pages | ||
env: | ||
TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | ||
REF: github.com/${{github.repository}} | ||
MYEMAIL: kimi0230@gmail.com | ||
MYNAME: ${{github.repository_owner}} | ||
run: | | ||
cd _book | ||
git config --global user.email "${MYEMAIL}" | ||
git config --global user.name "${MYNAME}" | ||
git init | ||
git remote add origin https://${REF} | ||
git add . | ||
git commit -m "Updated By Github Actions With Build ${{github.run_number}} of ${{github.workflow}} For Github Pages" | ||
git branch -M master | ||
git push --force --quiet "https://${TOKEN}@${REF}" master:gh-pages |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Build latest tag | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: macos-latest | ||
steps: | ||
- name: checkout master | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
ref: master | ||
|
||
- name: install nodejs | ||
uses: actions/setup-node@v1 | ||
|
||
- name: install calibre | ||
run: | | ||
brew install calibre | ||
- name: configue gitbook | ||
run: | | ||
npm install -g gitbook-cli | ||
gitbook install | ||
npm install -g gitbook-summary | ||
- name: generate pdf file | ||
run: | | ||
book sm | ||
ln -s -f SUMMARY.md README.md | ||
gitbook pdf | ||
gitbook epub | ||
gitbook mobi | ||
mkdir -p path/to/artifact | ||
cp book.pdf path/to/artifact | ||
cp book.epub path/to/artifact | ||
cp book.mobi path/to/artifact | ||
- name: Upload file | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: book.pdf | ||
path: path/to/artifact/book.pdf | ||
|
||
- name: Download file | ||
id: download | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: book.pdf | ||
path: path/to/artifact | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
working-directory: path/to/artifact | ||
|
||
- name: 'Echo download path' | ||
run: echo ${{steps.download.outputs.download-path}} | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: | | ||
path/to/artifact/book.pdf | ||
path/to/artifact/book.epub | ||
path/to/artifact/book.mobi | ||
LICENSE | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
_book | ||
node_modules | ||
.obsidian/* |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "auto", | ||
"program": "${fileDirname}" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"vue.features.codeActions.enable": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package a1b2c3 | ||
|
||
import ( | ||
"sync" | ||
) | ||
|
||
func ChannelWBuffer() { | ||
abc := make(chan struct{}, 1) | ||
num := make(chan struct{}, 1) | ||
done := make(chan struct{}) | ||
abc <- struct{}{} | ||
|
||
go func() { | ||
for i := 65; i <= 90; i++ { | ||
<-abc | ||
// fmt.Printf("%v", string(rune(i))) | ||
num <- struct{}{} | ||
} | ||
}() | ||
go func() { | ||
for i := 1; i <= 26; i++ { | ||
<-num | ||
// fmt.Printf("%v", i) | ||
abc <- struct{}{} | ||
} | ||
done <- struct{}{} | ||
}() | ||
// time.Sleep(1 * time.Second) | ||
<-done | ||
} | ||
|
||
func ChannelWOBuffer() { | ||
abc := make(chan struct{}) | ||
num := make(chan struct{}) | ||
done := make(chan struct{}) | ||
|
||
go func() { | ||
for i := 65; i <= 90; i++ { | ||
// fmt.Printf("%v", string(rune(i))) | ||
abc <- struct{}{} | ||
<-num | ||
} | ||
}() | ||
go func() { | ||
for i := 1; i <= 26; i++ { | ||
<-abc | ||
// fmt.Printf("%v", i) | ||
num <- struct{}{} | ||
} | ||
done <- struct{}{} | ||
}() | ||
// time.Sleep(1 * time.Second) | ||
<-done | ||
} | ||
|
||
func WGLock() { | ||
abcMux := sync.Mutex{} | ||
numMux := sync.Mutex{} | ||
|
||
numMux.Lock() | ||
wg := sync.WaitGroup{} | ||
wg.Add(2) | ||
go func() { | ||
defer wg.Done() | ||
for i := 65; i <= 90; i++ { | ||
abcMux.Lock() | ||
// fmt.Printf("%v", string(rune(i))) | ||
numMux.Unlock() | ||
} | ||
}() | ||
go func() { | ||
defer wg.Done() | ||
for i := 1; i <= 26; i++ { | ||
numMux.Lock() | ||
// fmt.Printf("%v", i) | ||
abcMux.Unlock() | ||
} | ||
}() | ||
wg.Wait() | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package a1b2c3 | ||
|
||
import "testing" | ||
|
||
func TestChannelWBuffer(t *testing.T) { | ||
ChannelWBuffer() | ||
} | ||
|
||
func TestChannelWOBuffer(t *testing.T) { | ||
ChannelWOBuffer() | ||
} | ||
func TestWGLock(t *testing.T) { | ||
WGLock() | ||
} | ||
|
||
func BenchmarkChannelWBuffer(b *testing.B) { | ||
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
ChannelWBuffer() | ||
} | ||
} | ||
|
||
func BenchmarkChannelWOBuffer(b *testing.B) { | ||
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
ChannelWOBuffer() | ||
} | ||
} | ||
|
||
func BenchmarkWGLock(b *testing.B) { | ||
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
WGLock() | ||
} | ||
} | ||
|
||
// go test -benchmem -run=none LeetcodeGolang/Algorithms/A1B2C3 -bench=. | ||
/* | ||
goos: darwin | ||
goarch: amd64 | ||
pkg: LeetcodeGolang/Algorithms/A1B2C3 | ||
cpu: Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz | ||
BenchmarkChannelWBuffer-4 79159 14612 ns/op 344 B/op 5 allocs/op | ||
BenchmarkChannelWOBuffer-4 83068 14451 ns/op 344 B/op 5 allocs/op | ||
BenchmarkWGLock-4 51303 23072 ns/op 96 B/op 5 allocs/op | ||
PASS | ||
ok LeetcodeGolang/Algorithms/A1B2C3 4.092s | ||
*/ |
Oops, something went wrong.