From 122e5dfda6d274cb0a1d5c26119eaacbbcc6530e Mon Sep 17 00:00:00 2001 From: nicksxs Date: Sun, 23 Feb 2020 15:37:51 +0800 Subject: [PATCH] Site updated: 2020-02-23 15:37:50 --- 2014/12/23/my-new-post/index.html | 8 +- 2014/12/24/MFC 模态对话框/index.html | 16 +- 2014/12/30/Clone-Graph-Part-I/index.html | 12 +- 2015/01/04/Path-Sum/index.html | 14 +- 2015/01/14/Two-Sum/index.html | 16 +- .../index.html | 16 +- 2015/03/11/Number-Of-1-Bits/index.html | 16 +- 2015/03/11/Reverse-Bits/index.html | 16 +- 2015/03/13/Reverse-Integer/index.html | 16 +- 2015/04/14/Add-Two-Number/index.html | 16 +- 2015/04/15/Leetcode-No-3/index.html | 14 +- 2015/06/22/invert-binary-tree/index.html | 16 +- 2016/07/13/swoole-websocket-test/index.html | 8 +- 2016/08/14/34-Search-for-a-Range/index.html | 16 +- 2016/08/14/docker-mysql-cluster/index.html | 8 +- 2016/09/29/binary-watch/index.html | 16 +- .../minimum-size-subarray-sum-209/index.html | 16 +- 2016/10/12/summary-ranges-228/index.html | 16 +- .../index.html | 8 +- 2017/03/28/spark-little-tips/index.html | 8 +- 2017/04/25/rabbitmq-tips/index.html | 8 +- 2017/05/09/ambari-summary/index.html | 8 +- 2019/06/18/openresty/index.html | 8 +- .../23/AbstractQueuedSynchronizer/index.html | 8 +- 2019/12/07/JVM-G1-Part-1/index.html | 8 +- 2019/12/10/Redis-Part-1/index.html | 8 +- 2019/12/18/1Q84读后感/index.html | 8 +- .../聊聊Java中的单例模式/index.html | 8 +- 2019/12/26/redis数据结构介绍/index.html | 8 +- .../04/redis数据结构介绍二/index.html | 8 +- .../10/redis数据结构介绍三/index.html | 8 +- .../19/redis数据结构介绍四/index.html | 8 +- .../20/redis数据结构介绍五/index.html | 8 +- .../22/redis数据结构介绍六/index.html | 8 +- 2020/02/01/2019年终总结/index.html | 8 +- 2020/02/09/G1收集器概述/index.html | 8 +- 2020/02/16/Maven实用小技巧/index.html | 13 +- .../index.html | 662 ++++++++++++++++++ 404.html | 8 +- 404/index.html | 8 +- archives/2014/12/index.html | 10 +- archives/2014/index.html | 10 +- archives/2015/01/index.html | 10 +- archives/2015/03/index.html | 10 +- archives/2015/04/index.html | 10 +- archives/2015/06/index.html | 10 +- archives/2015/index.html | 10 +- archives/2016/07/index.html | 10 +- archives/2016/08/index.html | 10 +- archives/2016/09/index.html | 10 +- archives/2016/10/index.html | 10 +- archives/2016/11/index.html | 10 +- archives/2016/index.html | 10 +- archives/2017/03/index.html | 10 +- archives/2017/04/index.html | 10 +- archives/2017/05/index.html | 10 +- archives/2017/index.html | 10 +- archives/2019/06/index.html | 10 +- archives/2019/09/index.html | 10 +- archives/2019/12/index.html | 10 +- archives/2019/index.html | 10 +- archives/2020/01/index.html | 10 +- archives/2020/02/index.html | 30 +- archives/2020/index.html | 30 +- archives/index.html | 50 +- archives/page/2/index.html | 50 +- archives/page/3/index.html | 50 +- archives/page/4/index.html | 30 +- atom.xml | 60 +- baidu_verify_Gl8jtoDV4z.html | 8 +- baidusitemap.xml | 29 +- categories/C/Redis/index.html | 8 +- categories/C/index.html | 8 +- categories/Java/Design-Patterns/index.html | 8 +- categories/Java/GC/index.html | 8 +- categories/Java/JVM/index.html | 8 +- categories/Java/Maven/index.html | 8 +- categories/Java/Singleton/index.html | 8 +- categories/Java/index.html | 8 +- categories/Redis/Distributed-Lock/index.html | 8 +- categories/Redis/index.html | 8 +- categories/Redis/数据结构/index.html | 8 +- categories/Redis/源码/index.html | 8 +- categories/data-analysis/index.html | 8 +- categories/docker/index.html | 8 +- categories/index.html | 12 +- categories/leetcode/index.html | 8 +- categories/leetcode/page/2/index.html | 8 +- categories/nginx/index.html | 8 +- categories/php/index.html | 8 +- categories/持续集成/index.html | 512 ++++++++++++++ categories/生活/index.html | 8 +- .../生活/年终总结/2019/index.html | 8 +- categories/生活/年终总结/index.html | 8 +- categories/读后感/index.html | 8 +- categories/读后感/村上春树/index.html | 8 +- css/main.css | 2 +- index.html | 233 +++--- lib/pace/README.html | 8 +- page/2/index.html | 215 +++--- page/3/index.html | 201 +++--- page/4/index.html | 107 ++- sitemap.xml | 19 +- tags/2019/index.html | 8 +- tags/Design-Patterns/index.html | 8 +- tags/Distributed-Lock/index.html | 8 +- tags/G1/index.html | 8 +- tags/GC/index.html | 8 +- tags/Garbage-First-Collector/index.html | 8 +- tags/Gogs/index.html | 512 ++++++++++++++ tags/JVM/index.html | 8 +- tags/Maven/index.html | 8 +- tags/Redis/index.html | 8 +- tags/Singleton/index.html | 8 +- tags/Webhook/index.html | 512 ++++++++++++++ tags/aqs/index.html | 8 +- tags/c/index.html | 358 +++++----- tags/c/page/2/index.html | 8 +- tags/cluster/index.html | 8 +- tags/docker/index.html | 8 +- tags/hadoop/index.html | 8 +- tags/im/index.html | 8 +- tags/index.html | 12 +- tags/java/index.html | 8 +- tags/leetcode/index.html | 8 +- tags/leetcode/page/2/index.html | 8 +- tags/mfc/index.html | 8 +- tags/mq/index.html | 8 +- tags/mysql/index.html | 8 +- tags/nginx/index.html | 8 +- tags/openresty/index.html | 8 +- tags/php/index.html | 8 +- tags/python/index.html | 8 +- tags/spark/index.html | 8 +- tags/swoole/index.html | 8 +- tags/websocket/index.html | 8 +- tags/分布式锁/index.html | 8 +- tags/单例/index.html | 8 +- tags/博客,文章/index.html | 8 +- tags/年终总结/index.html | 8 +- tags/数据结构/index.html | 8 +- tags/源码/index.html | 8 +- tags/生活/index.html | 8 +- tags/设计模式/index.html | 8 +- tags/读后感/index.html | 8 +- 145 files changed, 3632 insertions(+), 1207 deletions(-) create mode 100644 2020/02/22/gogs使用webhook部署react单页应用/index.html create mode 100644 categories/持续集成/index.html create mode 100644 tags/Gogs/index.html create mode 100644 tags/Webhook/index.html diff --git a/2014/12/23/my-new-post/index.html b/2014/12/23/my-new-post/index.html index 43229f3b07..356330d887 100644 --- a/2014/12/23/my-new-post/index.html +++ b/2014/12/23/my-new-post/index.html @@ -436,20 +436,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -474,7 +474,7 @@
diff --git a/2014/12/24/MFC 模态对话框/index.html b/2014/12/24/MFC 模态对话框/index.html index 87a3e13bc4..28d1aca6df 100644 --- a/2014/12/24/MFC 模态对话框/index.html +++ b/2014/12/24/MFC 模态对话框/index.html @@ -308,16 +308,16 @@ @@ -459,20 +459,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -497,7 +497,7 @@
diff --git a/2014/12/30/Clone-Graph-Part-I/index.html b/2014/12/30/Clone-Graph-Part-I/index.html index 4d128db502..f73dc36a1b 100644 --- a/2014/12/30/Clone-Graph-Part-I/index.html +++ b/2014/12/30/Clone-Graph-Part-I/index.html @@ -307,7 +307,7 @@ @@ -462,20 +462,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -500,7 +500,7 @@
diff --git a/2015/01/04/Path-Sum/index.html b/2015/01/04/Path-Sum/index.html index b3e4a5526b..6bd9012d93 100644 --- a/2015/01/04/Path-Sum/index.html +++ b/2015/01/04/Path-Sum/index.html @@ -309,7 +309,7 @@ @@ -464,20 +464,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -502,7 +502,7 @@
diff --git a/2015/01/14/Two-Sum/index.html b/2015/01/14/Two-Sum/index.html index 535e10a0e9..28fc3a20dc 100644 --- a/2015/01/14/Two-Sum/index.html +++ b/2015/01/14/Two-Sum/index.html @@ -310,19 +310,19 @@ @@ -465,20 +465,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -503,7 +503,7 @@
diff --git a/2015/01/16/pcre-intro-and-a-simple-package/index.html b/2015/01/16/pcre-intro-and-a-simple-package/index.html index 4219a743f6..c4b672def6 100644 --- a/2015/01/16/pcre-intro-and-a-simple-package/index.html +++ b/2015/01/16/pcre-intro-and-a-simple-package/index.html @@ -325,16 +325,16 @@ @@ -477,20 +477,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -515,7 +515,7 @@
diff --git a/2015/03/11/Number-Of-1-Bits/index.html b/2015/03/11/Number-Of-1-Bits/index.html index dc25343719..d1e5364905 100644 --- a/2015/03/11/Number-Of-1-Bits/index.html +++ b/2015/03/11/Number-Of-1-Bits/index.html @@ -306,19 +306,19 @@ @@ -461,20 +461,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -499,7 +499,7 @@
diff --git a/2015/03/11/Reverse-Bits/index.html b/2015/03/11/Reverse-Bits/index.html index 79ae40a62c..1f067d68e1 100644 --- a/2015/03/11/Reverse-Bits/index.html +++ b/2015/03/11/Reverse-Bits/index.html @@ -307,19 +307,19 @@ @@ -462,20 +462,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -500,7 +500,7 @@
diff --git a/2015/03/13/Reverse-Integer/index.html b/2015/03/13/Reverse-Integer/index.html index 0effd5f9da..40556418e2 100644 --- a/2015/03/13/Reverse-Integer/index.html +++ b/2015/03/13/Reverse-Integer/index.html @@ -310,19 +310,19 @@ @@ -465,20 +465,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -503,7 +503,7 @@
diff --git a/2015/04/14/Add-Two-Number/index.html b/2015/04/14/Add-Two-Number/index.html index ae2431a108..01e18a08e5 100644 --- a/2015/04/14/Add-Two-Number/index.html +++ b/2015/04/14/Add-Two-Number/index.html @@ -310,19 +310,19 @@ @@ -465,20 +465,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -503,7 +503,7 @@
diff --git a/2015/04/15/Leetcode-No-3/index.html b/2015/04/15/Leetcode-No-3/index.html index 9f3cddae6c..07a1abb179 100644 --- a/2015/04/15/Leetcode-No-3/index.html +++ b/2015/04/15/Leetcode-No-3/index.html @@ -307,19 +307,19 @@ @@ -462,20 +462,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -500,7 +500,7 @@
diff --git a/2015/06/22/invert-binary-tree/index.html b/2015/06/22/invert-binary-tree/index.html index 4d5a857c6f..cdf6f108ff 100644 --- a/2015/06/22/invert-binary-tree/index.html +++ b/2015/06/22/invert-binary-tree/index.html @@ -316,19 +316,19 @@ @@ -470,20 +470,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -508,7 +508,7 @@
diff --git a/2016/07/13/swoole-websocket-test/index.html b/2016/07/13/swoole-websocket-test/index.html index 4dbeefc074..fb075fbd78 100644 --- a/2016/07/13/swoole-websocket-test/index.html +++ b/2016/07/13/swoole-websocket-test/index.html @@ -469,20 +469,20 @@ user3:
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -507,7 +507,7 @@ user3:
diff --git a/2016/08/14/34-Search-for-a-Range/index.html b/2016/08/14/34-Search-for-a-Range/index.html index b416dc159b..865fda21d6 100644 --- a/2016/08/14/34-Search-for-a-Range/index.html +++ b/2016/08/14/34-Search-for-a-Range/index.html @@ -308,19 +308,19 @@ @@ -463,20 +463,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -501,7 +501,7 @@
diff --git a/2016/08/14/docker-mysql-cluster/index.html b/2016/08/14/docker-mysql-cluster/index.html index eb161e4470..54819adb33 100644 --- a/2016/08/14/docker-mysql-cluster/index.html +++ b/2016/08/14/docker-mysql-cluster/index.html @@ -449,20 +449,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -487,7 +487,7 @@
diff --git a/2016/09/29/binary-watch/index.html b/2016/09/29/binary-watch/index.html index d580eea0fa..eb9f0248a3 100644 --- a/2016/09/29/binary-watch/index.html +++ b/2016/09/29/binary-watch/index.html @@ -316,19 +316,19 @@ @@ -471,20 +471,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -509,7 +509,7 @@
diff --git a/2016/10/11/minimum-size-subarray-sum-209/index.html b/2016/10/11/minimum-size-subarray-sum-209/index.html index bd304e1f3f..78f65144a0 100644 --- a/2016/10/11/minimum-size-subarray-sum-209/index.html +++ b/2016/10/11/minimum-size-subarray-sum-209/index.html @@ -306,19 +306,19 @@ @@ -461,20 +461,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -499,7 +499,7 @@
diff --git a/2016/10/12/summary-ranges-228/index.html b/2016/10/12/summary-ranges-228/index.html index 4f9c5e2d96..ef480e7f44 100644 --- a/2016/10/12/summary-ranges-228/index.html +++ b/2016/10/12/summary-ranges-228/index.html @@ -305,19 +305,19 @@ @@ -460,20 +460,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -498,7 +498,7 @@
diff --git a/2016/11/10/php-abstract-class-and-interface/index.html b/2016/11/10/php-abstract-class-and-interface/index.html index 48c1d1beb6..47e9ca6d20 100644 --- a/2016/11/10/php-abstract-class-and-interface/index.html +++ b/2016/11/10/php-abstract-class-and-interface/index.html @@ -455,20 +455,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -493,7 +493,7 @@
diff --git a/2017/03/28/spark-little-tips/index.html b/2017/03/28/spark-little-tips/index.html index 3c4539e93b..5c53cb7b3b 100644 --- a/2017/03/28/spark-little-tips/index.html +++ b/2017/03/28/spark-little-tips/index.html @@ -444,20 +444,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -482,7 +482,7 @@
diff --git a/2017/04/25/rabbitmq-tips/index.html b/2017/04/25/rabbitmq-tips/index.html index 978fcf3c27..cb1b802c9a 100644 --- a/2017/04/25/rabbitmq-tips/index.html +++ b/2017/04/25/rabbitmq-tips/index.html @@ -456,20 +456,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -494,7 +494,7 @@
diff --git a/2017/05/09/ambari-summary/index.html b/2017/05/09/ambari-summary/index.html index 32f7aa246b..2d081437a7 100644 --- a/2017/05/09/ambari-summary/index.html +++ b/2017/05/09/ambari-summary/index.html @@ -448,20 +448,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -486,7 +486,7 @@
diff --git a/2019/06/18/openresty/index.html b/2019/06/18/openresty/index.html index 72b64a453d..5d48b85a0d 100644 --- a/2019/06/18/openresty/index.html +++ b/2019/06/18/openresty/index.html @@ -470,20 +470,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -508,7 +508,7 @@
diff --git a/2019/09/23/AbstractQueuedSynchronizer/index.html b/2019/09/23/AbstractQueuedSynchronizer/index.html index a49f9e1dca..1daec88b40 100644 --- a/2019/09/23/AbstractQueuedSynchronizer/index.html +++ b/2019/09/23/AbstractQueuedSynchronizer/index.html @@ -445,20 +445,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -483,7 +483,7 @@
diff --git a/2019/12/07/JVM-G1-Part-1/index.html b/2019/12/07/JVM-G1-Part-1/index.html index bb50bb225f..6c48b0a3b0 100644 --- a/2019/12/07/JVM-G1-Part-1/index.html +++ b/2019/12/07/JVM-G1-Part-1/index.html @@ -483,20 +483,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -521,7 +521,7 @@
diff --git a/2019/12/10/Redis-Part-1/index.html b/2019/12/10/Redis-Part-1/index.html index 9b0597c920..8736ae5c05 100644 --- a/2019/12/10/Redis-Part-1/index.html +++ b/2019/12/10/Redis-Part-1/index.html @@ -479,20 +479,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -517,7 +517,7 @@
diff --git a/2019/12/18/1Q84读后感/index.html b/2019/12/18/1Q84读后感/index.html index 05f0735888..5a86e82415 100644 --- a/2019/12/18/1Q84读后感/index.html +++ b/2019/12/18/1Q84读后感/index.html @@ -455,20 +455,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -493,7 +493,7 @@
diff --git a/2019/12/21/聊聊Java中的单例模式/index.html b/2019/12/21/聊聊Java中的单例模式/index.html index c6d93e5bc4..ff9341a5f1 100644 --- a/2019/12/21/聊聊Java中的单例模式/index.html +++ b/2019/12/21/聊聊Java中的单例模式/index.html @@ -468,20 +468,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -506,7 +506,7 @@
diff --git a/2019/12/26/redis数据结构介绍/index.html b/2019/12/26/redis数据结构介绍/index.html index ae40dfa0e1..6ba64121ae 100644 --- a/2019/12/26/redis数据结构介绍/index.html +++ b/2019/12/26/redis数据结构介绍/index.html @@ -502,20 +502,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -540,7 +540,7 @@
diff --git a/2020/01/04/redis数据结构介绍二/index.html b/2020/01/04/redis数据结构介绍二/index.html index 6ea2882d73..cc52207dd7 100644 --- a/2020/01/04/redis数据结构介绍二/index.html +++ b/2020/01/04/redis数据结构介绍二/index.html @@ -496,20 +496,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -534,7 +534,7 @@
diff --git a/2020/01/10/redis数据结构介绍三/index.html b/2020/01/10/redis数据结构介绍三/index.html index 55a3f64f04..d5d128cb95 100644 --- a/2020/01/10/redis数据结构介绍三/index.html +++ b/2020/01/10/redis数据结构介绍三/index.html @@ -496,20 +496,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -534,7 +534,7 @@
diff --git a/2020/01/19/redis数据结构介绍四/index.html b/2020/01/19/redis数据结构介绍四/index.html index 339e6924a5..8cdbffdc7f 100644 --- a/2020/01/19/redis数据结构介绍四/index.html +++ b/2020/01/19/redis数据结构介绍四/index.html @@ -491,20 +491,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -529,7 +529,7 @@
diff --git a/2020/01/20/redis数据结构介绍五/index.html b/2020/01/20/redis数据结构介绍五/index.html index e6b3be3b05..38a87e343e 100644 --- a/2020/01/20/redis数据结构介绍五/index.html +++ b/2020/01/20/redis数据结构介绍五/index.html @@ -489,20 +489,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -527,7 +527,7 @@
diff --git a/2020/01/22/redis数据结构介绍六/index.html b/2020/01/22/redis数据结构介绍六/index.html index c81176f1ef..6e43ba2b92 100644 --- a/2020/01/22/redis数据结构介绍六/index.html +++ b/2020/01/22/redis数据结构介绍六/index.html @@ -511,20 +511,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -549,7 +549,7 @@
diff --git a/2020/02/01/2019年终总结/index.html b/2020/02/01/2019年终总结/index.html index 9f02ea2cef..0e4c92f948 100644 --- a/2020/02/01/2019年终总结/index.html +++ b/2020/02/01/2019年终总结/index.html @@ -461,20 +461,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -499,7 +499,7 @@
diff --git a/2020/02/09/G1收集器概述/index.html b/2020/02/09/G1收集器概述/index.html index 93b5f9374c..9a36cfba75 100644 --- a/2020/02/09/G1收集器概述/index.html +++ b/2020/02/09/G1收集器概述/index.html @@ -481,20 +481,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -519,7 +519,7 @@
diff --git a/2020/02/16/Maven实用小技巧/index.html b/2020/02/16/Maven实用小技巧/index.html index 12ad5f35f5..a3e5e4917c 100644 --- a/2020/02/16/Maven实用小技巧/index.html +++ b/2020/02/16/Maven实用小技巧/index.html @@ -387,7 +387,10 @@ -
+
+
@@ -470,20 +473,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -508,7 +511,7 @@
diff --git a/2020/02/22/gogs使用webhook部署react单页应用/index.html b/2020/02/22/gogs使用webhook部署react单页应用/index.html new file mode 100644 index 0000000000..9dfb075a4a --- /dev/null +++ b/2020/02/22/gogs使用webhook部署react单页应用/index.html @@ -0,0 +1,662 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gogs使用webhook部署react单页应用 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + +

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + +
+ + + +
+ + + + + +
+

