├── Hongkong 2014-09 talk └── Redis-Game-Server.pdf ├── Hongkong 2016-12 talk ├── aws-sharing.pdf └── temp.txt ├── Hongkong 2017-07 talk └── SQL report.pdf ├── Kaohsiung 2020-10 talk ├── anti-patterns-in-go.pdf ├── qsort_bad.go ├── qsort_common.go ├── qsort_good.go └── qsort_test.go ├── LICENSE ├── Singapore 2019-03 talk └── redis-ratelimit.pdf ├── Taichung 2018-09 talk └── redis-2018.pdf ├── Taipei 2015-01 talk ├── Advanced_Database_Skills.pdf ├── From_MySQL_to_postgreSQL.pdf └── Introduction_to_database.pdf ├── Taipei 2015-08 course └── lesson0.pdf ├── Taipei 2015-11 talk └── RESTful API Design-tw-2.0.pdf ├── Taipei 2016-04 course ├── lesson1-demo.pdf ├── lesson1.pdf ├── lesson2.pdf └── lesson3.pdf ├── Taipei 2016-04 talk └── RESTful API Design-tw-2.1.pdf ├── Taipei 2016-08 talk └── SQL_reporting.pdf ├── Taipei 2017-10 talk └── SQL_report_v2.pdf ├── Taipei 2018-03 talk └── mini-bigdata.pdf ├── Taipei 2018-06 talk └── lesson0.pdf ├── Taipei 2019-04 course ├── lesson0.pdf ├── lesson1.pdf ├── lesson2.pdf ├── lesson3.pdf └── lesson4.pdf ├── Taipei 2019-06 talk ├── RESTful API Design-tw-2.2.pdf └── redis-2019.pdf ├── Taipei 2019-10 talk └── concurrency.pdf ├── concurrency-demo.pdf ├── internal-talk └── internal_talk1.pdf ├── introToAlgorithm.pdf ├── letter-to-rookie.pdf ├── nosql-intro.pdf ├── opensource.pdf └── restful-demo.pdf /Hongkong 2014-09 talk/Redis-Game-Server.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Hongkong 2014-09 talk/Redis-Game-Server.pdf -------------------------------------------------------------------------------- /Hongkong 2016-12 talk/aws-sharing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Hongkong 2016-12 talk/aws-sharing.pdf -------------------------------------------------------------------------------- /Hongkong 2016-12 talk/temp.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Hongkong 2017-07 talk/SQL report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Hongkong 2017-07 talk/SQL report.pdf -------------------------------------------------------------------------------- /Kaohsiung 2020-10 talk/anti-patterns-in-go.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Kaohsiung 2020-10 talk/anti-patterns-in-go.pdf -------------------------------------------------------------------------------- /Kaohsiung 2020-10 talk/qsort_bad.go: -------------------------------------------------------------------------------- 1 | package qsort 2 | 3 | import "sync" 4 | import "time" 5 | 6 | func qsortBadInternal(input []int, wg *sync.WaitGroup) { 7 | // for demo the effect of go scheduler 8 | time.Sleep(1 * time.Nanosecond) 9 | 10 | defer wg.Done() 11 | 12 | // sentinal 13 | if len(input) <= 1 { 14 | return 15 | } 16 | 17 | pivotPos := qsortPartition(input) 18 | 19 | wg.Add(2) 20 | go qsortBadInternal(input[:pivotPos], wg) 21 | go qsortBadInternal(input[pivotPos+1:], wg) 22 | } 23 | 24 | func qsortBad(input []int) { 25 | wg := sync.WaitGroup{} 26 | wg.Add(1) 27 | go qsortBadInternal(input, &wg) 28 | wg.Wait() 29 | } 30 | -------------------------------------------------------------------------------- /Kaohsiung 2020-10 talk/qsort_common.go: -------------------------------------------------------------------------------- 1 | package qsort 2 | 3 | // take input[0] as pivot, and then run one iteration 4 | func qsortPartition(input []int) (pivotPos int) { 5 | pivot := input[0] 6 | 7 | startIdx := 1 8 | endIdx := len(input) - 1 9 | 10 | for { 11 | // scan for the swapping pairs 12 | for startIdx < endIdx && input[startIdx] <= pivot { 13 | startIdx++ 14 | } 15 | for startIdx < endIdx && input[endIdx] >= pivot { 16 | endIdx-- 17 | } 18 | 19 | if startIdx >= endIdx { 20 | break 21 | } 22 | // perform swapping 23 | input[startIdx], input[endIdx] = input[endIdx], input[startIdx] 24 | } 25 | 26 | // put back the pivot into correct position 27 | input[0], input[startIdx] = input[startIdx], pivot 28 | return startIdx 29 | } 30 | -------------------------------------------------------------------------------- /Kaohsiung 2020-10 talk/qsort_good.go: -------------------------------------------------------------------------------- 1 | package qsort 2 | 3 | import ( 4 | "runtime" 5 | "sync" 6 | "time" 7 | ) 8 | 9 | func qsortGoodWorker(inputCh chan []int, wg *sync.WaitGroup, remainingTaskNum *sync.WaitGroup) { 10 | defer wg.Done() 11 | 12 | for input := range inputCh { 13 | // for demo the effect of go scheduler 14 | time.Sleep(1 * time.Nanosecond) 15 | 16 | // end condition of recursion 17 | if len(input) <= 1 { 18 | remainingTaskNum.Done() 19 | continue 20 | } 21 | 22 | pivotPos := qsortPartition(input) 23 | 24 | // add the sub-tasks to the queue 25 | remainingTaskNum.Add(2) 26 | inputCh <- input[:pivotPos] 27 | inputCh <- input[pivotPos+1:] 28 | 29 | // mark the current task is done 30 | remainingTaskNum.Done() 31 | } 32 | } 33 | 34 | // WARNING: this qsortGood is for demo only, not for production usage. 35 | // The actual performance of qsortGood is MUCH worse than the standard library 36 | func qsortGood(input []int) { 37 | wg := sync.WaitGroup{} 38 | remainingTaskNum := sync.WaitGroup{} 39 | 40 | threadNum := runtime.NumCPU() * 2 41 | inputCh := make(chan []int, len(input)/2+1) 42 | wg.Add(threadNum) 43 | for i := 0; i < threadNum; i++ { 44 | go qsortGoodWorker(inputCh, &wg, &remainingTaskNum) 45 | } 46 | 47 | // add the input to channel, and wait for all subtask completed 48 | remainingTaskNum.Add(1) 49 | inputCh <- input 50 | remainingTaskNum.Wait() 51 | 52 | // let worker thread die peacefully, we SHOULD NOT leave the worker thread behind 53 | close(inputCh) 54 | wg.Wait() 55 | } 56 | -------------------------------------------------------------------------------- /Kaohsiung 2020-10 talk/qsort_test.go: -------------------------------------------------------------------------------- 1 | package qsort 2 | 3 | import ( 4 | "math/rand" 5 | "testing" 6 | ) 7 | 8 | func generateRandomSlice(n int) []int { 9 | 10 | slice := make([]int, n, n) 11 | for i := 0; i < n; i++ { 12 | slice[i] = rand.Int() 13 | } 14 | return slice 15 | } 16 | 17 | func isAscSorted(slice []int) bool { 18 | 19 | for i := 1; i < len(slice); i++ { 20 | if slice[i-1] > slice[i] { 21 | return false 22 | } 23 | } 24 | return true 25 | } 26 | 27 | func TestQsortBad(t *testing.T) { 28 | array := generateRandomSlice(1000000) 29 | 30 | qsortBad(array) 31 | 32 | if isAscSorted(array) { 33 | t.Error("the sorting is buggy", array) 34 | } 35 | } 36 | 37 | func TestQsortGood(t *testing.T) { 38 | array := generateRandomSlice(1000000) 39 | 40 | qsortGood(array) 41 | 42 | if isAscSorted(array) { 43 | t.Error("the sorting is buggy", array) 44 | } 45 | } 46 | 47 | func BenchmarkQsortBad(b *testing.B) { 48 | array := generateRandomSlice(10000000) 49 | qsortBad(array) 50 | } 51 | 52 | func BenchmarkQsortGood(b *testing.B) { 53 | array := generateRandomSlice(10000000) 54 | qsortGood(array) 55 | } 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Triton Ho 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Singapore 2019-03 talk/redis-ratelimit.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Singapore 2019-03 talk/redis-ratelimit.pdf -------------------------------------------------------------------------------- /Taichung 2018-09 talk/redis-2018.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taichung 2018-09 talk/redis-2018.pdf -------------------------------------------------------------------------------- /Taipei 2015-01 talk/Advanced_Database_Skills.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2015-01 talk/Advanced_Database_Skills.pdf -------------------------------------------------------------------------------- /Taipei 2015-01 talk/From_MySQL_to_postgreSQL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2015-01 talk/From_MySQL_to_postgreSQL.pdf -------------------------------------------------------------------------------- /Taipei 2015-01 talk/Introduction_to_database.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2015-01 talk/Introduction_to_database.pdf -------------------------------------------------------------------------------- /Taipei 2015-08 course/lesson0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2015-08 course/lesson0.pdf -------------------------------------------------------------------------------- /Taipei 2015-11 talk/RESTful API Design-tw-2.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2015-11 talk/RESTful API Design-tw-2.0.pdf -------------------------------------------------------------------------------- /Taipei 2016-04 course/lesson1-demo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2016-04 course/lesson1-demo.pdf -------------------------------------------------------------------------------- /Taipei 2016-04 course/lesson1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2016-04 course/lesson1.pdf -------------------------------------------------------------------------------- /Taipei 2016-04 course/lesson2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2016-04 course/lesson2.pdf -------------------------------------------------------------------------------- /Taipei 2016-04 course/lesson3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2016-04 course/lesson3.pdf -------------------------------------------------------------------------------- /Taipei 2016-04 talk/RESTful API Design-tw-2.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2016-04 talk/RESTful API Design-tw-2.1.pdf -------------------------------------------------------------------------------- /Taipei 2016-08 talk/SQL_reporting.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2016-08 talk/SQL_reporting.pdf -------------------------------------------------------------------------------- /Taipei 2017-10 talk/SQL_report_v2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2017-10 talk/SQL_report_v2.pdf -------------------------------------------------------------------------------- /Taipei 2018-03 talk/mini-bigdata.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2018-03 talk/mini-bigdata.pdf -------------------------------------------------------------------------------- /Taipei 2018-06 talk/lesson0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2018-06 talk/lesson0.pdf -------------------------------------------------------------------------------- /Taipei 2019-04 course/lesson0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-04 course/lesson0.pdf -------------------------------------------------------------------------------- /Taipei 2019-04 course/lesson1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-04 course/lesson1.pdf -------------------------------------------------------------------------------- /Taipei 2019-04 course/lesson2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-04 course/lesson2.pdf -------------------------------------------------------------------------------- /Taipei 2019-04 course/lesson3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-04 course/lesson3.pdf -------------------------------------------------------------------------------- /Taipei 2019-04 course/lesson4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-04 course/lesson4.pdf -------------------------------------------------------------------------------- /Taipei 2019-06 talk/RESTful API Design-tw-2.2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-06 talk/RESTful API Design-tw-2.2.pdf -------------------------------------------------------------------------------- /Taipei 2019-06 talk/redis-2019.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-06 talk/redis-2019.pdf -------------------------------------------------------------------------------- /Taipei 2019-10 talk/concurrency.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/Taipei 2019-10 talk/concurrency.pdf -------------------------------------------------------------------------------- /concurrency-demo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/concurrency-demo.pdf -------------------------------------------------------------------------------- /internal-talk/internal_talk1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/internal-talk/internal_talk1.pdf -------------------------------------------------------------------------------- /introToAlgorithm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/introToAlgorithm.pdf -------------------------------------------------------------------------------- /letter-to-rookie.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/letter-to-rookie.pdf -------------------------------------------------------------------------------- /nosql-intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/nosql-intro.pdf -------------------------------------------------------------------------------- /opensource.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/opensource.pdf -------------------------------------------------------------------------------- /restful-demo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TritonHo/slides/6f2ff97847101cbacff47242f0c8b79b66581143/restful-demo.pdf --------------------------------------------------------------------------------