+ gogs使用webhook部署react单页应用 +

+ + +
+ + + + +
+ + +

众所周知,我是个前端彩笔,但是也想做点自己可以用的工具页面,所以就让朋友推荐了蚂蚁出品的 ant design,说基本可以直接 ctrl-c ctrl-v,实测对我这种来说还是有点难的,不过也能写点,但是现在碰到的问题是怎么部署到自己的服务器上去
用 ant design 写的是个单页应用,实际来说就是一个 html 加 css 跟 js,最初的时候是直接 build 完就 scp 上去,也考虑过 rsync 之类的,但是都感觉不够自动化,正好自己还没这方面的经验就想折腾下,因为我自己搭的仓库应用是 gogs,搜了一下主要是跟 drones 配合做 ci/cd,研究了一下发现其实这个事情没必要这么搞(PS:drone 也不好用),整个 hook 就可以了, 但是实际上呢,这东西也不是那么简单
首先是需要在服务器上装 webhook,这个我一开始用 snap 安装,但是出现问题,run 的时候会出现后面参数带的 hooks.json 文件找不到,然后索性就直接 github 上下最新版,放 /usr/local/bin 了,webhook 的原理呢其实也比较简单,就是起一个 http 服务,通过 post 请求调用,解析下参数,如果跟配置的参数一致,就调用对应的命令或者脚本。

+

配置 hooks.json

webhook 的配置,需要的两个文件,一个是 hooks.json,这个是 webhook 服务的配置文件,像这样

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
[
{
"id": "redeploy-app",
"execute-command": "/opt/scripts/redeploy.sh",
"command-working-directory": "/opt/scripts",
"pass-arguments-to-command":
[
{
"source": "payload",
"name": "head_commit.message"
},
{
"source": "payload",
"name": "pusher.name"
},
{
"source": "payload",
"name": "head_commit.id"
}
],
"trigger-rule":
{
"and":
[
{
"match":
{
"type": "payload-hash-sha1",
"secret": "your-github-secret",
"parameter":
{
"source": "header",
"name": "X-Hub-Signature"
}
}
},
{
"match":
{
"type": "value",
"value": "refs/heads/master",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
}
]
}
}
]
+ +

这是个跟 github搭配的示例,首先 id 表示的是这个对应 hook 的识别 id,也可以看到这个 hooks.json 的结构是这样的一个数组,然后就是要执行的命令和命令执行的参数,值得注意的是这个trigger-rule,就是请求进来了回去匹配里面的,比如前一个是一个加密的,放在请求头里,第二个 match 表示请求里的 ref 是个 master 分支,就可以区分分支进行不同操作,但是前面的加密配合 gogs 使用的时候有个问题(PS: webhook 的文档是真的烂),gogs 设置 webhook 的加密是用的

+
+

密钥文本将被用于计算推送内容的 SHA256 HMAC 哈希值,并设置为 X-Gogs-Signature 请求头的值。

+
+

这种加密方式,所以 webhook 的这个示例的加密方式不行,但这货的文档里居然没有说明支持哪些加密,神TM,后来还是翻 issue 翻到了, 需要使用这个payload-hash-sha256

+

执行脚本 redeploy.sh

脚本类似于这样

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash -e

function cleanup {
echo "Error occoured"
}
trap cleanup ERR

commit_message=$1 # head_commit.message
pusher_name=$2 # pusher.name
commit_id=$3 # head_commit.id


cd ~/do-react-example-app/
git pull origin master
yarn && yarn build
+ +

就是简单的拉代码,然后构建下,真实使用时可能不是这样,因为页面会部署在 nginx 的作用目录,还需要 rsync 过去,这部分可能还涉及到两个问题第一个是使用 rsync 还是其他的 cp,不过这个无所谓;第二个是目录权限的问题,以我的系统ubuntu 为例,默认用户是 ubuntu,nginx 部署的目录是 www,所以需要切换用户等操作,一开始是想用在shell 文件中直接写了密码,但是不知道咋传,查了下是类似于这样 echo "passwd" | sudo -S cmd,通过管道命令往后传,然后就是这个-S, 参数的解释是-S, --stdin read password from standard input,但是这样么也不是太安全的赶脚,又看了下还有两种方法,

+
    +
  • 就是给root 设置一个不需要密码的命令类似于这样,

    +
    1
    2
    myusername ALL = (ALL) ALL
    myusername ALL = (root) NOPASSWD: /path/to/my/program
    +
  • +
  • 另一种就是把默认用户跟 root 设置成同一个 group 的

    +
  • +
+

使用

真正实操的时候其实还有不少问题,首先运行 webhook 就碰到了我前面说的,使用 snap 运行的时候会找不到前面的 hooks.json配置文件,执行snap run webhook -hooks /opt/hooks/hooks.json -verbose就碰到下面的couldn't load hooks from file! open /opt/hooks/hooks.json: no such file or directory,后来直接下了个官方最新的 release,就直接执行 webhook -hooks /opt/hooks/hooks.json -verbose 就可以了,然后是前面的示例配置文件里的几个参数,比如head_commit.message 其实 gogs 推过来的根本没这玩意,而且都是数组,不知道咋取,烂文档,不过总比搭个 drone 好一点就忍了。

+ +
+ + + + + + +
+
请我喝杯咖啡
+ + +
+ + + +
+ +
+ + + + +
+ + + + +
+ + +
+ + +
+
+ +
+
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/404.html b/404.html index cef46c91eb..bf8cc0cc31 100644 --- a/404.html +++ b/404.html @@ -340,20 +340,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -378,7 +378,7 @@
diff --git a/404/index.html b/404/index.html index b5ac54bd56..1a34a6947e 100644 --- a/404/index.html +++ b/404/index.html @@ -327,20 +327,20 @@
- 37 + 38 posts
- 24 + 25 categories
- 41 + 43 tags
@@ -365,7 +365,7 @@
diff --git a/archives/2014/12/index.html b/archives/2014/12/index.html index 2d86e6c3ce..72376fa97b 100644 --- a/archives/2014/12/index.html +++ b/archives/2014/12/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2014/index.html b/archives/2014/index.html index 5e37669838..9b1ce0205a 100644 --- a/archives/2014/index.html +++ b/archives/2014/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2015/01/index.html b/archives/2015/01/index.html index 3b5b4e356f..4ecbfe339b 100644 --- a/archives/2015/01/index.html +++ b/archives/2015/01/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2015/03/index.html b/archives/2015/03/index.html index be5681f905..fa0a597ee5 100644 --- a/archives/2015/03/index.html +++ b/archives/2015/03/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2015/04/index.html b/archives/2015/04/index.html index 7a8a3c8397..bfb63d045e 100644 --- a/archives/2015/04/index.html +++ b/archives/2015/04/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/archives/2015/06/index.html b/archives/2015/06/index.html index 631bf37316..9479dfbc94 100644 --- a/archives/2015/06/index.html +++ b/archives/2015/06/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2015/index.html b/archives/2015/index.html index 7d714e2eff..2238ddb6ab 100644 --- a/archives/2015/index.html +++ b/archives/2015/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -488,20 +488,20 @@ @@ -526,7 +526,7 @@ diff --git a/archives/2016/07/index.html b/archives/2016/07/index.html index eed403533e..b3c7405aa3 100644 --- a/archives/2016/07/index.html +++ b/archives/2016/07/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2016/08/index.html b/archives/2016/08/index.html index 309f25b1b8..a1873d8a51 100644 --- a/archives/2016/08/index.html +++ b/archives/2016/08/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/archives/2016/09/index.html b/archives/2016/09/index.html index ca92fc1994..3e92df06d6 100644 --- a/archives/2016/09/index.html +++ b/archives/2016/09/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2016/10/index.html b/archives/2016/10/index.html index d23a110c0f..0fc5427fb4 100644 --- a/archives/2016/10/index.html +++ b/archives/2016/10/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/archives/2016/11/index.html b/archives/2016/11/index.html index 7cab77c43a..ed81f0b9a6 100644 --- a/archives/2016/11/index.html +++ b/archives/2016/11/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2016/index.html b/archives/2016/index.html index 908e7fb5f6..34766fcca5 100644 --- a/archives/2016/index.html +++ b/archives/2016/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -448,20 +448,20 @@ @@ -486,7 +486,7 @@ diff --git a/archives/2017/03/index.html b/archives/2017/03/index.html index 752ba44af2..bb1c3e50fc 100644 --- a/archives/2017/03/index.html +++ b/archives/2017/03/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2017/04/index.html b/archives/2017/04/index.html index 87273f72f1..c8ec43d788 100644 --- a/archives/2017/04/index.html +++ b/archives/2017/04/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2017/05/index.html b/archives/2017/05/index.html index 1bd694f4c5..c88f90b1c2 100644 --- a/archives/2017/05/index.html +++ b/archives/2017/05/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2017/index.html b/archives/2017/index.html index a8893f902a..ba941a7568 100644 --- a/archives/2017/index.html +++ b/archives/2017/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2019/06/index.html b/archives/2019/06/index.html index 8ceaa8184f..35ce5a231e 100644 --- a/archives/2019/06/index.html +++ b/archives/2019/06/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2019/09/index.html b/archives/2019/09/index.html index 05004425bb..96e437d0a0 100644 --- a/archives/2019/09/index.html +++ b/archives/2019/09/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2019/12/index.html b/archives/2019/12/index.html index c325b5038d..ffe38fdb91 100644 --- a/archives/2019/12/index.html +++ b/archives/2019/12/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -408,20 +408,20 @@ @@ -446,7 +446,7 @@ diff --git a/archives/2019/index.html b/archives/2019/index.html index 1e0cf9104d..1588677d3a 100644 --- a/archives/2019/index.html +++ b/archives/2019/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -448,20 +448,20 @@ @@ -486,7 +486,7 @@ diff --git a/archives/2020/01/index.html b/archives/2020/01/index.html index 9b0c6e0c2c..866c5c8095 100644 --- a/archives/2020/01/index.html +++ b/archives/2020/01/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -408,20 +408,20 @@ @@ -446,7 +446,7 @@ diff --git a/archives/2020/02/index.html b/archives/2020/02/index.html index 647bf5a2a9..97ec72751e 100644 --- a/archives/2020/02/index.html +++ b/archives/2020/02/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2020

+ +
@@ -368,20 +388,20 @@ @@ -406,7 +426,7 @@ diff --git a/archives/2020/index.html b/archives/2020/index.html index 6658e38f1f..86932d9834 100644 --- a/archives/2020/index.html +++ b/archives/2020/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2020

+ +
@@ -468,20 +488,20 @@ @@ -506,7 +526,7 @@ diff --git a/archives/index.html b/archives/index.html index 3f0bd7ba74..0685021751 100644 --- a/archives/index.html +++ b/archives/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2020

+ +
@@ -417,26 +437,6 @@
- -
@@ -514,20 +514,20 @@ @@ -552,7 +552,7 @@ diff --git a/archives/page/2/index.html b/archives/page/2/index.html index f42e02bfca..b1b94f88ac 100644 --- a/archives/page/2/index.html +++ b/archives/page/2/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2019

+ +
@@ -420,26 +440,6 @@
- -
@@ -517,20 +517,20 @@ @@ -555,7 +555,7 @@ diff --git a/archives/page/3/index.html b/archives/page/3/index.html index 817fa1a932..efb6c7ae82 100644 --- a/archives/page/3/index.html +++ b/archives/page/3/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2016

+ +
@@ -417,26 +437,6 @@
- -
@@ -514,20 +514,20 @@ @@ -552,7 +552,7 @@ diff --git a/archives/page/4/index.html b/archives/page/4/index.html index 7a7ccba597..64a6c3b8b8 100644 --- a/archives/page/4/index.html +++ b/archives/page/4/index.html @@ -226,7 +226,7 @@
- OK! 37 posts in total. Keep on posting. + OK! 38 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2015

+ +
@@ -454,20 +474,20 @@ @@ -492,7 +512,7 @@ diff --git a/atom.xml b/atom.xml index a00559d095..9a4f021d73 100644 --- a/atom.xml +++ b/atom.xml @@ -6,7 +6,7 @@ - 2020-02-16T06:36:56.046Z + 2020-02-23T07:36:56.117Z https://nicksxs.me/ @@ -16,6 +16,35 @@ Hexo + + gogs使用webhook部署react单页应用 + + https://nicksxs.me/2020/02/22/gogs%E4%BD%BF%E7%94%A8webhook%E9%83%A8%E7%BD%B2react%E5%8D%95%E9%A1%B5%E5%BA%94%E7%94%A8/ + 2020-02-22T04:25:25.000Z + 2020-02-23T07:36:56.117Z + + + + + + + + <p>众所周知,我是个前端彩笔,但是也想做点自己可以用的工具页面,所以就让朋友推荐了蚂蚁出品的 ant design,说基本可以直接 ctrl-c ctrl-v,实测对我这种来说还是有点难的,不过也能写点,但是现在碰到的问题是怎么部署到自己的服务器上去<br>用 ant + + + + + + + + + + + + + + + Maven实用小技巧 @@ -683,33 +712,4 @@ - - summary-ranges-228 - - https://nicksxs.me/2016/10/12/summary-ranges-228/ - 2016-10-12T15:25:17.000Z - 2020-01-12T13:08:26.994Z - - - - - - - - <h4 id="problem"><a href="#problem" class="headerlink" title="problem"></a>problem</h4><p>Given a sorted integer array without duplicates, - - - - - - - - - - - - - - - diff --git a/baidu_verify_Gl8jtoDV4z.html b/baidu_verify_Gl8jtoDV4z.html index c7dd8edf8d..142c30edf4 100644 --- a/baidu_verify_Gl8jtoDV4z.html +++ b/baidu_verify_Gl8jtoDV4z.html @@ -329,20 +329,20 @@ @@ -367,7 +367,7 @@ diff --git a/baidusitemap.xml b/baidusitemap.xml index d1626d85a3..4b6c0f9874 100644 --- a/baidusitemap.xml +++ b/baidusitemap.xml @@ -1,6 +1,9 @@ + https://nicksxs.me/2020/02/22/gogs%E4%BD%BF%E7%94%A8webhook%E9%83%A8%E7%BD%B2react%E5%8D%95%E9%A1%B5%E5%BA%94%E7%94%A8/ + 2020-02-23 + https://nicksxs.me/2020/02/16/Maven%E5%AE%9E%E7%94%A8%E5%B0%8F%E6%8A%80%E5%B7%A7/ 2020-02-16 @@ -24,33 +27,33 @@ https://nicksxs.me/2015/01/14/Two-Sum/ 2020-01-12 - - https://nicksxs.me/2016/09/29/binary-watch/ - 2020-01-12 https://nicksxs.me/2016/11/10/php-abstract-class-and-interface/ 2020-01-12 - https://nicksxs.me/2019/12/26/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D/ + https://nicksxs.me/2016/09/29/binary-watch/ 2020-01-12 - https://nicksxs.me/2015/03/13/Reverse-Integer/ + https://nicksxs.me/2019/12/26/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D/ 2020-01-12 https://nicksxs.me/2015/04/14/Add-Two-Number/ 2020-01-12 - https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ + https://nicksxs.me/2015/03/13/Reverse-Integer/ 2020-01-12 https://nicksxs.me/2016/08/14/docker-mysql-cluster/ 2020-01-12 - https://nicksxs.me/2019/06/18/openresty/ + https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ 2020-01-12 https://nicksxs.me/2017/05/09/ambari-summary/ 2020-01-12 + + https://nicksxs.me/2019/06/18/openresty/ + 2020-01-12 https://nicksxs.me/2020/01/04/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D%E4%BA%8C/ 2020-01-12 @@ -67,10 +70,10 @@ https://nicksxs.me/2020/01/10/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D%E4%B8%89/ 2020-01-12 - https://nicksxs.me/2017/03/28/spark-little-tips/ + https://nicksxs.me/2014/12/23/my-new-post/ 2020-01-12 - https://nicksxs.me/2014/12/23/my-new-post/ + https://nicksxs.me/2017/03/28/spark-little-tips/ 2020-01-12 https://nicksxs.me/2014/12/30/Clone-Graph-Part-I/ @@ -85,19 +88,19 @@ https://nicksxs.me/2015/06/22/invert-binary-tree/ 2020-01-12 - https://nicksxs.me/2015/01/04/Path-Sum/ + https://nicksxs.me/2017/04/25/rabbitmq-tips/ 2020-01-12 - https://nicksxs.me/2017/04/25/rabbitmq-tips/ + https://nicksxs.me/2015/01/04/Path-Sum/ 2020-01-12 https://nicksxs.me/2015/03/11/Number-Of-1-Bits/ 2020-01-12 - https://nicksxs.me/2015/04/15/Leetcode-No-3/ + https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ 2020-01-12 - https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ + https://nicksxs.me/2015/04/15/Leetcode-No-3/ 2020-01-12 https://nicksxs.me/2015/01/16/pcre-intro-and-a-simple-package/ diff --git a/categories/C/Redis/index.html b/categories/C/Redis/index.html index 331f3dcb0c..9eaac4b172 100644 --- a/categories/C/Redis/index.html +++ b/categories/C/Redis/index.html @@ -451,20 +451,20 @@ @@ -489,7 +489,7 @@ diff --git a/categories/C/index.html b/categories/C/index.html index b72daaf11b..78037fc9a0 100644 --- a/categories/C/index.html +++ b/categories/C/index.html @@ -451,20 +451,20 @@ @@ -489,7 +489,7 @@ diff --git a/categories/Java/Design-Patterns/index.html b/categories/Java/Design-Patterns/index.html index f1bb5591f2..03c85ce046 100644 --- a/categories/Java/Design-Patterns/index.html +++ b/categories/Java/Design-Patterns/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Java/GC/index.html b/categories/Java/GC/index.html index b5c550ec49..7ca0229fc8 100644 --- a/categories/Java/GC/index.html +++ b/categories/Java/GC/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/categories/Java/JVM/index.html b/categories/Java/JVM/index.html index c0af5df0dd..281d25958b 100644 --- a/categories/Java/JVM/index.html +++ b/categories/Java/JVM/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/categories/Java/Maven/index.html b/categories/Java/Maven/index.html index 54bf298c3d..87208b0039 100644 --- a/categories/Java/Maven/index.html +++ b/categories/Java/Maven/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Java/Singleton/index.html b/categories/Java/Singleton/index.html index bd4053abe7..b096066ae2 100644 --- a/categories/Java/Singleton/index.html +++ b/categories/Java/Singleton/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Java/index.html b/categories/Java/index.html index 3697498eeb..042492e30f 100644 --- a/categories/Java/index.html +++ b/categories/Java/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Redis/Distributed-Lock/index.html b/categories/Redis/Distributed-Lock/index.html index 8d243e75af..a11d6afc95 100644 --- a/categories/Redis/Distributed-Lock/index.html +++ b/categories/Redis/Distributed-Lock/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Redis/index.html b/categories/Redis/index.html index abc0b79895..a017b8338e 100644 --- a/categories/Redis/index.html +++ b/categories/Redis/index.html @@ -451,20 +451,20 @@ @@ -489,7 +489,7 @@ diff --git a/categories/Redis/数据结构/index.html b/categories/Redis/数据结构/index.html index ed9b103f39..fc1a8f4fb6 100644 --- a/categories/Redis/数据结构/index.html +++ b/categories/Redis/数据结构/index.html @@ -431,20 +431,20 @@ @@ -469,7 +469,7 @@ diff --git a/categories/Redis/源码/index.html b/categories/Redis/源码/index.html index f6ae7f2bc8..2d8066a8db 100644 --- a/categories/Redis/源码/index.html +++ b/categories/Redis/源码/index.html @@ -431,20 +431,20 @@ @@ -469,7 +469,7 @@ diff --git a/categories/data-analysis/index.html b/categories/data-analysis/index.html index 9b5f86796b..89aed1df91 100644 --- a/categories/data-analysis/index.html +++ b/categories/data-analysis/index.html @@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/categories/docker/index.html b/categories/docker/index.html index 8b3c45ace3..5d327aeec2 100644 --- a/categories/docker/index.html +++ b/categories/docker/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/index.html b/categories/index.html index 5d6f112760..83d4743e8f 100644 --- a/categories/index.html +++ b/categories/index.html @@ -247,10 +247,10 @@
@@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/categories/leetcode/index.html b/categories/leetcode/index.html index 35c3a4049b..8840019752 100644 --- a/categories/leetcode/index.html +++ b/categories/leetcode/index.html @@ -514,20 +514,20 @@ @@ -552,7 +552,7 @@ diff --git a/categories/leetcode/page/2/index.html b/categories/leetcode/page/2/index.html index bd9af499c8..98c0108252 100644 --- a/categories/leetcode/page/2/index.html +++ b/categories/leetcode/page/2/index.html @@ -374,20 +374,20 @@ @@ -412,7 +412,7 @@ diff --git a/categories/nginx/index.html b/categories/nginx/index.html index 075b538767..2aef568df1 100644 --- a/categories/nginx/index.html +++ b/categories/nginx/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/php/index.html b/categories/php/index.html index 25047cca4f..3a4f24f8b6 100644 --- a/categories/php/index.html +++ b/categories/php/index.html @@ -371,20 +371,20 @@ @@ -409,7 +409,7 @@ diff --git a/categories/持续集成/index.html b/categories/持续集成/index.html new file mode 100644 index 0000000000..ae2eb7a074 --- /dev/null +++ b/categories/持续集成/index.html @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Category: 持续集成 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + +

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

持续集成 + Category +

+
+ + +
+

2020

+
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/categories/生活/index.html b/categories/生活/index.html index d21dc8c88f..68c9ee9c64 100644 --- a/categories/生活/index.html +++ b/categories/生活/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/categories/生活/年终总结/2019/index.html b/categories/生活/年终总结/2019/index.html index 07a10bd4fc..fad9ac8adb 100644 --- a/categories/生活/年终总结/2019/index.html +++ b/categories/生活/年终总结/2019/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/生活/年终总结/index.html b/categories/生活/年终总结/index.html index 541bf9dc4d..05c1310f37 100644 --- a/categories/生活/年终总结/index.html +++ b/categories/生活/年终总结/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/读后感/index.html b/categories/读后感/index.html index f5b10a7e83..9543b38e5a 100644 --- a/categories/读后感/index.html +++ b/categories/读后感/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/读后感/村上春树/index.html b/categories/读后感/村上春树/index.html index f453a53513..caf66b985a 100644 --- a/categories/读后感/村上春树/index.html +++ b/categories/读后感/村上春树/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/css/main.css b/css/main.css index e702561f54..d01335f913 100644 --- a/css/main.css +++ b/css/main.css @@ -1259,7 +1259,7 @@ pre .javascript .function { } .links-of-author a::before, .links-of-author span.exturl::before { - background: #70eb0b; + background: #499cff; border-radius: 50%; content: ' '; display: inline-block; diff --git a/index.html b/index.html index f46a3da2ff..e0f34cb1f7 100644 --- a/index.html +++ b/index.html @@ -223,6 +223,118 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

众所周知,我是个前端彩笔,但是也想做点自己可以用的工具页面,所以就让朋友推荐了蚂蚁出品的 ant design,说基本可以直接 ctrl-c ctrl-v,实测对我这种来说还是有点难的,不过也能写点,但是现在碰到的问题是怎么部署到自己的服务器上去
用 ant design 写的是个单页应用,实际来说就是一个 html 加 css 跟 js,最初的时候是直接 build 完就 scp 上去,也考虑过 rsync 之类的,但是都感觉不够自动化,正好自己还没这方面的经验就想折腾下,因为我自己搭的仓库应用是 gogs,搜了一下主要是跟 drones 配合做 ci/cd,研究了一下发现其实这个事情没必要这么搞(PS:drone 也不好用),整个 hook 就可以了, 但是实际上呢,这东西也不是那么简单
首先是需要在服务器上装 webhook,这个我一开始用 snap 安装,但是出现问题,run 的时候会出现后面参数带的 hooks.json 文件找不到,然后索性就直接 github 上下最新版,放 /usr/local/bin 了,webhook 的原理呢其实也比较简单,就是起一个 http 服务,通过 post 请求调用,解析下参数,如果跟配置的参数一致,就调用对应的命令或者脚本。

+

配置 hooks.json

webhook 的配置,需要的两个文件,一个是 hooks.json,这个是 webhook 服务的配置文件,像这样

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
[
{
"id": "redeploy-app",
"execute-command": "/opt/scripts/redeploy.sh",
"command-working-directory": "/opt/scripts",
"pass-arguments-to-command":
[
{
"source": "payload",
"name": "head_commit.message"
},
{
"source": "payload",
"name": "pusher.name"
},
{
"source": "payload",
"name": "head_commit.id"
}
],
"trigger-rule":
{
"and":
[
{
"match":
{
"type": "payload-hash-sha1",
"secret": "your-github-secret",
"parameter":
{
"source": "header",
"name": "X-Hub-Signature"
}
}
},
{
"match":
{
"type": "value",
"value": "refs/heads/master",
"parameter":
{
"source": "payload",
"name": "ref"
}
}
}
]
}
}
]
+ +

这是个跟 github搭配的示例,首先 id 表示的是这个对应 hook 的识别 id,也可以看到这个 hooks.json 的结构是这样的一个数组,然后就是要执行的命令和命令执行的参数,值得注意的是这个trigger-rule,就是请求进来了回去匹配里面的,比如前一个是一个加密的,放在请求头里,第二个 match 表示请求里的 ref 是个 master 分支,就可以区分分支进行不同操作,但是前面的加密配合 gogs 使用的时候有个问题(PS: webhook 的文档是真的烂),gogs 设置 webhook 的加密是用的

+
+

密钥文本将被用于计算推送内容的 SHA256 HMAC 哈希值,并设置为 X-Gogs-Signature 请求头的值。

+
+

这种加密方式,所以 webhook 的这个示例的加密方式不行,但这货的文档里居然没有说明支持哪些加密,神TM,后来还是翻 issue 翻到了, 需要使用这个payload-hash-sha256

+

执行脚本 redeploy.sh

脚本类似于这样

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash -e

function cleanup {
echo "Error occoured"
}
trap cleanup ERR

commit_message=$1 # head_commit.message
pusher_name=$2 # pusher.name
commit_id=$3 # head_commit.id


cd ~/do-react-example-app/
git pull origin master
yarn && yarn build
+ +

就是简单的拉代码,然后构建下,真实使用时可能不是这样,因为页面会部署在 nginx 的作用目录,还需要 rsync 过去,这部分可能还涉及到两个问题第一个是使用 rsync 还是其他的 cp,不过这个无所谓;第二个是目录权限的问题,以我的系统ubuntu 为例,默认用户是 ubuntu,nginx 部署的目录是 www,所以需要切换用户等操作,一开始是想用在shell 文件中直接写了密码,但是不知道咋传,查了下是类似于这样 echo "passwd" | sudo -S cmd,通过管道命令往后传,然后就是这个-S, 参数的解释是-S, --stdin read password from standard input,但是这样么也不是太安全的赶脚,又看了下还有两种方法,

+
    +
  • 就是给root 设置一个不需要密码的命令类似于这样,

    +
    1
    2
    myusername ALL = (ALL) ALL
    myusername ALL = (root) NOPASSWD: /path/to/my/program
    +
  • +
  • 另一种就是把默认用户跟 root 设置成同一个 group 的

    +
  • +
+

使用

真正实操的时候其实还有不少问题,首先运行 webhook 就碰到了我前面说的,使用 snap 运行的时候会找不到前面的 hooks.json配置文件,执行snap run webhook -hooks /opt/hooks/hooks.json -verbose就碰到下面的couldn't load hooks from file! open /opt/hooks/hooks.json: no such file or directory,后来直接下了个官方最新的 release,就直接执行 webhook -hooks /opt/hooks/hooks.json -verbose 就可以了,然后是前面的示例配置文件里的几个参数,比如head_commit.message 其实 gogs 推过来的根本没这玩意,而且都是数组,不知道咋取,烂文档,不过总比搭个 drone 好一点就忍了。

+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1305,119 +1417,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

这是个 Java 面试的高频问题,我也遇到过,以往都是觉得这类题没意思,网上一搜一大堆,也不愿意记,其实说回来,主要还是没静下心来好好去理解,今天无意中看到一个课程,基本帮我把一些疑惑的点讲清楚了,首先单例是啥意思,这个其实是有范围一说,比如我起了个Spring Boot应用,在这个应用范围内,我的常规 bean 是单例的,意味着 getBean 的时候其实永远只会拿到那一个对象,那要怎么来写一个单例呢,首先就是传说中的饿汉模式,也是最简单的

-

饿汉模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class Singleton1 {
// 首先,将构造方法变成私有的
private Singleton1() {};
// 创建私有静态实例,这样第一次使用的时候就会进行创建
private static Singleton instance = new Singleton1();

// 使用这个对象都是通过这个 getInstance 来获取
public static Singleton1 getInstance() {
return instance;
}
// 瞎写一个静态方法。这里想说的是,如果我们只是要调用 Singleton.getDate(...),
// 本来是不想要生成 Singleton 实例的,不过没办法,已经生成了
public static Date getDate(String mode) {return new Date();}
}
-

上面借鉴了一些代码,其实这是最基本,也不会错的方法,但是正如其中getDate方法里说的问题,有时候并没有想那这个对象,但是因为我调用了这个类的静态方法,导致对象已经生成了,可能这也是饿汉模式名字的来由,不管三七二十一给你生成个单例就完事了,不管有没有用,但是这种个人觉得也没啥大问题,如果是面试的话最好说出来它的缺点

-

饱汉模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class Singleton2 {
// 首先,也是先堵死 new Singleton() 这条路,将构造方法变成私有
private Singleton2() {}
// 和饿汉模式相比,这边不需要先实例化出来,注意这里的 volatile,它是必须的
private static volatile Singleton2 instance = null;

private int m = 9;

public static Singleton getInstance() {
if (instance == null) {
// 加锁
synchronized (Singleton2.class) {
// 这一次判断也是必须的,不然会有并发问题
if (instance == null) {
instance = new Singleton2();
}
}
}
return instance;
}
}
-

这里容易错的有三点,理解了其实就比较好记了

-

第一点,为啥不在 getInstance 上整个代码块加 synchronized,这个其实比较容易理解,就是锁的力度太大,性能太差了,这点其实也要去理解,可以举个夸张的例子,比如我一个电商的服务,如果为了避免一个人的订单出现问题,是不是可以从请求入口就把他锁住,到请求结束释放,那么里面做的事情都有保障,然而这显然不可能,因为我们想要这种竞态条件抢占资源的时间尽量减少,防止其他线程等待。
第二点,为啥synchronized之已经检查了 instance == null,还要在里面再检查一次,这个有个术语,叫 double check lock,但是为啥要这么做呢,其实很简单,想象当有两个线程,都过了第一步为空判断,这个时候只有一个线程能拿到这个锁,另一个线程就等待了,如果不再判断一次,那么第一个线程新建完对象释放锁之后,第二个线程又能拿到锁,再去创建一个对象。
第三点,为啥要volatile关键字,原先对它的理解是它修饰的变量在 JMM 中能及时将变量值写到主存中,但是它还有个很重要的作用,就是防止指令重排序,instance = new Singleton();这行代码其实在底层是分成三条指令执行的,第一条是在堆上申请了一块内存放这个对象,但是对象的字段啥的都还是默认值,第二条是设置对象的值,比如上面的 m 是 9,然后第三条是将这个对象和虚拟机栈上的指针建立引用关联,那么如果我不用volatile关键字,这三条指令就有可能出现重排,比如变成了 1-3-2 这种顺序,当执行完第二步时,有个线程来访问这个对象了,先判断是不是空,发现不是空的,就拿去直接用了,是不是就出现问题了,所以这个volatile也是不可缺少的

-

嵌套类

1
2
3
4
5
6
7
8
9
10
11
public class Singleton3 {

private Singleton3() {}
// 主要是使用了 嵌套类可以访问外部类的静态属性和静态方法 的特性
private static class Holder {
private static Singleton3 instance = new Singleton3();
}
public static Singleton3 getInstance() {
return Holder.instance;
}
}
-

这个我个人感觉是饿汉模式的升级版,可以在调用getInstance的时候去实例化对象,也是比较推荐的

-

枚举单例

1
2
3
4
5
6
7
public enum Singleton {
INSTANCE;

public void doSomething(){
//todo doSomething
}
}
-

枚举很特殊,它在类加载的时候会初始化里面的所有的实例,而且 JVM 保证了它们不会再被实例化,所以它天生就是单例的。

- - -
- - - - - - -
-
-
-
- - - -
@@ -1490,20 +1489,20 @@ @@ -1528,7 +1527,7 @@ diff --git a/lib/pace/README.html b/lib/pace/README.html index 7f211a7c06..8f2708e992 100644 --- a/lib/pace/README.html +++ b/lib/pace/README.html @@ -371,20 +371,20 @@ @@ -409,7 +409,7 @@ diff --git a/page/2/index.html b/page/2/index.html index 3d5b9a5205..cb6e7d39e2 100644 --- a/page/2/index.html +++ b/page/2/index.html @@ -223,6 +223,119 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

这是个 Java 面试的高频问题,我也遇到过,以往都是觉得这类题没意思,网上一搜一大堆,也不愿意记,其实说回来,主要还是没静下心来好好去理解,今天无意中看到一个课程,基本帮我把一些疑惑的点讲清楚了,首先单例是啥意思,这个其实是有范围一说,比如我起了个Spring Boot应用,在这个应用范围内,我的常规 bean 是单例的,意味着 getBean 的时候其实永远只会拿到那一个对象,那要怎么来写一个单例呢,首先就是传说中的饿汉模式,也是最简单的

+

饿汉模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class Singleton1 {
// 首先,将构造方法变成私有的
private Singleton1() {};
// 创建私有静态实例,这样第一次使用的时候就会进行创建
private static Singleton instance = new Singleton1();

// 使用这个对象都是通过这个 getInstance 来获取
public static Singleton1 getInstance() {
return instance;
}
// 瞎写一个静态方法。这里想说的是,如果我们只是要调用 Singleton.getDate(...),
// 本来是不想要生成 Singleton 实例的,不过没办法,已经生成了
public static Date getDate(String mode) {return new Date();}
}
+

上面借鉴了一些代码,其实这是最基本,也不会错的方法,但是正如其中getDate方法里说的问题,有时候并没有想那这个对象,但是因为我调用了这个类的静态方法,导致对象已经生成了,可能这也是饿汉模式名字的来由,不管三七二十一给你生成个单例就完事了,不管有没有用,但是这种个人觉得也没啥大问题,如果是面试的话最好说出来它的缺点

+

饱汉模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class Singleton2 {
// 首先,也是先堵死 new Singleton() 这条路,将构造方法变成私有
private Singleton2() {}
// 和饿汉模式相比,这边不需要先实例化出来,注意这里的 volatile,它是必须的
private static volatile Singleton2 instance = null;

private int m = 9;

public static Singleton getInstance() {
if (instance == null) {
// 加锁
synchronized (Singleton2.class) {
// 这一次判断也是必须的,不然会有并发问题
if (instance == null) {
instance = new Singleton2();
}
}
}
return instance;
}
}
+

这里容易错的有三点,理解了其实就比较好记了

+

第一点,为啥不在 getInstance 上整个代码块加 synchronized,这个其实比较容易理解,就是锁的力度太大,性能太差了,这点其实也要去理解,可以举个夸张的例子,比如我一个电商的服务,如果为了避免一个人的订单出现问题,是不是可以从请求入口就把他锁住,到请求结束释放,那么里面做的事情都有保障,然而这显然不可能,因为我们想要这种竞态条件抢占资源的时间尽量减少,防止其他线程等待。
第二点,为啥synchronized之已经检查了 instance == null,还要在里面再检查一次,这个有个术语,叫 double check lock,但是为啥要这么做呢,其实很简单,想象当有两个线程,都过了第一步为空判断,这个时候只有一个线程能拿到这个锁,另一个线程就等待了,如果不再判断一次,那么第一个线程新建完对象释放锁之后,第二个线程又能拿到锁,再去创建一个对象。
第三点,为啥要volatile关键字,原先对它的理解是它修饰的变量在 JMM 中能及时将变量值写到主存中,但是它还有个很重要的作用,就是防止指令重排序,instance = new Singleton();这行代码其实在底层是分成三条指令执行的,第一条是在堆上申请了一块内存放这个对象,但是对象的字段啥的都还是默认值,第二条是设置对象的值,比如上面的 m 是 9,然后第三条是将这个对象和虚拟机栈上的指针建立引用关联,那么如果我不用volatile关键字,这三条指令就有可能出现重排,比如变成了 1-3-2 这种顺序,当执行完第二步时,有个线程来访问这个对象了,先判断是不是空,发现不是空的,就拿去直接用了,是不是就出现问题了,所以这个volatile也是不可缺少的

+

嵌套类

1
2
3
4
5
6
7
8
9
10
11
public class Singleton3 {

private Singleton3() {}
// 主要是使用了 嵌套类可以访问外部类的静态属性和静态方法 的特性
private static class Holder {
private static Singleton3 instance = new Singleton3();
}
public static Singleton3 getInstance() {
return Holder.instance;
}
}
+

这个我个人感觉是饿汉模式的升级版,可以在调用getInstance的时候去实例化对象,也是比较推荐的

+

枚举单例

1
2
3
4
5
6
7
public enum Singleton {
INSTANCE;

public void doSomething(){
//todo doSomething
}
}
+

枚举很特殊,它在类加载的时候会初始化里面的所有的实例,而且 JVM 保证了它们不会再被实例化,所以它天生就是单例的。

+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1197,100 +1310,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

problem

Given a sorted integer array without duplicates, return the summary of its ranges.

-

For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].

-

题解

每一个区间的起点nums[i]加上j是否等于nums[i+j]
参考

-

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
int i = 0, j = 1, n;
vector<string> res;
n = nums.size();
while(i < n){
j = 1;
while(j < n && nums[i+j] - nums[i] == j) j++;
res.push_back(j <= 1 ? to_string(nums[i]) : to_string(nums[i]) + "->" + to_string(nums[i + j - 1]));
i += j;
}
return res;
}
};
- -
- - - - - - -
-
-
-
- - - -
@@ -1363,20 +1382,20 @@ @@ -1401,7 +1420,7 @@ diff --git a/page/3/index.html b/page/3/index.html index 4b7ef15048..50fce4bf5c 100644 --- a/page/3/index.html +++ b/page/3/index.html @@ -223,6 +223,100 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

problem

Given a sorted integer array without duplicates, return the summary of its ranges.

+

For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].

+

题解

每一个区间的起点nums[i]加上j是否等于nums[i+j]
参考

+

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
int i = 0, j = 1, n;
vector<string> res;
n = nums.size();
while(i < n){
j = 1;
while(j < n && nums[i+j] - nums[i] == j) j++;
res.push_back(j <= 1 ? to_string(nums[i]) : to_string(nums[i]) + "->" + to_string(nums[i + j - 1]));
i += j;
}
return res;
}
};
+ +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1118,105 +1212,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

Reverse Bits

Reverse bits of a given 32 bits unsigned integer.

For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).

- -
- - Read more » - -
- - - -
- - - - - - -
-
-
-
- - - -
@@ -1289,20 +1284,20 @@ @@ -1327,7 +1322,7 @@ diff --git a/page/4/index.html b/page/4/index.html index bafe003fe2..d00cc2fc7a 100644 --- a/page/4/index.html +++ b/page/4/index.html @@ -223,6 +223,105 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

Reverse Bits

Reverse bits of a given 32 bits unsigned integer.

For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).

+ +
+ + Read more » + +
+ + + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -978,20 +1077,20 @@ @@ -1016,7 +1115,7 @@ diff --git a/sitemap.xml b/sitemap.xml index 6b32531b4c..02136a3909 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1,6 +1,13 @@ + + https://nicksxs.me/2020/02/22/gogs%E4%BD%BF%E7%94%A8webhook%E9%83%A8%E7%BD%B2react%E5%8D%95%E9%A1%B5%E5%BA%94%E7%94%A8/ + + 2020-02-23T07:36:56.117Z + + + https://nicksxs.me/2020/02/16/Maven%E5%AE%9E%E7%94%A8%E5%B0%8F%E6%8A%80%E5%B7%A7/ @@ -93,14 +100,14 @@ - https://nicksxs.me/2016/09/29/binary-watch/ + https://nicksxs.me/2016/11/10/php-abstract-class-and-interface/ 2020-01-12T13:08:27.014Z - https://nicksxs.me/2016/11/10/php-abstract-class-and-interface/ + https://nicksxs.me/2016/09/29/binary-watch/ 2020-01-12T13:08:27.014Z @@ -128,14 +135,14 @@ - https://nicksxs.me/2016/08/14/docker-mysql-cluster/ + https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ 2020-01-12T13:08:27.011Z - https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ + https://nicksxs.me/2016/08/14/docker-mysql-cluster/ 2020-01-12T13:08:27.011Z @@ -254,14 +261,14 @@ - https://nicksxs.me/2015/04/15/Leetcode-No-3/ + https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ 2020-01-12T13:08:26.991Z - https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ + https://nicksxs.me/2015/04/15/Leetcode-No-3/ 2020-01-12T13:08:26.991Z diff --git a/tags/2019/index.html b/tags/2019/index.html index bd4bd491ac..f54109cda8 100644 --- a/tags/2019/index.html +++ b/tags/2019/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Design-Patterns/index.html b/tags/Design-Patterns/index.html index fa1edb2e1d..6979e3c061 100644 --- a/tags/Design-Patterns/index.html +++ b/tags/Design-Patterns/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Distributed-Lock/index.html b/tags/Distributed-Lock/index.html index 83be6d48dc..79790d3622 100644 --- a/tags/Distributed-Lock/index.html +++ b/tags/Distributed-Lock/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/G1/index.html b/tags/G1/index.html index 20279eea5c..309ea0132c 100644 --- a/tags/G1/index.html +++ b/tags/G1/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/GC/index.html b/tags/GC/index.html index 6c66486718..7a974cf9da 100644 --- a/tags/GC/index.html +++ b/tags/GC/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Garbage-First-Collector/index.html b/tags/Garbage-First-Collector/index.html index 70e1c1d5f8..d70432ce21 100644 --- a/tags/Garbage-First-Collector/index.html +++ b/tags/Garbage-First-Collector/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Gogs/index.html b/tags/Gogs/index.html new file mode 100644 index 0000000000..4e13fc0d01 --- /dev/null +++ b/tags/Gogs/index.html @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: Gogs | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + +

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

Gogs + Tag +

+
+ + +
+

2020

+
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/JVM/index.html b/tags/JVM/index.html index bb2056b5dd..b98c3469f1 100644 --- a/tags/JVM/index.html +++ b/tags/JVM/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/tags/Maven/index.html b/tags/Maven/index.html index 820a468262..609f74442c 100644 --- a/tags/Maven/index.html +++ b/tags/Maven/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Redis/index.html b/tags/Redis/index.html index ba3b189bdc..5214696a67 100644 --- a/tags/Redis/index.html +++ b/tags/Redis/index.html @@ -431,20 +431,20 @@ @@ -469,7 +469,7 @@ diff --git a/tags/Singleton/index.html b/tags/Singleton/index.html index 961756441c..76ced8c42b 100644 --- a/tags/Singleton/index.html +++ b/tags/Singleton/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Webhook/index.html b/tags/Webhook/index.html new file mode 100644 index 0000000000..ec7f3636f4 --- /dev/null +++ b/tags/Webhook/index.html @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: Webhook | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + +

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

Webhook + Tag +

+
+ + +
+

2020

+
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/aqs/index.html b/tags/aqs/index.html index 20f69c5f37..7769007ba6 100644 --- a/tags/aqs/index.html +++ b/tags/aqs/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/c/index.html b/tags/c/index.html index d3784daec8..d076e8f6d6 100644 --- a/tags/c/index.html +++ b/tags/c/index.html @@ -55,7 +55,7 @@ - + @@ -66,7 +66,7 @@ - + - Tag: C | Nicksxs's Blog + Tag: c++ | Nicksxs's Blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - class="tag-list-link" href="/tags/websocket/" rel="tag">websocket1
  • 1
  • 1
  • 1
  • 1
  • 6
  • 6
  • 1
  • 1
  • 1
  • +
    diff --git a/tags/c/page/2/index.html b/tags/c/page/2/index.html index 986c69e7ff..e9b2989e2b 100644 --- a/tags/c/page/2/index.html +++ b/tags/c/page/2/index.html @@ -394,20 +394,20 @@ @@ -432,7 +432,7 @@ diff --git a/tags/cluster/index.html b/tags/cluster/index.html index 69358c8dcc..45d5463f04 100644 --- a/tags/cluster/index.html +++ b/tags/cluster/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/docker/index.html b/tags/docker/index.html index 0bdfe8d092..5c90d33491 100644 --- a/tags/docker/index.html +++ b/tags/docker/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/hadoop/index.html b/tags/hadoop/index.html index 97bd1992d0..2c10e41cba 100644 --- a/tags/hadoop/index.html +++ b/tags/hadoop/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/im/index.html b/tags/im/index.html index de3b96cc38..dc7cee82a3 100644 --- a/tags/im/index.html +++ b/tags/im/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/index.html b/tags/index.html index 778fa5c815..91cb67ce23 100644 --- a/tags/index.html +++ b/tags/index.html @@ -247,10 +247,10 @@
    @@ -337,20 +337,20 @@ @@ -375,7 +375,7 @@ diff --git a/tags/java/index.html b/tags/java/index.html index ee02949218..aaaf9cd0df 100644 --- a/tags/java/index.html +++ b/tags/java/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/leetcode/index.html b/tags/leetcode/index.html index 6eef4577f9..fc21397194 100644 --- a/tags/leetcode/index.html +++ b/tags/leetcode/index.html @@ -514,20 +514,20 @@ @@ -552,7 +552,7 @@ diff --git a/tags/leetcode/page/2/index.html b/tags/leetcode/page/2/index.html index 85fd248bef..1b16aef44e 100644 --- a/tags/leetcode/page/2/index.html +++ b/tags/leetcode/page/2/index.html @@ -374,20 +374,20 @@ @@ -412,7 +412,7 @@ diff --git a/tags/mfc/index.html b/tags/mfc/index.html index 618359962d..f310567a5f 100644 --- a/tags/mfc/index.html +++ b/tags/mfc/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/tags/mq/index.html b/tags/mq/index.html index 208a2f07c7..fed2187902 100644 --- a/tags/mq/index.html +++ b/tags/mq/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/mysql/index.html b/tags/mysql/index.html index 4b7ea7a83e..5bf8c6c680 100644 --- a/tags/mysql/index.html +++ b/tags/mysql/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/nginx/index.html b/tags/nginx/index.html index 1435ca1062..d47f1f189e 100644 --- a/tags/nginx/index.html +++ b/tags/nginx/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/openresty/index.html b/tags/openresty/index.html index 562e1e3590..830e2c4e06 100644 --- a/tags/openresty/index.html +++ b/tags/openresty/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/php/index.html b/tags/php/index.html index 47e1451c43..0912c8ded8 100644 --- a/tags/php/index.html +++ b/tags/php/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/tags/python/index.html b/tags/python/index.html index e5247320f0..bcf3c6316e 100644 --- a/tags/python/index.html +++ b/tags/python/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/spark/index.html b/tags/spark/index.html index fa51fbbccc..22763827f0 100644 --- a/tags/spark/index.html +++ b/tags/spark/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/swoole/index.html b/tags/swoole/index.html index dc941368b5..98b43e174d 100644 --- a/tags/swoole/index.html +++ b/tags/swoole/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/websocket/index.html b/tags/websocket/index.html index 2cc38df5f3..5f939ff7b2 100644 --- a/tags/websocket/index.html +++ b/tags/websocket/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/分布式锁/index.html b/tags/分布式锁/index.html index 97a217085c..14179a1a21 100644 --- a/tags/分布式锁/index.html +++ b/tags/分布式锁/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/单例/index.html b/tags/单例/index.html index b7628c3b38..2d46a579b3 100644 --- a/tags/单例/index.html +++ b/tags/单例/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/博客,文章/index.html b/tags/博客,文章/index.html index 7caf57b74d..2453cb01cd 100644 --- a/tags/博客,文章/index.html +++ b/tags/博客,文章/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/年终总结/index.html b/tags/年终总结/index.html index e38376f8b0..9d135e3265 100644 --- a/tags/年终总结/index.html +++ b/tags/年终总结/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/数据结构/index.html b/tags/数据结构/index.html index 3f32712b16..3224261b41 100644 --- a/tags/数据结构/index.html +++ b/tags/数据结构/index.html @@ -431,20 +431,20 @@ @@ -469,7 +469,7 @@ diff --git a/tags/源码/index.html b/tags/源码/index.html index 8131070f76..4af31fec35 100644 --- a/tags/源码/index.html +++ b/tags/源码/index.html @@ -431,20 +431,20 @@ @@ -469,7 +469,7 @@ diff --git a/tags/生活/index.html b/tags/生活/index.html index 1c8138bfd2..3c6c470633 100644 --- a/tags/生活/index.html +++ b/tags/生活/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/设计模式/index.html b/tags/设计模式/index.html index 176953dfcb..0a372aa200 100644 --- a/tags/设计模式/index.html +++ b/tags/设计模式/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/读后感/index.html b/tags/读后感/index.html index 874c84af1c..cd503a72e4 100644 --- a/tags/读后感/index.html +++ b/tags/读后感/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@