This commit is contained in:
commit
08db36282d
108 changed files with 3500 additions and 0 deletions
30
.drone.yml
Normal file
30
.drone.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
kind: pipeline
|
||||
name: build
|
||||
|
||||
steps:
|
||||
- name: fix link
|
||||
image: bash
|
||||
commands:
|
||||
- bash fix.sh
|
||||
|
||||
- name: build
|
||||
image: klakegg/hugo:alpine
|
||||
commands:
|
||||
- hugo
|
||||
|
||||
- name: render links
|
||||
image: python:3.10.6
|
||||
commands:
|
||||
- pip install beautifulsoup4 lxml
|
||||
- python soup.py
|
||||
|
||||
- name: deploy
|
||||
image: node
|
||||
environment:
|
||||
CLOUDFLARE_API_TOKEN:
|
||||
from_secret: api_token
|
||||
CLOUDFLARE_ACCOUNT_ID:
|
||||
from_secret: account_id
|
||||
commands:
|
||||
- npm install -g wrangler
|
||||
- npx wrangler pages publish public --project-name garden --commit-dirty=true
|
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.svg filter=lfs diff=lfs merge=lfs -text
|
16
.gitignore
vendored
Executable file
16
.gitignore
vendored
Executable file
|
@ -0,0 +1,16 @@
|
|||
/default.md
|
||||
/org/pdfs/
|
||||
/node_modules/
|
||||
/resources/
|
||||
/org/biblio/auto/
|
||||
/org/org-roam.db
|
||||
/org/org-fc.tsv
|
||||
/public/
|
||||
/org/work/
|
||||
org/private/
|
||||
/org/lit/.auctex-auto/
|
||||
/.ninja_log
|
||||
/build.ninja
|
||||
/org/daily/
|
||||
/static/ltximg
|
||||
**/.DS_Store
|
0
.hugo_build.lock
Normal file
0
.hugo_build.lock
Normal file
41
config.toml
Executable file
41
config.toml
Executable file
|
@ -0,0 +1,41 @@
|
|||
baseURL = "https://garden.southfox.gay/"
|
||||
languageCode = "zh-cn"
|
||||
title = "SouthFox's Garden"
|
||||
theme = "cortex"
|
||||
refLinksErrorLevel = "WARNING"
|
||||
|
||||
[params]
|
||||
email = "jethrokuan95@gmail.com"
|
||||
footer = "Icon by Freepik. Built with ♥ with Org-mode and Hugo."
|
||||
|
||||
[outputs]
|
||||
home = ["HTML", "RSS", "JSON"]
|
||||
|
||||
[markup]
|
||||
[markup.goldmark]
|
||||
[markup.goldmark.extensions]
|
||||
definitionList = true
|
||||
footnote = true
|
||||
linkify = true
|
||||
strikethrough = true
|
||||
table = true
|
||||
taskList = true
|
||||
typographer = true
|
||||
[markup.goldmark.parser]
|
||||
attribute = true
|
||||
autoHeadingID = true
|
||||
[markup.goldmark.renderer]
|
||||
hardWraps = false
|
||||
unsafe = true
|
||||
xHTML = false
|
||||
|
||||
[markup.highlight]
|
||||
codeFences = true
|
||||
guessSyntax = false
|
||||
hl_Lines = ""
|
||||
lineNoStart = 1
|
||||
lineNos = false
|
||||
lineNumbersInTable = true
|
||||
noClasses = true
|
||||
style = "friendly"
|
||||
tabWidth = 4
|
21
content/_index.md
Normal file
21
content/_index.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
+++
|
||||
title = "主页"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:47:03+08:00
|
||||
type = "index"
|
||||
draft = false
|
||||
|
||||
+++
|
||||
|
||||
# Hi! {#hi}
|
||||
|
||||
这里就是我的数字花园了,现在还在装修中,请随便逛逛吧。
|
||||
|
||||
[全部文章点我](/posts/)。
|
||||
|
||||
祝逛得开心!
|
||||
|
||||
### 最近文章
|
||||
|
||||
{{% first 10 %}}
|
||||
|
44
content/posts/(Mei)N.GeLiGaoLi.ManKun(n.GregoryMankiw)9.md
Normal file
44
content/posts/(Mei)N.GeLiGaoLi.ManKun(n.GregoryMankiw)9.md
Normal file
|
@ -0,0 +1,44 @@
|
|||
+++
|
||||
title = "经济学原理(第8版):微观经济学分册"
|
||||
author = ["SouthFox"]
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 第一章 经济学十大原理 P17 {#第一章-经济学十大原理-p17}
|
||||
|
||||
|
||||
### 经济学是什么? P3 {#经济学是什么-p3}
|
||||
|
||||
经济学是一项研究管理稀缺资源的学科。资源是有稀缺性的,社会不可能每个人
|
||||
都可能达到他能预期的最高水平(尤其现在核聚变还没出来呢)。
|
||||
|
||||
|
||||
### 经济学十大原理 P16 {#经济学十大原理-p16}
|
||||
|
||||
- 人们如何作出决策 P4
|
||||
1. 人们面临及决策
|
||||
效率和平等,面包和大炮等
|
||||
2. 成本是为了得到它所放弃的东西
|
||||
如继续深造学历就会失去工作带来的工资。
|
||||
3. 理性人考虑边际量
|
||||
[边际成本]({{< relref "../main/20230222234752-边际成本.md" >}})~增加量,为什么水会比钻石便宜?
|
||||
为什么一个航班会有余量?(因为收取改签退票的人的[边际效益]({{< relref "../main/20230222234918-边际效益.md" >}})更高)
|
||||
4. 人们会对激励产生反应
|
||||
当苹果涨价时就会少买。
|
||||
安全带实装立法时反而导致车祸次数增加了?因为反而鼓励了司机加快了行车速度。
|
||||
- 人们如何互相影响 P9
|
||||
1. 贸易可以使每个人的状况变得更好
|
||||
天下熙熙皆为利来,但互通有无。
|
||||
2. 市场通常是组织经济活动的一种好办法
|
||||
所谓看不见的手
|
||||
3. 政府又是可以改善市场结果
|
||||
看不见的手并不注重公平,不能给每个人带来充足饮食、体面衣服、完善医疗
|
||||
- 整体经济如何运行 P14
|
||||
1. 一国的生活水平取决于它生产物品雨服务的能力
|
||||
几乎所有生活水平的差别都能归结于各国[生产率的]({{< relref "../main/20230223000102-生产率.md" >}})的差别。
|
||||
即每一单位劳动拖入生产的物品与服务数量的差别。
|
||||
2. 当发行过多货币时,物价上升
|
||||
货币量增长导致了[通货膨胀]({{< relref "../main/20230223000257-通货膨胀.md" >}}),但是为什么?
|
||||
3. 社会面临通货膨胀与失业之间的短期权衡去是二
|
||||
短期内的这种权衡也就是一个[经济周期]({{< relref "../main/20230223000518-经济周期.md" >}})
|
10
content/posts/2022-08-30.md
Normal file
10
content/posts/2022-08-30.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
title = 2022-08-30
|
||||
author = ["SouthFox"]
|
||||
date = 2022-08-30T20:10:00+08:00
|
||||
lastmod = 2022-08-30T22:03:09+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
霍霍霍,倒是能够丝滑的弄一下日志功能,最近几天其实就在弄在线发布功能……其实已经燃尽了……不过发现 [Neil's Digital Garden](https://commonplace.doubleloop.net/) 可能所需的折腾并不多?毕竟也是在本主题上开发的,过几天看一下能不能把预览功能搬过来……
|
19
content/posts/2022-09-01.md
Normal file
19
content/posts/2022-09-01.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
+++
|
||||
title = 2022-09-01
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-01T23:39:00+08:00
|
||||
lastmod = 2022-09-01T23:42:14+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
| File | Headline | Time | |
|
||||
|-----------|--------------------|----------|------|
|
||||
| | ALL **Total time** | **0:25** | |
|
||||
| inbox.org | **File time** | **0:25** | |
|
||||
| | 计算机 | 0:25 | |
|
||||
| |   数据结构 | | 0:25 |
|
||||
|
||||
九月一号了,似乎时间所剩不多了,该尽量早睡……笔记要是日夜颠倒的话早上睡觉晚上也很萎靡……
|
||||
|
||||
而且现在看久了电脑屏幕眼睛也很不适……这算啥,提前步入老年生活吗?该在番茄钟的休息时间真正做到好好休息了……
|
23
content/posts/2022-09-03.md
Normal file
23
content/posts/2022-09-03.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
+++
|
||||
title = 2022-09-03
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-03T23:43:00+08:00
|
||||
lastmod = 2022-09-03T23:48:41+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
<div class="table-caption">
|
||||
<span class="table-number">Table 1:</span>
|
||||
Clock summary at <span class="timestamp-wrapper"><span class="timestamp">[2022-09-03 六 23:48]</span></span>, for 星期六, 九月 03, 2022.
|
||||
</div>
|
||||
|
||||
| File | Headline | Time | |
|
||||
|-------------|--------------------|----------|------|
|
||||
| | ALL **Total time** | **0:25** | |
|
||||
| inbox.org | **File time** | **0:25** | |
|
||||
| | 计算机 | 0:25 | |
|
||||
| |   C 语言 | | 0:25 |
|
||||
| tickler.org | **File time** | **0:00** | |
|
||||
|
||||
插入 org report 还是有点太费快捷键了……似乎还有更好的法子?
|
54
content/posts/2023-02-11.md
Normal file
54
content/posts/2023-02-11.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
+++
|
||||
title = 2023-02-11
|
||||
author = ["SouthFox"]
|
||||
date = 2023-02-11T22:41:00+08:00
|
||||
lastmod = 2023-02-11T23:21:54+08:00
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 读书 {#读书}
|
||||
|
||||
今天主要还是在读《[崩溃:社会如何选择成败兴亡]({{< relref "../references/崩溃:社会如何选择成败兴亡.md" >}})》
|
||||
|
||||
|
||||
### 五点框架 {#五点框架}
|
||||
|
||||
社会崩溃的主要原因有:
|
||||
|
||||
- 人对生态环境的破坏
|
||||
- 气候变化
|
||||
- 强邻威胁
|
||||
- 友邻支持减少
|
||||
- 社会应变能力
|
||||
|
||||
社会崩溃最大原因真是因为自然环境吗?
|
||||
|
||||
|
||||
### 测定法 {#测定法}
|
||||
|
||||
- 花粉
|
||||
- 树木年代学(误差小,通过比较要研究地带的树木年轮从而参照出木头样本的年龄,但这是不是有点费木头啊,比如先锯掉当地一个千年木头之类的?比如某地的年轮在十八世纪五十年代出现了二窄三宽)
|
||||
- 同位素测定法(误差较大)
|
||||
- 冰芯(寒冷地区限定)
|
||||
- 如果靠近海边还能通过测定盐分来推断风暴多雨少
|
||||
- 林鼠贝冢(地区限定,因为林鼠会不断在洞穴排尿然后结晶,然后把洞穴内的东西像是时间胶囊一样封存了起来)
|
||||
|
||||
|
||||
### 蒙大拿 {#蒙大拿}
|
||||
|
||||
所以蒙大拿现在的数据怎样了?书中附录的链接感觉也是 2003 年时附上的,感觉现在大半不存在了。蒙大拿这种支柱产业凋零然后年轻人出走的……氛围莫名其妙像是东三省啊,感觉主人公来到什么落后边陲小镇的设定还挺常见的。
|
||||
|
||||
|
||||
### 复活岛 {#复活岛}
|
||||
|
||||
[Updates - 书狸狐哨](https://library.southfox.me/user/SouthFox/comment/2460)
|
||||
波利尼西亚人,我之前知道他们的开拓进取,凭着一颗钉子都没有的独木舟在大洋上航行。现在也知道在一个环境破碎崩溃小岛上的苟延残喘……
|
||||
很难不去想象最后剩下来的那一代人,望着岛上光秃秃的不毛之地,会不会想起之前这里曾是一片繁盛的棕榈森林?如果还能剩下最后的树木,是否可以造起一艘最后的独木舟驶向大海,就跟百千年前他们的先民一样?
|
||||
|
||||
让我想起纪录片《宇宙时空之旅:未知世界》的这一集,「稍纵即逝的适居带」。
|
||||
波利尼西亚人开支散叶时后语言改变了很多,但是「航行」一词的发音却一直没变过,但是想到在什么场景下说出这个词,就更加令人唏嘘了。
|
||||
|
||||
|
||||
### 玛雅 {#玛雅}
|
||||
|
||||
崩溃又重组,不过玛雅运气确实挺烂的,没有像样的驮兽,没有像样的主食,完完全全看天吃饭。主城土地的肥力完全丧失了以后,完全要靠附近的卫星部落供给,这也挺像现代都市的。现代都市的脆弱似乎也跟玛雅都成一样……就算不是天灾,人祸也能轻松摧垮这个模式。
|
83
content/posts/2023-02-14.md
Normal file
83
content/posts/2023-02-14.md
Normal file
|
@ -0,0 +1,83 @@
|
|||
+++
|
||||
title = 2023-02-14
|
||||
author = ["SouthFox"]
|
||||
date = 2023-02-14T20:00:00+08:00
|
||||
lastmod = 2023-02-14T23:44:42+08:00
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 俄亥俄州事件 {#俄亥俄州事件}
|
||||
|
||||
首先,搜索引擎的高级选项真得很好用,然后:
|
||||
|
||||
|
||||
### 有没有禁止报道? {#有没有禁止报道}
|
||||
|
||||
或是封锁侧翻火车上有危险化学物品的消息,
|
||||
|
||||
在推特搜索
|
||||
|
||||
> ohio train until:2023-02-05 since:2023-02-03
|
||||
|
||||
即可发现早在 4 号就有一些媒体网站开始撰写报道,例如 [CNN 推特发言](https://twitter.com/CNN/status/1621807317673975808) 以及 [CNN 官网](https://www.cnn.com/2023/02/04/us/east-palestine-ohio-train-derailment-fire/index.html)
|
||||
|
||||
其中在文章开头就写明了包含了氯已烯:
|
||||
|
||||
> A Norfolk Southern train with more than 100 cars derailed in East Palestine, about 15 miles south of Youngstown, according to the National Transportation Safety Board.
|
||||
>
|
||||
> There were 20 cars with hazardous material in the train – 10 of which derailed. Of those 10, five were carrying vinyl chloride, the NTSB said Saturday night.
|
||||
|
||||
如果把时间拉得更开,那么带黄标(黄标应该是机构认证帐号吧)的就有很多:
|
||||
|
||||
- NewsNationComms 9 号
|
||||
- The Washington Post 9 号
|
||||
- FoxNews 7 号
|
||||
- ABC News 6 号
|
||||
- NowThis 9 号
|
||||
- NPR 7 号
|
||||
|
||||
等等等等,所以说评论区盛行的捂住了十多天才报道的说法是错的。
|
||||
|
||||
|
||||
### 有没有打压? {#有没有打压}
|
||||
|
||||
这个问题因为我也没有分析工具(而且现在推特 API 还有钱了),不过随便找找就能找到一个[推特趋势存档](https://archive.twitter-trending.com/)网站,将地区定在美国同时翻找,发现:
|
||||
|
||||
[在3号](https://archive.twitter-trending.com/united-states/03-02-2023) 22:40 时「中国」登上趋势,同时持续了几天,然后就是 Pewdiepie ,土耳其,AJ Green ,世界批萨日……直到 13 号俄亥俄州事件才上榜。
|
||||
|
||||
意志力是有限资源,所以事件总是语事件争夺眼球。所以是间谍气球、Pewdiepie 、土耳其、世界批萨日没有泄露事件重要吗?难道真有压热度的操作?还是群众对于泄露事件兴趣不大?总觉得这是什么传播学已经讨论过的话题,我觉得今天就此打住吧,浪已经冲够了。
|
||||
|
||||
|
||||
## 崩溃 {#崩溃}
|
||||
|
||||
继续阅读 [崩溃:社会如何选择成败兴亡]({{< relref "../references/崩溃:社会如何选择成败兴亡.md" >}})
|
||||
|
||||
|
||||
### 土壤肥力 P461 {#土壤肥力-p461}
|
||||
|
||||
土壤是个谎言!因为土壤的肥力受到多个因素影响,就算是看起来肥沃的土地,也因为其较弱的恢复速度经不起折腾(P465 ,以及所谓的肥沃新月?)。
|
||||
|
||||
而土壤肥力主要来源为:
|
||||
|
||||
- 火山爆发带来的火山灰
|
||||
- 冰川的进退带来的消磨作用
|
||||
- 地壳运动上升带来的新的土壤
|
||||
|
||||
|
||||
### 反复无常 P467 {#反复无常-p467}
|
||||
|
||||
因为恩索现象(即[厄尔尼诺]({{< relref "../main/厄尔尼诺.md" >}})与南方涛动)造就了气候的反复无常,十年来或许气候良好,但是下一个十年就有半数歉收。
|
||||
|
||||
记性真能和这种长期气候变化对抗吗?
|
||||
|
||||
|
||||
### 澳洲认同 P473 {#澳洲认同-p473}
|
||||
|
||||
澳大利亚有浓重的英国文化认同,为此放行兔子和狐狸在岛上而酿成大灾……跟格陵兰岛的维京人差不多,文化认同在以往从来如此,是否能理性审视并抛弃其中不符合的呢?
|
||||
|
||||
|
||||
### 景观失忆 P517 {#景观失忆-p517}
|
||||
|
||||
[景观失忆]({{< relref "../main/景观失忆.md" >}})是因为每一年的景观变化很小,导致了对其变化的不敏感。例如住在雪山脚下的人,对于每年消退的雪线没什么反应,但是过了几十年重游的游客却能立马指出变化。
|
||||
|
||||
这或许能解释复活节岛上的人能够砍完最后一棵树,如果速度足够慢的话。但其实所谓的「温水煮青蛙」也有人说是错得,因为当温度到达一定限度时青蛙会自己跳出。如此看来,景观失忆和「温水煮青蛙」的区别是生物在传递时的损耗吗?
|
35
content/posts/2023-02-20.md
Normal file
35
content/posts/2023-02-20.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
+++
|
||||
title = 2023-02-20
|
||||
author = ["SouthFox"]
|
||||
date = 2023-02-20T16:57:00+08:00
|
||||
lastmod = 2023-02-21T01:52:05+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 卡片笔记法 {#卡片笔记法}
|
||||
|
||||
今天重读一下[卡片笔记写作法:如何实现从阅读到写作]({{< relref "../references/[De]ShenKe*ALunSi7.md" >}}),并打算寻找一些其他人的用例分析分析。
|
||||
|
||||
|
||||
### 一些资料 {#一些资料}
|
||||
|
||||
[神奇的笔记法!你也能轻松开始写作【卡片笔记写作法】_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV16T4y197ka/)
|
||||
|
||||
- 十分钟专注力
|
||||
How to Achieve Your Most Ambitious Goals
|
||||
- 《管锥编》
|
||||
钱锺书的卡片笔记?
|
||||
|
||||
[请不要神化双链笔记 - 少数派](https://sspai.com/post/65273)
|
||||
|
||||
双链笔记反链提醒并没有一个区分,仅仅只是一个链接而已。
|
||||
所以有必要自己去设定一个有层次的目录,或是在反链时添加一个优先度(有必要吗)?
|
||||
|
||||
|
||||
## 涌现现象 {#涌现现象}
|
||||
|
||||
[【Kurz】世界上最复杂的语言@青知字幕组_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1YA41127Y8/)
|
||||
|
||||
Kurz 又来说[涌现现象]({{< relref "../main/20230220220559-涌现现象.md" >}}),不过涌现现象确实奇妙。一堆简单的事物自发组成了复杂的事物。
|
||||
而这种复杂性是包罗万象的,所以所谓的群体是无知、盲目的只能说是一个食物的投影罢了,对,说的就是《[乌合之众:大众心理研究]({{< relref "../references/[Fa]GuSiTaFu*LePang8.md" >}})》这本书。
|
13
content/posts/2023-02-22.md
Normal file
13
content/posts/2023-02-22.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
+++
|
||||
title = 2023-02-22
|
||||
author = ["SouthFox"]
|
||||
date = 2023-02-22T18:06:00+08:00
|
||||
lastmod = 2023-02-23T00:06:46+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 微观经济学 {#微观经济学}
|
||||
|
||||
今天读点[经济学原理(第8版):微观经济学分册]({{< relref "../references/(Mei)N.GeLiGaoLi.ManKun(n.GregoryMankiw)9.md" >}}),
|
||||
还在努力思考一些词语的意义……
|
61
content/posts/2023-03-03.md
Normal file
61
content/posts/2023-03-03.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
+++
|
||||
title = 2023-03-03
|
||||
author = ["SouthFox"]
|
||||
date = 2023-03-03T22:02:00+08:00
|
||||
lastmod = 2023-03-03T22:58:11+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 骑行 {#骑行}
|
||||
|
||||
|
||||
### 骑行上班 {#骑行上班}
|
||||
|
||||
[在西安骑车上班一个月的感受](https://anl.gg/ride-to-company)
|
||||
|
||||
能骑二十多公里去上班……勇士啊,我觉得我八公里就够玄乎了。
|
||||
|
||||
> 在城市道路上骑车时安全也是很重要的,因为来往车辆、行人、路面都非常复杂,更加需要全神贯注。
|
||||
>
|
||||
> - 路上不要听音乐,因为带着耳机你更容易忽略后面的来车的喇叭声,如果真觉得骑车无聊,至少留一个耳朵出来
|
||||
> - 不要走神,我有两次差点撞上,都是因为走神,哪怕只是一两秒,所以,要全神贯注,尤其是在繁华路段
|
||||
> - 避开多小孩、老人的路段,比如超市,老头儿老太太一般习惯早上去抢刚白菜之类的;比如学校,一些没有素质的家长会乱停车或者占道
|
||||
> - 避免冲红灯,宁等一分钟,不赶一两秒,刚刚变灯时一些司机着急得一脚油门就起来了,如果这时候你强行冲红灯,很容易出事。
|
||||
>
|
||||
> -和公交车保持距离,尤其是进站和出站的公交车
|
||||
>
|
||||
> - 公交车进站时不要跟在它后面,它肯定要减速停车,也不要走公交车右侧,容易撞上上下车的乘客,要么等,要么从左侧走
|
||||
> - 公交车出站时,不要走它的左侧,因为它出站时必然会向左转向以走上公交车道,这时候和司机抢道很不明智,要么等,要么从右侧走
|
||||
> - 任何时候,不要紧跟在公交车后面,因为它会完全遮住你的视野,你不可能知道前面会不会有突发事故导致它突然急刹车
|
||||
>
|
||||
> <!--listend-->
|
||||
>
|
||||
> - 在交通拥挤时,切记不要让双手离开车把,即便你的速度并不快,想要在前方突发事故时单手刹车都不是件容易的事,惯性会让把你身体甩向前方,很容易出事,我有次就是因为右手去取手机,而前方的摩托车急刹车,左右刹车时把控不住而差点撞上
|
||||
> - 下雨天尽量不要骑车
|
||||
|
||||
总之还是要注意公交车……这个「坦克」,加上里面的司机多少被日日夜夜相同的路线折磨变得有些烦躁……
|
||||
|
||||
|
||||
### 自行车换档 {#自行车换档}
|
||||
|
||||
[变速自行车怎么调档? - 知乎](https://www.zhihu.com/question/322578909)
|
||||
|
||||
我还真不知道[自行车]({{< relref "../main/20230303221807-自行车.md" >}})是怎么调档的,总而言之,左边有三档的是调节牙盘,右边调节飞轮:
|
||||
|
||||
- 1 牙盘搭配 1,2,3 档飞轮使用 (爬坡省力用)
|
||||
- 2 牙盘配合除了最小最大端飞轮使用 (日常默认模式)
|
||||
- 3 牙盘配合 6,7,8 飞轮使用 (冲刺挑战用,也注意在起步钱调成中档方便起步)
|
||||
|
||||
注意不要用最小配最小,最大配最大(飞轮大小和档数是反着的?),同时换档要跟开车一样,慢慢跳档数,对自己膝盖好一点。
|
||||
|
||||
|
||||
## 远程工作 {#远程工作}
|
||||
|
||||
[人在国内年入 12 万美元欧洲远程工作四年经验分享(一) - V2EX](https://www.v2ex.com/t/890820)
|
||||
|
||||
[人在国内年入 12 万美元欧洲远程工作四年经验分享(二) - V2EX](https://www.v2ex.com/t/891169)
|
||||
|
||||
[人在国内年入 12 万美元欧洲远程工作四年经验分享(三) - V2EX](https://v2ex.com/t/892871)
|
||||
|
||||
[远程工作]({{< relref "../main/20230303225352-远程工作.md" >}})真的看起来挺美好的,我觉得这是我以后想要实现的……国内这种兴趣使然的个人项目很难加上多少分啊,同时在一个多文化人所组成的「地方」上班应该也是一个有趣的事情吧,不过要达到这个目的,首先还是要把英语练好……
|
34
content/posts/2023-04-17.md
Normal file
34
content/posts/2023-04-17.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
+++
|
||||
title = 2023-04-17
|
||||
author = ["SouthFox"]
|
||||
date = 2023-04-17T23:28:00+08:00
|
||||
lastmod = 2023-04-17T23:47:20+08:00
|
||||
tags = ["clojure", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## clojure {#clojure}
|
||||
|
||||
|
||||
### 安装 {#安装}
|
||||
|
||||
Doom Emacs 下直接取消注释掉 clojure 行数就行,也可加上 +lsp 选项。
|
||||
Arch Linux 下使用
|
||||
|
||||
```shell
|
||||
sudo pacman -S clojure leiningen
|
||||
```
|
||||
|
||||
命令获得相关支持,运行时会下载一些依赖包,似乎在国内可能会无法访问导致
|
||||
最后无法在 Emacs org-mode 里直接运行?
|
||||
|
||||
|
||||
### 使用 {#使用}
|
||||
|
||||
传统的 lisp 讲究一个前缀运算。
|
||||
|
||||
```clojure
|
||||
(+ 232 1)
|
||||
```
|
||||
|
||||
剩下的明天在来弄吧。
|
53
content/posts/2023-04-30.md
Normal file
53
content/posts/2023-04-30.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
+++
|
||||
title = 2023-04-30
|
||||
author = ["SouthFox"]
|
||||
date = 2023-04-30T23:38:00+08:00
|
||||
lastmod = 2023-04-30T23:56:28+08:00
|
||||
tags = ["book", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
当被无法避免叫出去陪衬的时候,最好的利用方式就是读本书。
|
||||
|
||||
|
||||
## 《剧变》 {#剧变}
|
||||
|
||||
这本书更贴近现实,所以给的框架和建议也会……更偏离现实,因为人人都不一样。
|
||||
一些关于国家的概述感觉还是委婉了点,可能确实是知道一些领导人会读到自己写下的书吧。
|
||||
|
||||
|
||||
### 芬兰 {#芬兰}
|
||||
|
||||
我还真没想到芬兰的历史是这么……「忍辱负重」,但是作为一个毗邻超级大国的小国,又有什么办法呢?
|
||||
|
||||
> 芬兰化不供输出。
|
||||
|
||||
|
||||
### 日本 {#日本}
|
||||
|
||||
很多时候都在步入日本的后尘,但是哪怕已经意识到了,也有相应的「大东亚框架」出现。这个趋势也并没减弱。是不能还是不想?
|
||||
|
||||
|
||||
### 智利 {#智利}
|
||||
|
||||
让人胆寒,但是至少人家走出来了。
|
||||
|
||||
|
||||
### 印度尼西亚 {#印度尼西亚}
|
||||
|
||||
印度尼西亚语非常好学,这个我还是第一次听说,真有这么好学吗?
|
||||
|
||||
|
||||
### 德意志 {#德意志}
|
||||
|
||||
真诚有用吗?又有谁会被打动呢?
|
||||
|
||||
|
||||
### 澳大利亚 {#澳大利亚}
|
||||
|
||||
自我认同的坚持或放手……人究竟是紧握认同还是灵活改变比较好呢?
|
||||
|
||||
|
||||
### 美国 {#美国}
|
||||
|
||||
社交媒体真是始作俑者吗?如果作者猜想是对的,那么社交媒体的影响将会在其他实体上得到映证。
|
33
content/posts/2023-05-01.md
Normal file
33
content/posts/2023-05-01.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
+++
|
||||
title = 2023-05-01
|
||||
author = ["SouthFox"]
|
||||
date = 2023-05-01T08:57:00+08:00
|
||||
lastmod = 2023-05-02T13:13:26+08:00
|
||||
tags = ["dream", "publish", "book"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 梦记 {#梦记}
|
||||
|
||||
|
||||
### 团子 {#团子}
|
||||
|
||||
我正在做面包,然后我倒入了很多木屑进去。似乎有其他人在说,做面包时倒入木屑最好是选松树的,这样子做的面包会有种松树的清香感。
|
||||
|
||||
我之后还在不停的揉着面团,发现面包已经变得沾手且已经变得青色,就像艾草团子一样,同时面团也却也越发坚硬起来,让人怀疑起下锅蒸之后是否能够入口。
|
||||
|
||||
|
||||
### 考试 {#考试}
|
||||
|
||||
梦见在一个房间考试,但是却是要爬上梯子到一个高处考试(类似胶囊旅馆?)。感觉这个场景在之前的梦中来过。
|
||||
|
||||
|
||||
## 《枪炮、病菌和钢铁》 {#枪炮-病菌和钢铁}
|
||||
|
||||
|
||||
### 为什么要选择农业社会?P100 {#为什么要选择农业社会-p100}
|
||||
|
||||
- 获取野生食物的可能性减少了,因为狩猎采集社会的竭泽而渔(?)。
|
||||
- 获得可驯化动植物的可能性增加了。
|
||||
- 粮食生产依赖的技术在日积月累的发展。
|
||||
- 人口密度增加和粮食生产的相互关系。
|
36
content/posts/2023-05-02.md
Normal file
36
content/posts/2023-05-02.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
+++
|
||||
title = 2023-05-02
|
||||
author = ["SouthFox"]
|
||||
date = 2023-05-02T13:12:00+08:00
|
||||
lastmod = 2023-05-03T00:27:33+08:00
|
||||
tags = ["publish", "dream", "book"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 梦记 {#梦记}
|
||||
|
||||
和中学的朋友在一起考试?……或是玩游戏?
|
||||
|
||||
|
||||
## 《枪炮、病菌和钢铁》 {#枪炮-病菌和钢铁}
|
||||
|
||||
|
||||
### 新月沃地 {#新月沃地}
|
||||
|
||||
[新月沃地]({{< relref "../main/20230502233838-新月沃地.md" >}})在文明发展史的重要性在于它的丰沃,可驯化动植物数量、粮仓等,即使现在来看似乎气候不好,也映证了[气候变化]({{< relref "../main/20230502233943-气候变化.md" >}})所带来的影响。
|
||||
|
||||
|
||||
### 需要乃发现之母? P243 {#需要乃发现之母-p243}
|
||||
|
||||
爱迪生在二十多年后才不情不愿的承认留声机的主要用途是录放音乐。发明才是需要之母?
|
||||
|
||||
蒸汽机的「改良」,意味着很多发明都能找到前者。
|
||||
|
||||
|
||||
### 新发明被采用 P251 {#新发明被采用-p251}
|
||||
|
||||
轮子需要在相应的配套设施下才算有用。
|
||||
|
||||
- 经济利益
|
||||
- 社会价值和声望(奢侈品)
|
||||
- 符合既得利益(qwert 排序键盘是为了拖慢打字速度)
|
30
content/posts/2023-05-03.md
Normal file
30
content/posts/2023-05-03.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
+++
|
||||
title = 2023-05-03
|
||||
author = ["SouthFox"]
|
||||
date = 2023-05-03T16:28:00+08:00
|
||||
lastmod = 2023-05-03T22:56:16+08:00
|
||||
tags = ["publish", "dream", "book"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 《枪炮、病菌和钢铁> {#枪炮-病菌和钢铁}
|
||||
|
||||
|
||||
### 澳大利亚部落 P338 {#澳大利亚部落-p338}
|
||||
|
||||
只有几百人的族群是不可能永远存在下去的,4000 人的族群可以存活 10000 年但是要丢失很多东西。
|
||||
|
||||
|
||||
### 哥伦布的殖民 P441 {#哥伦布的殖民-p441}
|
||||
|
||||
正因为欧洲的分裂,哥伦布才在第五次成功的在几百个王公贵族中说服了一个支持他的航海事业。
|
||||
|
||||
|
||||
### 新技术 P445 {#新技术-p445}
|
||||
|
||||
四通八达的地理位置成为了一个不利条件,专制君主的的一个决定将会使创新改革版图而废。
|
||||
|
||||
|
||||
## 梦记 {#梦记}
|
||||
|
||||
没有记下什么,或许应该要醒来第一时间记住的,然后就是……睡前做点暗示吧。
|
11
content/posts/404.md
Normal file
11
content/posts/404.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
+++
|
||||
title = 404
|
||||
author = ["SouthFox"]
|
||||
date = 2023-02-16T22:27:00+08:00
|
||||
lastmod = 2023-02-16T22:29:02+08:00
|
||||
draft = false
|
||||
+++
|
||||
|
||||
Not Found!
|
||||
|
||||
啊哦,似乎这个条目目前还不存在,或是没有发布在这个花园里。
|
15
content/posts/C 语言速成讲座 第一课.md
Normal file
15
content/posts/C 语言速成讲座 第一课.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
+++
|
||||
title = "C 语言速成讲座 第一课"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-03T23:53:00+08:00
|
||||
lastmod = 2022-09-04T00:00:58+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
- 数据类型存储长度和系统位数有关
|
||||
- C 语言里 0 既是假,非零为真(意味着很容易出 BUG)
|
||||
- 常见逻辑操作,可以把容易判断的操作放在左边,这样耗时的判断或许可以被跳过(断路思想)。
|
||||
- && 逻辑且,见假为假
|
||||
- || 逻辑或,见真为真
|
||||
- \n 表示下一行,\\0 通常来表示一个字符串的结束
|
60
content/posts/Miniflux - 一款简约的在线 RSS 阅读器.md
Normal file
60
content/posts/Miniflux - 一款简约的在线 RSS 阅读器.md
Normal file
|
@ -0,0 +1,60 @@
|
|||
+++
|
||||
title = "Miniflux - 一款简约的在线 RSS 阅读器"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-05T11:14:00+08:00
|
||||
lastmod = 2022-09-05T11:46:37+08:00
|
||||
tags = ["article", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 简介 {#简介}
|
||||
|
||||
Miniflux 是一款使用 Go 编写的高效、简约的在线 Rss 阅读器。没有花哨的功能,但是基本的功能样样多有,基本除了对于习惯多栏视图的人来说有点别扭其它一切都好……
|
||||
|
||||
|
||||
## 安装 {#安装}
|
||||
|
||||
使用轻便快捷的 [docker-compose]({{< relref "../main/docker_compose.md" >}}) 来进行安装,首先新建一个文件夹然后在里新建一个 docker-compose.yml 文件,往里写入:
|
||||
|
||||
```yaml
|
||||
version: '3.4'
|
||||
services:
|
||||
miniflux:
|
||||
image: miniflux/miniflux:latest
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
- DATABASE_URL=postgres://miniflux:secret@db/miniflux?sslmode=disable
|
||||
- BASE_URL=https://所用域名
|
||||
- PROXY_IMAGES=all
|
||||
- RUN_MIGRATIONS=1
|
||||
- ADMIN_USERNAME=admin #管理员帐号用户名
|
||||
- ADMIN_PASSWORD=admin123 #管理员帐号密码
|
||||
db:
|
||||
image: postgres:latest
|
||||
environment:
|
||||
- POSTGRES_USER=miniflux
|
||||
- POSTGRES_PASSWORD=secret
|
||||
volumes:
|
||||
- ./postgres:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-U", "miniflux"]
|
||||
interval: 10s
|
||||
start_period: 30s
|
||||
```
|
||||
|
||||
然后使用 docker-compose up 命令进行启动,看控制台是否有报错,我遇到的报错是数据库拒绝连接,推测是数据库没有初始化完成。如有报错就用 Ctrl + c 关闭进程,然后再用 docker-compose up 启动一次。
|
||||
|
||||
启动完成后,配置好 [Nginx 反代]({{< relref "../main/nginx_反代.md" >}})再打开对应域名能看到登陆界面就算成功了,登陆后进入后台,修改登陆密码并且删掉 docker-compose.yml 文件里的 RUN_MIGRATIONS 、ADMIN_USERNAME 、ADMIN_PASSWORD 这三项。
|
||||
|
||||
|
||||
## 配置 {#配置}
|
||||
|
||||
之后就如同正常的 RSS 阅读器添加源并且正常使用就好了,当然 Miniflux 有一些便捷功能是值得提的。
|
||||
|
||||
- 配置文件里配置了 PROXY_IMAGES=all 设置,这样子文章里的图片会默认被服务器所代理,不用担心一些网站的图片加载不出来的问题,当然遇到一些图片多的源可能会出错……
|
||||
- 如果遇到出错可以不启用 PROXY_IMAGES 功能,可以在编辑源中使用替换规则将图片的链接修改成一些能用的网页代理
|
||||
- 编辑源里也有默认抓取全文选项,可以启用这个应付一些只有摘要的订阅源
|
||||
- 配置里也可以指定 INVIDIOUS_INSTANCE 选项(默认是 =yewtu.be),这个配置是指定 Youtube 隐私前端 INVIDIOUS 实例的地址
|
96
content/posts/SICP 第一课.md
Normal file
96
content/posts/SICP 第一课.md
Normal file
|
@ -0,0 +1,96 @@
|
|||
+++
|
||||
title = "SICP 第一课"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-02T22:17:00+08:00
|
||||
lastmod = 2022-09-02T22:42:53+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 程序设计中要思考的问题是? {#程序设计中要思考的问题是}
|
||||
|
||||
- 程序是抽象的,不像电气设计中的考虑串联几千个放大器(因为要考虑误差等),程序设计是理想化的,可以考率不断循环下对于程序和设计有什么影响。
|
||||
|
||||
|
||||
## 程序设计的三大想法? {#程序设计的三大想法}
|
||||
|
||||
- 黑盒抽象
|
||||
将简单的部分组合一个部件然后像积木一样不断堆积,这个部件对于外部是抽象的,可以拿来直接用的。
|
||||
- 约定接口
|
||||
- 元语言抽象
|
||||
|
||||
|
||||
## Lisp 基础 <span class="tag"><span class="NODE">NODE</span></span> {#lisp-基础}
|
||||
|
||||
|
||||
### 括号 {#括号}
|
||||
|
||||
Lisp 用括号来表达一个组合式,括号多的时候可以用缩进来减少对身心的损耗(
|
||||
|
||||
|
||||
### 前缀 {#前缀}
|
||||
|
||||
Lisp 是前缀表达语言,如:
|
||||
|
||||
```scheme
|
||||
(+ 1 2)
|
||||
```
|
||||
|
||||
结果显示为 3 。
|
||||
|
||||
```text
|
||||
3
|
||||
```
|
||||
|
||||
|
||||
### 定义 {#定义}
|
||||
|
||||
用 DEFINE 关键词来定义一个过程(也叫 lambda),通过一些基本过程搭建的过程来完成一个复杂的目的,这就是黑盒。
|
||||
例子:求平方根
|
||||
|
||||
```scheme
|
||||
(define (square-iter guess x)
|
||||
(if (good-enough? guess x)
|
||||
guess
|
||||
(begin ; used this compound procedure in order to be able to
|
||||
(display guess) ; display the intermediate guess values
|
||||
(newline)
|
||||
(square-iter (improve guess x) x)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define (improve guess x)
|
||||
(average guess (/ x guess)))
|
||||
|
||||
(define (average x y)
|
||||
(/ (+ x y) 2))
|
||||
|
||||
(define (square x)
|
||||
(* x x))
|
||||
|
||||
(define (good-enough? guess x)
|
||||
(< (abs (- (square guess) x)) 0.001))
|
||||
|
||||
(define (sqrt x)
|
||||
(square-iter 1.0 x))
|
||||
|
||||
(define (square-iter-delta guess x)
|
||||
(if (in-delta? guess (improve guess x))
|
||||
guess
|
||||
(begin
|
||||
(display guess)
|
||||
(newline)
|
||||
(square-iter-delta (improve guess x) x)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define (in-delta? guess1 guess2)
|
||||
(< (abs (- guess1 guess2)) 0.001))
|
||||
|
||||
(define (sqrt-delta x)
|
||||
(square-iter-delta 1.0 x))
|
||||
|
||||
(sqrt-delta 25)
|
||||
```
|
263
content/posts/[De]ShenKe*ALunSi7.md
Normal file
263
content/posts/[De]ShenKe*ALunSi7.md
Normal file
|
@ -0,0 +1,263 @@
|
|||
+++
|
||||
title = "卡片笔记写作法:如何实现从阅读到写作"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2023-02-21T01:46:36+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 推荐序一 {#推荐序一}
|
||||
|
||||
|
||||
#### 为什么写卡片容易记忆?(P8) {#为什么写卡片容易记忆-p8}
|
||||
|
||||
这是由于[必要难度]({{< relref "../main/必要难度理论.md" >}})的存在,而卡片笔记法人为地增加了[存储强度]({{< relref "../main/存储强度.md" >}})。
|
||||
|
||||
|
||||
#### 卡片笔记中有哪些索引?(P9) <span class="tag"><span class="NODE">NODE</span></span> {#卡片笔记中有哪些索引-p9}
|
||||
|
||||
- 主题索引
|
||||
- 主题概览
|
||||
- 卡片上索引
|
||||
- 笔记-笔记索引
|
||||
|
||||
|
||||
## 导论 {#导论}
|
||||
|
||||
|
||||
#### 为什么市面上纯讲笔记法的书很少?(P31) {#为什么市面上纯讲笔记法的书很少-p31}
|
||||
|
||||
因为笔记即使记得不好,也并没有产生直接的负反馈。
|
||||
|
||||
|
||||
#### 高智商和成功有关系吗?(P33) {#高智商和成功有关系吗-p33}
|
||||
|
||||
至少 120 以内没有太明显的关系,
|
||||
成功的最大因素是如何利用自控力处理好手头的事物。
|
||||
|
||||
|
||||
## 第一章 绪论 {#第一章-绪论}
|
||||
|
||||
|
||||
### 关于写作,你需要知道的 {#关于写作-你需要知道的}
|
||||
|
||||
|
||||
#### 要如何在心流状态下写作?P39 <span class="tag"><span class="NODE">NODE</span></span> {#要如何在心流状态下写作-p39}
|
||||
|
||||
将一个没有定式的任务分解成一个个小又清晰的任务,
|
||||
例如写作可以分解成搜集资料、拟定大纲、修改措辞等,
|
||||
一次仅仅专注于一个事情,安排得当,就能陷入心流状态。
|
||||
|
||||
|
||||
#### 做事有结构和做事有计划是一样的吗?P39 {#做事有结构和做事有计划是一样的吗-p39}
|
||||
|
||||
制定计划是给自己加上条条框框,必须依靠意志力逼迫自己,所以很容易陷入沮丧状态。
|
||||
所以必须要定期调涨自己,最好依靠工作流带着自己移动。
|
||||
|
||||
|
||||
#### 为什么成绩差的学生很少陷入自我怀疑?P41 {#为什么成绩差的学生很少陷入自我怀疑-p41}
|
||||
|
||||
因为[邓宁-克鲁格效应]({{< relref "../main/邓宁_克鲁格效应.md" >}})的存在,会让成绩差的人错误判断自己的能力水平。
|
||||
|
||||
|
||||
#### GTD 为什么没有在学术界流行起来?P46 {#gtd-为什么没有在学术界流行起来-p46}
|
||||
|
||||
因为学术写作是一个非线性的过程,通常需要在不同的任务之间切换,细化或者放宽一个任务是不太可能的,例如「写一页论文」,这个任务所牵扯到的任务非常多。
|
||||
必须让洞见引领方向。
|
||||
|
||||
|
||||
#### 卡片笔记法背后的灵感是什么?P47 <span class="tag"><span class="NODE">NODE</span></span> {#卡片笔记法背后的灵感是什么-p47}
|
||||
|
||||
一个想法或者笔记只有在它的上下文才有意义,而它的上下文不一定是它在文章中的出处。
|
||||
所以卡片笔记法是要让笔记与不同上下文聚集起来并起到相应的作用。
|
||||
|
||||
|
||||
#### 卡片笔记法为什么没有流行开来?P53 {#卡片笔记法为什么没有流行开来-p53}
|
||||
|
||||
- 误解,主流研究都集中于对于卡片笔记法孤立关注,忽视了它要嵌入在具体的工作流中。
|
||||
- 一开始只有德语版本,而且只在社会学家内部讨论,所引起的关注度不高。
|
||||
- 太简单,人们总会错误的认为杰出成果是用一些极其复杂的方法产生的。
|
||||
|
||||
|
||||
#### 成功来源于意志力吗?P52 {#成功来源于意志力吗-p52}
|
||||
|
||||
对成功人士的研究表明,成功不是来源于意志力或是克服阻力的能力。
|
||||
而是他们的工作流巧妙的避免了阻力。
|
||||
|
||||
|
||||
### 关于写作,你需要做的 {#关于写作-你需要做的}
|
||||
|
||||
|
||||
#### 如何使用卡片笔记法撰写论文?P61 <span class="tag"><span class="NODE">NODE</span></span> {#如何使用卡片笔记法撰写论文-p61}
|
||||
|
||||
- 记下[闪念笔记]({{< relref "../main/闪念笔记.md" >}}),记下脑中闪过的一个想法。
|
||||
- 根据闪念笔记,整理成[文献笔记]({{< relref "../main/文献笔记.md" >}}),文献笔记要尽可能简短,并使用自己话语去转写,不能抄写而不去理解它的含义。
|
||||
- 浏览前两步产生的笔记(最好每天划分相应时间),仔细研究跟自己的课题、项目、兴趣有何关联。
|
||||
- 写下[永久笔记]({{< relref "../main/永久笔记.md" >}}),不是为了收集,而是为了衍生想法、论点和讨论。
|
||||
- 归档文献笔记和永久笔记,放入到笔记软件中,附上便于以后翻阅的链接和[索引](#卡片笔记中有哪些索引-p9)。
|
||||
- 在系统自下而上的发展主题,头脑风暴,检查笔记链、想法群。
|
||||
- 积攒一定想法后,就能产生一个写作主题了,将它排列出来,取舍要写出什么。
|
||||
- 写成初稿、完善、校对。
|
||||
|
||||
|
||||
## 第二章 有效写作的四个基本原则 {#第二章-有效写作的四个基本原则}
|
||||
|
||||
|
||||
### 简洁是最重要的 {#简洁是最重要的}
|
||||
|
||||
|
||||
#### 记卡片笔记容易产生的混乱是什么? P87 <span class="tag"><span class="NODE">NODE</span></span> {#记卡片笔记容易产生的混乱是什么-p87}
|
||||
|
||||
- 把所有笔记都当成[永久笔记]({{< relref "../main/永久笔记.md" >}}),这样会导致被没那么好的笔记淹没。
|
||||
- 只记与项目有关的笔记,为何要限制自己?
|
||||
- 把所有笔记当成[闪念笔记]({{< relref "../main/闪念笔记.md" >}}),当然会陷入混乱之中。
|
||||
|
||||
这三种混乱都会导致笔记越多好处越少。
|
||||
|
||||
|
||||
### 让工作推动你前进 {#让工作推动你前进}
|
||||
|
||||
|
||||
#### 为什么要拿着笔阅读? P102 {#为什么要拿着笔阅读-p102}
|
||||
|
||||
阅读中拿着笔写作是检验自己是否理解的最好方法,如果不拿自己的话转写,不理解书中的话就放入卡片盒,那么之后就会遇到阻碍。
|
||||
|
||||
|
||||
## 第三章 成功写作的六个步骤 {#第三章-成功写作的六个步骤}
|
||||
|
||||
|
||||
### 明确区分独立而又相关的任务 {#明确区分独立而又相关的任务}
|
||||
|
||||
|
||||
#### 为什么不要一心多用? P110 {#为什么不要一心多用-p110}
|
||||
|
||||
心理学家做了一次实验,即使同时处理多任务的人觉得自己很有效率,但他们的效率也远远低于一次处理一次的人。
|
||||
|
||||
|
||||
#### 不同的任务需要不同的关注力 P116 {#不同的任务需要不同的关注力-p116}
|
||||
|
||||
- 集中的注意力
|
||||
- 漂浮的注意力……
|
||||
|
||||
|
||||
### 阅读和理解 {#阅读和理解}
|
||||
|
||||
|
||||
#### 如何避免笔记产生误差? P137 <span class="tag"><span class="NODE">NODE</span></span> {#如何避免笔记产生误差-p137}
|
||||
|
||||
要意识到[确认偏差]({{< relref "../main/确认偏差.md" >}}),类似达尔文,看到对自己理论最具批判性的论点就会马上记录下来。
|
||||
|
||||
- 确认是否将任务分解,并是否理解材料中的文本。
|
||||
- 确认为阅读的内容做出了准确的笔记。
|
||||
- 找到笔记之间的[关联](#卡片笔记法背后的灵感是什么-p47),并建立联系。
|
||||
|
||||
笔记应该收集相关不相关的,而不是反对不反对的。
|
||||
|
||||
|
||||
#### 为什么不推荐重复阅读? P145 {#为什么不推荐重复阅读-p145}
|
||||
|
||||
- 因为已经被证实是完全无用的。
|
||||
- 因为[曝光效应]({{< relref "../main/曝光效应.md" >}})的存在。
|
||||
|
||||
|
||||
### 记卡片盒笔记 {#记卡片盒笔记}
|
||||
|
||||
|
||||
#### 为什么记住一切反而不好的? P164 {#为什么记住一切反而不好的-p164}
|
||||
|
||||
所罗门舍列夫斯基能一字不差记住会议上的每一句话,但是他会被大量不重要的事情淹没而忘记真正重要的东西。
|
||||
他能背下一本小说,但不能体会到里面的情感……
|
||||
|
||||
|
||||
#### 如何让知识记得更牢靠? P170 {#如何让知识记得更牢靠-p170}
|
||||
|
||||
掌握某条消息后,用特别的方法阐述出来,就会记得更牢靠。
|
||||
|
||||
比如为何动脉壁比静脉壁更厚,瓣膜存在于静脉?
|
||||
因为动脉要承受高压,而静脉需要瓣膜防止回流。
|
||||
|
||||
|
||||
### 发展想法 {#发展想法}
|
||||
|
||||
|
||||
#### 卡片盒的目的是什么? P175 {#卡片盒的目的是什么-p175}
|
||||
|
||||
卡片盒的目的不是成为百科全书,而是成为思考的工具。
|
||||
所以不要为了填补空白而去记卡片笔记,而是为了有益于自己的思考。
|
||||
|
||||
|
||||
#### 如何处理笔记关键词? P178 {#如何处理笔记关键词-p178}
|
||||
|
||||
不做档案员,做写作者。
|
||||
档案员:我要设置什么关键词才合适?
|
||||
写作者:我要设置什么关键词才方便我日后找到他?
|
||||
|
||||
|
||||
### 分享你的洞见 {#分享你的洞见}
|
||||
|
||||
|
||||
#### 在卡片笔记盒内思考的建议。 P198 {#在卡片笔记盒内思考的建议-p198}
|
||||
|
||||
- 确保你真正看到你所在看到的东西,并能过清晰、简单地描述它。
|
||||
- 认真对待简单的想法。
|
||||
|
||||
|
||||
#### 通过设限增加创造力。 P205 {#通过设限增加创造力-p205}
|
||||
|
||||
- 笔记是卡片制的,不要过多。
|
||||
- 26 个字母。
|
||||
- 诗歌、音乐……
|
||||
- 《枯萎的艺术》
|
||||
|
||||
|
||||
#### 为什么头脑风暴不是一个好想法? P209 {#为什么头脑风暴不是一个好想法-p209}
|
||||
|
||||
因为大脑会考虑到容易想到的想法,而我们又对最先想到的想法念念不忘。
|
||||
|
||||
|
||||
#### 从自上而下到自下而上 P212 {#从自上而下到自下而上-p212}
|
||||
|
||||
通过计划写作的过程是自上而上的,那么通过卡片笔记写做法就是自下而上的。
|
||||
|
||||
<!--list-separator-->
|
||||
|
||||
- 越熟悉,越开放?(P213)
|
||||
|
||||
因为对于旧的想法越来越理解,自然就越知晓其中的局限性。
|
||||
大多数想法并没有那么创新。
|
||||
|
||||
|
||||
### 完稿和修订 {#完稿和修订}
|
||||
|
||||
|
||||
#### 两个关键点 P217 <span class="tag"><span class="NODE">NODE</span></span> {#两个关键点-p217}
|
||||
|
||||
- 确保笔记的结构盒灵活性,[如使用笔记写一篇文章](#如何使用卡片笔记法撰写论文-p61)中,勤用卡片笔记法写笔记就能有很多材料去写文章,要挑出真正合适的。
|
||||
- 尝试写多个项目的手稿,如同流水线一样,一个流水线的副产品往往可以被另一条流水线所用(想想沉浸机械!)。
|
||||
|
||||
|
||||
#### 放弃做计划才能成为专家 {#放弃做计划才能成为专家}
|
||||
|
||||
<!--list-separator-->
|
||||
|
||||
- 为什么要对计划抱有普遍的怀疑?(P220)
|
||||
|
||||
- 仅关注结果,不关注实现目标的过程和步骤是有害的。
|
||||
- 足球运动员,不要想着我已经赢了,而是想着为了赢要做出哪些训练。
|
||||
- 根据[帕金森定律]({{< relref "../main/帕金森定律.md" >}}),预留再多时间最后也不会有空余,
|
||||
- 同时根据[蔡格尼克效应]({{< relref "../main/蔡格尼克效应.md" >}}),尽量选择一些能看到终点的任务。
|
||||
|
||||
|
||||
### 养成习惯 {#养成习惯}
|
||||
|
||||
<!--list-separator-->
|
||||
|
||||
- 为什么不要依靠习惯?(P226)
|
||||
|
||||
因为[曝光效应]({{< relref "../main/曝光效应.md" >}})的存在,越是熟悉它,就觉得对它的掌握就越深,但其实并没有。
|
||||
|
||||
<!--list-separator-->
|
||||
|
||||
- 如何培养新习惯?(P227)
|
||||
|
||||
不要试图和旧习惯完全割裂,也不能打算依靠自己的意志力,而是要有策略,依次取代旧习惯。
|
12
content/posts/c_语言.md
Normal file
12
content/posts/c_语言.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
+++
|
||||
title = "C 语言"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-03T23:50:00+08:00
|
||||
lastmod = 2022-09-04T00:00:55+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
嗯嗯嗯,我很喜欢你的,尤其是你的指针(敷衍)。
|
||||
|
||||
[C 语言速成讲座 第一课]({{< relref "../references/C 语言速成讲座 第一课.md" >}})
|
14
content/posts/docker.md
Normal file
14
content/posts/docker.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
+++
|
||||
title = "docker"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-05T10:09:00+08:00
|
||||
lastmod = 2022-09-05T10:31:54+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
Dock 是码头的意思,那么 Docker 就是码头工人的意思了,其思想是把软件的依赖和环境打包成一个容器(集装箱),这样在其它机子通过 Docker 解包并运行,可以避免对于其机器的环境的依赖。
|
||||
|
||||
有效增加了开发者和运维人员的幸福感……大概。
|
||||
|
||||
[docker 安装]({{< relref "docker_安装.md" >}})
|
12
content/posts/docker_compose.md
Normal file
12
content/posts/docker_compose.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
+++
|
||||
title = "docker-compose"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-05T10:16:00+08:00
|
||||
lastmod = 2022-09-05T11:16:19+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
docker-compose 是 [docker]({{< relref "docker.md" >}}) 的相关工具,把 docker 的长长的参数转换成对应的 yaml 文件,从一维拓展到了二维。还能方便的启动一组互相关联的容器,基本上熟悉掌握 docker-compose 就再也不想回去折腾 docker 相关的参数了……
|
||||
|
||||
[docker-compose 安装]({{< relref "docker_compose_安装.md" >}})
|
12
content/posts/docker_compose_安装.md
Normal file
12
content/posts/docker_compose_安装.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
+++
|
||||
title = "docker-compose 安装"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-05T10:21:00+08:00
|
||||
lastmod = 2022-09-05T10:31:22+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
docker-compose 现在作为使用 Go 编写的软件,直接去 Github 对应仓库 [docker/compose](https://github.com/docker/compose) 下载压缩包解压到相应的路径就行了……
|
||||
|
||||
或者使用系统自带的软件源进行安装也是可以的,毕竟作为一个命令转换工具,可能对于更新的需求不是那么大?
|
25
content/posts/docker_安装.md
Normal file
25
content/posts/docker_安装.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
+++
|
||||
title = "docker 安装"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-05T10:31:00+08:00
|
||||
lastmod = 2022-09-05T10:44:49+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 根据官方源安装 {#根据官方源安装}
|
||||
|
||||
[Install Docker Engine | Docker Documentation](https://docs.docker.com/engine/install/) 根据此链接并选择自己机器系统按照步骤一步一步进行安装。
|
||||
|
||||
|
||||
## 使用系统软件源安装 {#使用系统软件源安装}
|
||||
|
||||
通常来说系统源里的 docker 版本都是落后于官方源一定版本的,在安全性和效率上会有所欠佳,但胜在稳定和便捷一点……
|
||||
|
||||
[Docker Engine release notes | Docker Documentation](https://docs.docker.com/engine/release-notes/) ,通过此链接获取最新版本号,如果本机安装了 docker 的话也可以用
|
||||
|
||||
```shell
|
||||
docker version
|
||||
```
|
||||
|
||||
来获取本机的 docker 版本号。
|
12
content/posts/lisp.md
Normal file
12
content/posts/lisp.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
+++
|
||||
title = "Lisp"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-02T21:25:00+08:00
|
||||
lastmod = 2022-09-02T22:42:57+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
Lisp 是一款古老的语言,其功能正在被现有的高级语言「重新发明」。
|
||||
|
||||
[Lisp 基础]({{< relref "../references/SICP 第一课.md#lisp-基础" >}})
|
35
content/posts/nw_cdn.md
Normal file
35
content/posts/nw_cdn.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
+++
|
||||
title = "CDN"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-13T21:26:00+08:00
|
||||
lastmod = 2022-09-13T22:37:23+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 什么是 CDN {#什么是-cdn}
|
||||
|
||||
CDN ,中文叫作内容分发网络,是一组分布在不同地理位置的服务器,协同工作以提供互联网内容的快速交付。
|
||||
|
||||
用例子来说明的话,就是一些科技公司产品的专卖店:
|
||||
|
||||
科技公司发布了新品,世界各地的人想要购买只能自己前往公司所在地买吗,如果跨国家跨大洋的话那肯定是一个折磨的事,所以科技公司一般都会在各地设立专卖店,这样用户仅需前最近的专卖店购买就行了。
|
||||
|
||||
{{< figure src="/ox-hugo/2022-09-13_22-14-26_Learning-How-does-a-CDN-work.svg" >}}
|
||||
|
||||
CDN 是一个包含多种技术的系统,例如:
|
||||
|
||||
- CDN 所分发的就是原始主机内容的复制,既是[缓存]({{< relref "nw_缓存.md" >}})。
|
||||
- CDN 把用户的访问导向了最近的服务器上,其中当然也用到了[反向代理]({{< relref "nw_反向代理.md" >}})技术。
|
||||
|
||||
|
||||
## CDN 有什么作用? {#cdn-有什么作用}
|
||||
|
||||
- 最基本的作用就是加速了,内容存放在靠用户接近的服务器上,相比直接加载原始服务器上的内容,加载延迟会有所减少。
|
||||
- 提升了可靠性,毕竟相当于复制了一个鸡蛋并分发到了不同的篮子里,所以一个篮子里的鸡蛋炸了,也能切换到另外的篮子里。
|
||||
- 减少成本,因为服务器的一部分请求会被 CDN 的[缓存]({{< relref "nw_缓存.md" >}})所承担,所以原始服务器承担的带宽消耗也减少了。
|
||||
|
||||
|
||||
## 附录 {#附录}
|
||||
|
||||
[什么是 CDN? - CloudFlare](https://www.cloudflare.com/zh-cn/learning/cdn/what-is-a-cdn/)
|
41
content/posts/nw_dns.md
Normal file
41
content/posts/nw_dns.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
+++
|
||||
title = "DNS"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-28T21:43:00+08:00
|
||||
lastmod = 2022-09-28T22:15:50+08:00
|
||||
tags = ["newbie", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
电话号码通常来说是一组难记的十几位数字,所以需要通讯录、联系人的存在,为电话号码附上一个「名字」,例如王小明、李小红等。
|
||||
|
||||
域名系统 (Domain Name System) 就是一个互联网世界的通讯录,将 142.250.72.174 映射为 google.com 这样的[域名]({{< relref "nw_域名.md" >}}),当然有一个不同就是域名是不允许重名的。
|
||||
|
||||
|
||||
## DNS 服务器 {#dns-服务器}
|
||||
|
||||
|
||||
### 默认(运营商) DNS {#默认-运营商-dns}
|
||||
|
||||
在上网时,通常由 DNS 服务器来进行 IP 地址转换为域名的过程,DNS 服务器一般在上网时自动由 ISP (运营商)指定,一般来讲会与用户距离最近,延迟最低。
|
||||
|
||||
|
||||
### 公共 DNS {#公共-dns}
|
||||
|
||||
但是 DNS 作为古早设计的协议,并没有注重到安全、隐私问题,是一个明文的协议,所以一些不检点的 ISP (运营商)会在 DNS 上动手脚,把一些域名的 IP 地址映射到广告商的 IP 地址上,所以会导致一些页面上会莫名其妙出现一些广告。或是将一些域名解析成不存在的 IP 地址上,即所谓的 DNS 污染。
|
||||
|
||||
这种时候可以将设备的 DNS 服务器设置成一些公共 DNS 上
|
||||
|
||||
一些常用公共 DNS :
|
||||
8.8.8.8 (谷歌运营)
|
||||
223.5.5.5 (阿里运营)
|
||||
119.29.29.29 (腾讯运营)
|
||||
|
||||
当然因为这些公共 DNS 服务器的物理实际距离可能比运营商的默认 DNS 所远,所以可能会导致解析时间增加而导致感觉上网速度变慢了。
|
||||
|
||||
|
||||
### 加密 DNS {#加密-dns}
|
||||
|
||||
但是 DNS 是一个明文协议依然没有解决,所以解决方案是进行加密:
|
||||
|
||||
[CloudFlare - 安全 DNS](https://www.cloudflare.com/zh-cn/learning/dns/dns-over-tls/)
|
14
content/posts/nw_html.md
Normal file
14
content/posts/nw_html.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
+++
|
||||
title = "HTML"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-10-10T20:06:00+08:00
|
||||
lastmod = 2022-10-10T20:17:28+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
如果[IP 地址]({{< relref "nw_ip_地址.md" >}})是要寄出包裹上的地址的话,那么网页就相当于包裹里的内容,其中很多很多网页都是由 HTML 撰写的。
|
||||
|
||||
超文本标记语言(HyperText Markup Language)简称 HTML, 是一种简单易懂的……语言,在使用浏览器浏览网站时,鼠标右键-查看源代码就能查看网页的 HTML 了。
|
||||
|
||||
HTML 对于浏览器来说就相当于一张「蓝图」,而浏览器就相当于是建筑工人,当浏览器接收到 HTML 文件时,就会马上开始进行解析,规划好基本的布局(几室几厅)、需要用到什么家具(图片、视频),然后将进行修建(渲染),之后呈递给用户的就是一个网页了。
|
53
content/posts/nw_ip_地址.md
Normal file
53
content/posts/nw_ip_地址.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
+++
|
||||
title = "IP 地址"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-16T17:38:00+08:00
|
||||
lastmod = 2022-09-28T21:46:07+08:00
|
||||
tags = ["newbie", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
如同现实世界一样,寄一封信、一个包裹需要填写收件人的地址,而在[互联网]({{< relref "nw_互联网.md" >}})上传递数据,同样需要一个地址,这个地址通常叫做「IP 地址」。
|
||||
|
||||
|
||||
## 格式 {#格式}
|
||||
|
||||
IP 地址通常是以四组 0~255 的数字组成的一串数字,例如:
|
||||
|
||||
- 1.1.1.1
|
||||
- 8.8.8.8
|
||||
- 110.242.68.66 (百度服务器的 IP 地址)
|
||||
- 142.250.72.174 (谷歌服务器的 IP 地址)
|
||||
|
||||
|
||||
### 内网地址 {#内网地址}
|
||||
|
||||
在 IP 分布中有一些特殊的范围被划定出来被用于标识内网地址,例如,如果 xx 市 xx 区 xx 街 xx 号可以看作为一个外网地址,那么小区内 xx 栋 xx 楼就是一个内网地址。
|
||||
|
||||
外网地址只要知道了就可以访问到,而内网是内部的,是服务于内部的,例如跟随便一个外人说我住 xx 栋 xx 号,别人肯定是搞不清楚的,而同跟住一个小区的人说住 xx 栋 xx 号,那么就会能够找到了。
|
||||
|
||||
|
||||
### 格式 {#格式}
|
||||
|
||||
一般来说常用的内网地址分三种:
|
||||
|
||||
- 10.xxx.xxx.xxx
|
||||
- 172.16.xxx.xxx - 172.31.xxx.xxx
|
||||
- 192.168.xxx.xxx
|
||||
- 127.0.0.1 (一个更加特殊的地址,意思是「本设备」「我」「myself」)
|
||||
|
||||
如果打开手机里的 Wifi 详情或是电脑里的网络详情,那么其标注的地址所很有可能会是上述其中的一个。
|
||||
|
||||
|
||||
## IPv6 {#ipv6}
|
||||
|
||||
可以很明显的感受到用四组 0~255 的数字标识地址范围是不是有点小?会不会不够应付现在手机手表冰箱乃至咖啡机都要联网的世界?没错,确实不够,所以人们作出了很多努力,例如 [NAT]({{< relref "nw_nat.md" >}}) 技术还有就是 IPv6 技术。
|
||||
|
||||
IPv6 不仅使用到了数字,同时还使用了字母来进行标识,同时长度也更长,号称可以「给地球上每一粒沙子都分配一个地址」,但即使在 2022 年的现在,IPv6 的普及度依然不够,所以以建站考虑的话,IPv4 地址还是有必要的。
|
||||
|
||||
|
||||
## DNS {#dns}
|
||||
|
||||
但,等等?平常上网时并没见到 IP 地址啊?上网时通常都是输入 www.baidu.com 这样的[域名]({{< relref "nw_域名.md" >}})啊?
|
||||
|
||||
这就是 [DNS]({{< relref "nw_dns.md" >}}) 的作用了。
|
18
content/posts/nw_nginx.md
Normal file
18
content/posts/nw_nginx.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
+++
|
||||
title = "Nginx"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-11-23T19:36:00+08:00
|
||||
lastmod = 2022-11-23T19:54:56+08:00
|
||||
tags = ["newbie", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
Nginx ,相信在各教程频频出现,那么它是个啥,简单来说就是一个网页服务器程序,可以接收来自互联网的请求然后返回请求下的网页(如果页面存在的话),同时还可以用来[反向代理]({{< relref "nw_反向代理.md" >}})。
|
||||
|
||||
根据[端口]({{< relref "nw_端口.md" >}})来说,443 是大家默认的一个网页访问端口,建立起的一个博客程序当然可以直接设置在 443 端口,但是这样如果还要再设置一个网盘应用怎么办?443 端口已经被前面的博客程序占用了……
|
||||
|
||||
所以为了一个[服务器]({{< relref "nw_服务器.md" >}})上的 443 端口能够搭建起多个站点,可以这么做:将博客、网盘、笔记需要建立的站点设立在其它端口例如 3000、4000、5000,然后将 Nginx 设立在 443 端口,然后根据配置的 server_name 分析请求然后反向代理到具体的应用,这样就能够用一个 443 端口满足不同的需要了。
|
||||
|
||||
嗯,如果用比喻的方式来解释的话,Nginx 就像一个导游一样,一个服务器就相当于一片土地,建站就相当于是在地上建起一家店铺,但是对外开放的大门只有 443 一个,所以就让导游 Nginx 待命到这个 443 大门上。然后处理访问顾问的请求,比如汉堡店、书店等,这样即使有多家店铺也能使用一个对外开放的大门运作了。
|
||||
|
||||
而且 Nginx 不止反向代理,它很能做到更多,比如[缓存]({{< relref "nw_缓存.md" >}})其一些资源加访问,同时还可以对请求进行配置,比如汉堡店正在装修,无法访问,那就可以告诉 Nginx ,返回一个正在升级的页面,抑或是禁止对某一个路径访问等。
|
20
content/posts/nw_互联网.md
Normal file
20
content/posts/nw_互联网.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
+++
|
||||
title = "互联网"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-16T17:31:00+08:00
|
||||
lastmod = 2022-09-16T18:05:04+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 道路比喻 {#道路比喻}
|
||||
|
||||
互联网之互联,最基本的问题是如何要把数据传递给另一方,用例子来举例的话,就是到某人家里玩:
|
||||
|
||||
如果要到某人家里,那么最基本的就是要知道地址([IP 地址]({{< relref "nw_ip_地址.md" >}})),然后就是,到达此地方是否有相应的「道路」,例如:
|
||||
|
||||
要到一个其它国家甚至其它大洋某人家里,首先是要从家门口出来,然后通过「城/乡间小路」到最近的城市「高速路口」,然后出市再出省,然后前往出国的海关,然后走海底道路(因为互联网跨大洋通信的需求太普遍了,所以人们沿着海床架设了「海底光缆」来减少通信所需时间)前往对面大洋的国家的海关进入国域,然后在前往对应的省→市→城/乡→相应具体地址。
|
||||
|
||||
道路首先自然是要去修的,而使用这些道路需要支付费用,就是网费。而提供这些道路的一般称为网络业务提供商(Internet Service Provider,简称ISP),在国内一般是电信、移动、联通这些运营商。
|
||||
|
||||
网络世界绝不可能脱离现实,在网上冲浪,那么就说明与提供服务的[服务器]({{< relref "nw_服务器.md" >}})至少存在一条「道路」,不论是 WIFI 似的无线型或者用网线的有线型……
|
12
content/posts/nw_代理.md
Normal file
12
content/posts/nw_代理.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
+++
|
||||
title = "代理"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-12T23:49:00+08:00
|
||||
lastmod = 2022-09-13T00:46:43+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
代理,从字面意思理解就是代为处理,某总经理说:“这是我的秘书小王,他就是我的代理人。”
|
||||
|
||||
计算机领域中的代理也大抵是这么一回事……
|
24
content/posts/nw_反向代理.md
Normal file
24
content/posts/nw_反向代理.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
+++
|
||||
title = "反向代理"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-13T00:30:00+08:00
|
||||
lastmod = 2022-09-13T00:50:24+08:00
|
||||
tags = ["newbie", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
反向代理就是……反向的[代理]({{< relref "nw_代理.md" >}}),举例子来说明:
|
||||
|
||||
- 代理:
|
||||
|
||||
小明想吃麦当劳,但是父母不允许他吃,所以他摆脱了他同学代买一份。对于小明来说,他的同学就是代理。
|
||||
|
||||
- 反向代理:
|
||||
|
||||
小王想去某公司办理业务,他对公司前台说:“这份文件要处理一下”,对于公司来说,前台就是公司的反向代理。
|
||||
|
||||
有点迷糊?其实无非就是从客户和服务方的角度来说罢了,
|
||||
|
||||
对于麦当劳来说,来店里的是小明同学而不是小明,所以代理,隐藏了实际用户方的身份。
|
||||
|
||||
对于小王来说,和他沟通的一直是公司前台,公司前台把这份文件发给了公司内部的哪个部分什么人处理?不知道,所以反向代理,隐藏了实际服务方的身份。
|
26
content/posts/nw_域名.md
Normal file
26
content/posts/nw_域名.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
+++
|
||||
title = "域名"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-28T21:43:00+08:00
|
||||
lastmod = 2022-11-20T16:07:34+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
如果既然有了[IP 地址]({{< relref "nw_ip_地址.md" >}})了,那么为什么还要有域名的存在呢?那是因为 [IP 地址]({{< relref "nw_ip_地址.md" >}}) 做为数字一样的存在,不方便记忆,而且没有可识别度,就是 xx 村 xx 街 xx 号一样,肯定没有可以自己能取名的招牌响亮。所以域名既是互联网上的「招牌」。
|
||||
|
||||
|
||||
## 顶级域名 {#顶级域名}
|
||||
|
||||
Top-level domain, TLD 称呼为顶级域名,比如最常见 .com 就是一个顶级域名,一个顶级域名下只能存在一个相同的名字,比如 A 国有一个能力有限公司,那么 A 国的人就不能再取一个叫能力的名字了,但是跑去 B 国的话就可以。
|
||||
|
||||
除了常见的 .com ,其实现在也有非常多的 TLD 可供选择,比如展示自我的 .me .space .work ,为了好玩的 .fun .dog .cat 等等等等……因为现在互联网已经过了那个蛮荒时期,人们在浏览器内自己动手输入地址的频次大大降低了,都改用 APP 内部操作了(我对此感到有点忧伤)。所以已经没有必要追求最保稳的 .com 域名了,为了个性化去选择自己最看的上眼的域名后缀吧。
|
||||
|
||||
|
||||
## 购买 {#购买}
|
||||
|
||||
因为域名也是一门生意,所以也有很多的服务商经营,一些域名后缀可能在 A 家更便宜但是 B 家或许在某一时刻搞活动反而便宜过了 A 家之类的、以及是否支持手头上的支付方式、是否提供保护隐私的 WHOIS 屏障服务(注册时要填写相关个人信息,而且会向全互联网开放查询, WHOIS 保护服务就是插手这里,在查询平台只显示注册服务商的信息)。
|
||||
|
||||
还有最重要的,续费价格,因为域名费是按年记的,可能一些域名首年有优惠活动才了两、三美刀,但是到了要续费的时候就暴涨到了三、四十美刀了……
|
||||
|
||||
[TLD-Listi](https://tld-list.com/) 是一家不错的比价网站,可以快速综合上述提到的纬度进行查询。
|
36
content/posts/nw_服务器.md
Normal file
36
content/posts/nw_服务器.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
+++
|
||||
title = "服务器"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-16T17:44:00+08:00
|
||||
lastmod = 2022-11-23T19:28:08+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
服务器,就是……提供服务器的机器,所以,这其实是一个很宽泛的概念。你和旁边的人通过面对面快传或是用 Air Drop 发送文件,你的手机提供了传送文件这项服务,所以你的手机可以看作一个服务器。如果在电脑上安装一些应用提供服务,那么你的电脑也成为了一个服务器。
|
||||
|
||||
但是为什么一谈起服务器,人们的印象是「放在空调房的大柜子里,嗡嗡响还不停闪着灯」的机器呢?因为这些是专门设计拿来提供服务的机器,跟家用设备相比,摒弃了一切不需要的设计,可以做到一直开机不停提供服务(如果家里的设备一直不停机,估计会担心它会不会坏掉呢)。
|
||||
|
||||
|
||||
## 托管商 {#托管商}
|
||||
|
||||
作为个人,还是很难有个地方建起个机房花大把钱买设备的,所以通常会去租用提供服务器托管的商家——托管商,这些商家又好又坏,选择哪个商家要从多种纬度去考察呢。
|
||||
|
||||
[服务器商家推荐]({{< relref "nw_服务器商家推荐.md" >}})
|
||||
|
||||
|
||||
### VPS {#vps}
|
||||
|
||||
或许可能会从更多地方听过虚拟专用服务器 (Virtual private server) —— VPS 这个概念,这是什么意思呢?是因为随着虚拟技术的发展,可以做到在一台实际的物理设备上「虚拟」出复数的「服务器」,而这些「服务器」里的操作系统还以为自己是在一台真正得机子上。有点像是一片地上建起小区楼这种感觉。
|
||||
|
||||
|
||||
#### 超售 {#超售}
|
||||
|
||||
VPS 技术好处就是商家能够为更多人提供服务增加收益,而用户也能享受到低价的租用费用,但如果商家疯狂压榨机子,超出了设备的承载,就是「超售」了,有点像是那种有小又窄又乱的「鸽子笼」小区……
|
||||
|
||||
商家是否有超售现象也是评判商家的重要标准
|
||||
|
||||
|
||||
### 独服 {#独服}
|
||||
|
||||
或许还会听过独服即独立服务器的概念,跟 VPS 对比就明白了,就是完完全全「独占」使用这台设备,托管商只提供一个机子而已,优缺点显而易见,完全独占设备的性能,就是……很贵……
|
38
content/posts/nw_服务器商家推荐.md
Normal file
38
content/posts/nw_服务器商家推荐.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
+++
|
||||
title = "服务器商家推荐"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-11-23T18:19:00+08:00
|
||||
lastmod = 2022-11-23T19:27:21+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## Vultr {#vultr}
|
||||
|
||||
Vultr 最大特点就是模式是 ****按小时计费**** 的就像网吧一样,这样的优点就是可以在学习期随意折腾,换系统、换地区,不怕随意搞炸。但是最低 5 刀的费用账单也对比其它商家的优惠套餐可能就显得性价比没那么高了。
|
||||
|
||||
[官网地址](https://www.vultr.com/)
|
||||
|
||||
如果你想支持我的话,可以使用想这个链接 [vultr.com/?ref=9073502-8H](https://www.vultr.com/?ref=9073502-8H) 进行注册,注册后可以获得时效一个月 100 美刀的代金券,可以在一个月内多开几台高配置服务器用来这趟学习,但是要注意及时销毁掉(Vultr 单纯停机的话也会计费的,必须销毁)。
|
||||
|
||||
同时支付手段支持支付宝。
|
||||
|
||||
|
||||
## Cloudcone {#cloudcone}
|
||||
|
||||
其特点是会出一些年付优惠套餐,年付综合下来能以 2~3 刀的价格买到其它家要 5 刀每月的机子,不过年付有风险,还是要谨慎考虑。
|
||||
|
||||
[官网地址](https://cloudcone.com/)
|
||||
|
||||
如果你想支持我的话,可以使用这个链接 [cloudcone.com/?ref=8688](https://cloudcone.com/?ref=8688) 进行注册购买,这样我会收到到 30% 的推广返利,
|
||||
|
||||
同时现在(2022-11-23)时 Cloudcone 正在搞黑五促销,正是优惠套餐出没的时候,可以前去看看瞧瞧,[cloudcone.com/2022-black-friday-vps-sale/?ref=8688](https://hello.cloudcone.com/2022-black-friday-vps-sale/?ref=8688) 。
|
||||
|
||||
\*要注意 Cloudcone 要提前将余额充值到账户钱包内才能进行消费,不过充值方式支持支付宝。
|
||||
|
||||
|
||||
## Contabo {#contabo}
|
||||
|
||||
特点是其套餐性价比非常之高,但是稳定性欠佳,如果接受的了这点可以前去看看,同时支付手段仅支持信用卡,同时用户资料审核严格,可能需要被要求发送身份证明图片(当然可以把身份证的地址号码图像可以涂抹掩盖的再发送过去的)。
|
||||
|
||||
[官网地址](https://contabo.com/en/) 同时可以切换成欧元支付,对比起来价格会低一点。
|
67
content/posts/nw_狐式流建站教程索引.md
Normal file
67
content/posts/nw_狐式流建站教程索引.md
Normal file
|
@ -0,0 +1,67 @@
|
|||
+++
|
||||
title = "狐式流建站教程索引"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-11-24T17:29:00+08:00
|
||||
lastmod = 2022-11-24T19:02:09+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 互联网冲浪时到底发生了什么? {#互联网冲浪时到底发生了什么}
|
||||
|
||||
|
||||
### 互联网 {#互联网}
|
||||
|
||||
平常使用互联网时,都是非常下意识的,抽象到只需手指鼠标轻轻一点。就如同日常生活的邮递系统,只要按照标准去使用寄送东西,那么运输、转送、配送这些东西也不用自己操心了,隐藏了很多复杂。
|
||||
|
||||
我→[互联网]({{< relref "nw_互联网.md" >}})→想访问的内容
|
||||
|
||||
|
||||
### 域名 {#域名}
|
||||
|
||||
但是实际上是通过[域名]({{< relref "nw_域名.md" >}})来在互联网之间进行跳转的,只要知道域名,就如同寄快递时也需要一个「地址」,这个地址就相当于域名。
|
||||
|
||||
我→[域名]({{< relref "nw_域名.md" >}})→想访问的内容
|
||||
|
||||
|
||||
### 域名解析 {#域名解析}
|
||||
|
||||
但是计算机世界实际是根据[IP 地址]({{< relref "nw_ip_地址.md" >}})来去寻找对方的,所以就需要将域名转换成 [IP 地址]({{< relref "nw_ip_地址.md" >}}),这就是 [DNS]({{< relref "nw_dns.md" >}}) 。
|
||||
[域名]({{< relref "nw_域名.md" >}})就如同 XX 有限公司,XX 大酒店一样,只是一个形式上的,而 [IP 地址]({{< relref "nw_ip_地址.md" >}})就像 XX 市 XX 区 XX 街 XX 号一样,是一个实际的地址。平常在上网冲浪时,这种地址转换都通过[DNS 服务器]({{< relref "nw_dns.md" >}})自动解决的。
|
||||
|
||||
我→[域名]({{< relref "nw_域名.md" >}})→[DNS 服务器]({{< relref "nw_dns.md" >}})→[IP 地址]({{< relref "nw_ip_地址.md" >}})→想访问的内容
|
||||
|
||||
|
||||
### 服务器 {#服务器}
|
||||
|
||||
实际上互联网上想访问的东西当然是要一个实际的物理设备来提供不管是 [HTML]({{< relref "nw_html.md" >}}) 网页啦,还是媒体文件等,这个设备就是[服务器]({{< relref "nw_服务器.md" >}}),同时[服务器]({{< relref "nw_服务器.md" >}})准备好内容后就通过请求中附带的发件人地址来反过来发送。就像日常网狗时,要填入自己的地址卖家才能把内容寄过来。
|
||||
|
||||
我→[域名]({{< relref "nw_域名.md" >}})→[DNS 服务器]({{< relref "nw_dns.md" >}})→[IP 地址]({{< relref "nw_ip_地址.md" >}})→[服务器]({{< relref "nw_服务器.md" >}})
|
||||
|
||||
[服务器]({{< relref "nw_服务器.md" >}})→想访问的内容→[互联网]({{< relref "nw_互联网.md" >}})→我
|
||||
|
||||
|
||||
## 建站时到底在要是在干什么? {#建站时到底在要是在干什么}
|
||||
|
||||
|
||||
### 应用 {#应用}
|
||||
|
||||
根据上文一个简单的描述,大概就能知道实际上的建站是在干什么了,首先需要一个[服务器]({{< relref "nw_服务器.md" >}})来提供所需的内容,但是服务器本身只是一个机器而已,就如同只是一片土地而已。实际上提供服务的是搭建在这片土地上的应用,比如网盘应用、博客应用、笔记应用等。
|
||||
|
||||
用户→[互联网]({{< relref "nw_互联网.md" >}})→服务器→具体的应用→用户想访问的内容
|
||||
|
||||
用户想访问的内容→[互联网]({{< relref "nw_互联网.md" >}})→用户
|
||||
|
||||
|
||||
### 端口 {#端口}
|
||||
|
||||
如果说计算机世界是用 [IP 地址]({{< relref "nw_ip_地址.md" >}})来区分具体的机器,那么机器内就是用[端口]({{< relref "nw_端口.md" >}})来区分具体的应用了。
|
||||
|
||||
用户→[互联网]({{< relref "nw_互联网.md" >}})→[端口]({{< relref "nw_端口.md" >}})→服务器→根据[端口]({{< relref "nw_端口.md" >}})号寻找具体的应用→用户想访问的内容
|
||||
|
||||
|
||||
### 反向代理 {#反向代理}
|
||||
|
||||
端口的目的就是为了区分不同应用的数据(想想热水管道和污水管道),但是互联网大家平常默认使用的端口并不多,那么如何让一个端口分配给多个不同的应用使用呢,这就是[反向代理]({{< relref "nw_反向代理.md" >}})(典型干这种事的就是 [Nginx]({{< relref "nw_nginx.md" >}}))。
|
||||
|
||||
用户→[互联网]({{< relref "nw_互联网.md" >}})→[端口]({{< relref "nw_端口.md" >}})→服务器→[反向代理]({{< relref "nw_反向代理.md" >}})应用([Nginx]({{< relref "nw_nginx.md" >}}))→根据请求里的[域名]({{< relref "nw_域名.md" >}})将请求传递给[端口]({{< relref "nw_端口.md" >}})号对应的应用→用户想访问的内容
|
31
content/posts/nw_端口.md
Normal file
31
content/posts/nw_端口.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
+++
|
||||
title = "端口"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-21T23:07:00+08:00
|
||||
lastmod = 2022-09-22T00:02:45+08:00
|
||||
tags = ["publish", "newbie"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
端口,英文叫做 Port ,如果直接按照英文翻译的话就是「港口」的意思。
|
||||
|
||||
端口的可以比喻成和外界通信的一个「口子」、一扇门、一束管道,因为在一台机器里面运行了各种不同应用程序,而[IP 地址]({{< relref "nw_ip_地址.md" >}})仅仅只是一个地址而已。好比想去某单位办事,只知道地址是不够的,还需要具体的楼层,具体的房间号才行……
|
||||
|
||||
而端口的另外一个用途就是将不同应用程序通信数据区分开来,这也很容易理解,谁想污水和供应的热水混在一起?所以有必要将它们分开。
|
||||
|
||||
端口号的定义范围在 0~65535 之间,每当一个程序觉得需要进行通信的时候,就会向操作系统申请一个具体的端口号,操作系统就会检查,查看是否申请的端口有没有被其它应用所使用,如果没有,就会把这个端口号分配给申请的应用程序。
|
||||
|
||||
通常来讲端口号只是一个数字而已,本身没有含义,但在人们的日常交流使用中,有些端口号「默认」附上了一些含义,比如你现在正在访问的 https 网站,实际上附带一个端口号「443」,只不过浏览器将其默认隐藏了起来而已。
|
||||
|
||||
|
||||
## 一些著名端口 {#一些著名端口}
|
||||
|
||||
| 服务 | 端口号 |
|
||||
|---------|-----|
|
||||
| http | 80 |
|
||||
| https | 443 |
|
||||
| ssh | 22 |
|
||||
| DNS | 53 |
|
||||
| Minecraft | 25565 |
|
||||
|
||||
当然这只是大家「默认」的而已,并不是一个强制的准则,如果有人比较叛逆,想把自己的网站假设在 2333 端口上,这也是可以的,只不过这样用户想访问网站就得附上相应端口号才行,如 <https://我.与总不同:2333> 。
|
22
content/posts/nw_缓存.md
Normal file
22
content/posts/nw_缓存.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
+++
|
||||
title = "缓存"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-12T23:47:00+08:00
|
||||
lastmod = 2022-09-13T22:37:19+08:00
|
||||
tags = ["newbie", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
缓存( Cache ),缓可以理解为缓冲的意思,存就是存贮。
|
||||
|
||||
举个例子来说明,
|
||||
|
||||
如果要打算写篇文章,从书架拿下了要用到的书籍,翻阅查找后大概率是把它放到书桌的一边吧?毕竟这本书后续很有可能要用到,再放回书架之后又用到跑来跑去岂不是很麻烦?
|
||||
|
||||
在这个例子中,桌子的用来暂时存放书籍的地方就能被称为缓存区,要用到的书也被缓存了下来。
|
||||
|
||||
缓存是一项很重要的技术,毕竟计算机世界里各部件处理速度差距很大,甚至达到了几万几十万倍(想象书架不是放在房间里而是放在了月球上)。
|
||||
|
||||
同时互联网环境下,缓存也可以将原始数据进行复制并分发到各个地方中,这样就能减少用户的加载时间了(参见 [CDN]({{< relref "nw_cdn.md" >}}) )。
|
||||
|
||||
> 港台将 Cache 翻译成了「快取」,这个翻译似乎更便于理解?
|
35
content/posts/nw_静动态博客区别.md
Normal file
35
content/posts/nw_静动态博客区别.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
+++
|
||||
title = "静动态博客之间的区别"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-11-19T22:30:00+08:00
|
||||
lastmod = 2022-11-19T22:59:19+08:00
|
||||
tags = ["newbie", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
动态博客与静态博客之间的区别其实可以说就是动态网站和静态网站的区别。
|
||||
|
||||
|
||||
## 动态博客 {#动态博客}
|
||||
|
||||
动态网站就像是印刷厂,当请求要看某一章内容时,工作人员就会接收请求,然后去仓库(数据库)里按照请求调取对应数据,然后送到产线上把数据印刷、排版然后形成一个网页再送回给前台提供给访问者。
|
||||
|
||||
典型的动态博客就是 WordPress 了,也是博客里最知名的,动态博客好处就是……它是动的,像是工厂一样,需要占据大量地方和资源(即需要服务器),但是功能很齐全,评论、插件等都是内置好的,不需要额外折腾就能用,如果选择 WordPress 的话,那么更是享有最多的教程经验帖了……
|
||||
|
||||
|
||||
## 静态博客 {#静态博客}
|
||||
|
||||
静态网站就好比是成书,已经印刷好了,请求时想看那几页那几章就直接返回内容……
|
||||
|
||||
静态博客里面相对比较知名的有两个 Hexo 、 Hugo, 其实它们应该叫作「静态博客生成器」,会自动综合设定、主题模板、插件等内容,然后生成最后的静态网站(成书),所以静态博客无非就是把「印刷」这件事放到本地来做罢了。
|
||||
|
||||
之后生成的书别人还不能看到,也要放到网上。但相比一个「印刷厂」,展示一本「成书」消耗的资源就少得多,所以你很容易看到免费的静态网站托管服务,例如 GitHub Pages 、 Cloudflare Pages 、 Netlify 等,而动态博客就少有免费托管了(即使有也是限制重重)。
|
||||
|
||||
但是坏处就是流程比较琐碎,而且要更新的话还要本地再次把书「印刷」出来然后推送到托管服务商,同时无法提供一些动态的内容比如评论,这些动态内容还要找第三方再进行额外配置。
|
||||
|
||||
|
||||
## 总结 {#总结}
|
||||
|
||||
动态博客:需要置办一台[服务器]({{< relref "nw_服务器.md" >}})才能建立,同时还要维护它。但是具备灵活性,可以直接在网页端后台发布、编辑文章。
|
||||
|
||||
静态博客:建立起来需要更多琐碎步骤同时灵活性欠佳,很难使用移动设备或没有相应环境的设备上编辑、发布文章。但是基本上是免费的,同时能学习到更多知识(或许)。
|
10
content/posts/org_roam.md
Normal file
10
content/posts/org_roam.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
title = "org-roam"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-08-27T15:14:00+08:00
|
||||
lastmod = 2022-08-27T15:28:08+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
虽然小问题很多,但是它活在一个幸福的世界里(指 Emacs 生态)……
|
33
content/posts/tcp_ip_模型.md
Normal file
33
content/posts/tcp_ip_模型.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
+++
|
||||
title = "TCP/IP 模型"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-09-08T00:07:44+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
- 应用层(用户对用户):
|
||||
任务:提供系统与用户的接口
|
||||
功能:文件传输、访问和管理、电子邮箱
|
||||
协议:FTP SMTP HTTP
|
||||
- 传输层/运输层(进程对进程、应用对应用)
|
||||
传输单位:报文段(TCP)、用户数据报(UDP)
|
||||
任务:负责主机之间两个进程的通信
|
||||
功能:提供可靠的传输服务、为端对端连接提供流量控制、差错控制、服务质量控制
|
||||
协议:TCP UDP ARQ
|
||||
- 网络层/网际层/IP 层(主机对主机)
|
||||
传输单位:数据报
|
||||
任务:讲传输层的报文封装成分组;选择适当的路由将分组交付到目的主机
|
||||
功能:为传输层提供服务;组包和拆包;路由选择;拥塞控制
|
||||
协议:ICMP ARP IP IGMP
|
||||
- 数据链路层/链路层
|
||||
传输单位:帧
|
||||
硬件:交换机、网桥
|
||||
任务:将网络层传下来的 IP 数据报组装成帧
|
||||
功能:链路连接的建立、拆除、分离;帧定界和帧同步;差错检测
|
||||
协议:PPP HDLC
|
||||
- 物理层
|
||||
传输单位:比特
|
||||
硬件:集线器、中继器
|
||||
任务:透明地传输比特流
|
||||
功能:为数据端设备提供传送数据通路
|
29
content/posts/tcpip详解卷1.md
Normal file
29
content/posts/tcpip详解卷1.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
+++
|
||||
title = "TCP/IP 详解 卷1:协议"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-07T23:56:00+08:00
|
||||
lastmod = 2022-09-08T00:10:33+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 第 1 章 概览 {#第-1-章-概览}
|
||||
|
||||
|
||||
### 为什么很多标准的 TCP/IP 服务端口号都是奇数? P12 {#为什么很多标准的-tcp-ip-服务端口号都是奇数-p12}
|
||||
|
||||
如 FTP, SMTP, TELNET 等,
|
||||
|
||||
因为 TCP 的前身为 NCP ,而 NCP 是单工而不是双工的,需要两个链接,预留一个奇数和偶数端口号。
|
||||
|
||||
|
||||
## 第 3 章 IP: 网际协议 {#第-3-章-ip-网际协议}
|
||||
|
||||
|
||||
### IP 协议不可靠、无连接是什么意思? P24 {#ip-协议不可靠-无连接是什么意思-p24}
|
||||
|
||||
- 不可靠
|
||||
是指不能保证 IP 数据能成功到达目的地,IP 仅提供力所能及的支持。可靠性得由上层来实现(例如 [TCP/IP 模型]({{< relref "tcp_ip_模型.md" >}}))。
|
||||
|
||||
- 无连接
|
||||
是指 IP 不维护关于后续数据报的状态信息,每个数据报的处理都是相互独立的。这也解释了为什么不同数据报会选择不同路线,导致后面的数据报先于之前的数据报到达目标主机。
|
39
content/posts/关于本站.md
Normal file
39
content/posts/关于本站.md
Normal file
|
@ -0,0 +1,39 @@
|
|||
+++
|
||||
title = "关于本站"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-08-27T15:17:00+08:00
|
||||
lastmod = 2022-08-28T02:37:07+08:00
|
||||
tags = ["article", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 采用软件 {#采用软件}
|
||||
|
||||
本站笔记使用 [org-roam]({{< relref "../main/org_roam.md" >}}) 进行记录,然后用 [ox-hugo](https://ox-hugo.scripter.co/) 将 org 文件转换成 md 文件并用 [Hugo](https://gohugo.io/) 渲染成网页文件。
|
||||
代码托管在自建的 [Gitea](https://git.southfox.me/southfox/garden/src/branch/master) 实例上,同时通过 [Drone CI](https://www.drone.io/) 自动部署到 [Cloudflare Pages](https://pages.cloudflare.com/) 网站托管平台上。
|
||||
|
||||
|
||||
## 后续计划 {#后续计划}
|
||||
|
||||
|
||||
### <span class="org-todo done DONE">DONE</span> 评论系统 {#评论系统}
|
||||
|
||||
|
||||
### <span class="org-todo todo TODO">TODO</span> 反链图像 {#反链图像}
|
||||
|
||||
|
||||
### <span class="org-todo todo TODO">TODO</span> 链接悬浮预览 {#链接悬浮预览}
|
||||
|
||||
不紧急,因为现在采用的主题 [GitHub - jethrokuan/braindump](https://github.com/jethrokuan/braindump) 可以分栏查看笔记。
|
||||
|
||||
|
||||
### <span class="org-todo todo TODO">TODO</span> 主题美化 {#主题美化}
|
||||
|
||||
|
||||
#### <span class="org-todo todo TODO">TODO</span> 暗色模式 {#暗色模式}
|
||||
|
||||
|
||||
#### <span class="org-todo todo TODO">TODO</span> 动画 {#动画}
|
||||
|
||||
|
||||
#### <span class="org-todo todo TODO">TODO</span> 字体 {#字体}
|
33
content/posts/大话数据结构.md
Normal file
33
content/posts/大话数据结构.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
+++
|
||||
title = "大话数据结构"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-09-03T00:34:04+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## 第一章数 据结构导论 {#第一章数-据结构导论}
|
||||
|
||||
|
||||
### 逻辑结构和物理结构的区别 {#逻辑结构和物理结构的区别}
|
||||
|
||||
[逻辑结构]({{< relref "数据结构.md#逻辑结构" >}})是面对具体问题的[物理结构]({{< relref "数据结构.md#物理结构" >}})是面对计算机的。
|
||||
|
||||
|
||||
### 时间复杂度推算 {#时间复杂度推算}
|
||||
|
||||
- 用常数 1 取代算法中的所有加法常数。
|
||||
- 在之后的函数运行中只保留最高阶项
|
||||
- 保留最高阶的
|
||||
|
||||
推导[时间复杂度]({{< relref "../main/时间复杂度.md" >}})并不难,难点是一些对数列的运算,更多的是考察数学能力,要补习一些数学知识和能力再来吧……(尤其里面的[对数]({{< relref "../main/对数.md" >}})部分,我已然忘光……)
|
||||
|
||||
|
||||
## 第四章 栈与队列 {#第四章-栈与队列}
|
||||
|
||||
|
||||
### 栈的定义 {#栈的定义}
|
||||
|
||||
[栈]({{< relref "../main/栈.md" >}})是一个限定在表尾进行「插入」和「删除」的线性表。
|
||||
|
||||
类似于枪械弹匣和软件的(浏览器、Word)历史记录,后面进栈的元素会首先出栈。
|
58
content/posts/如何下载下不动的东西.md
Normal file
58
content/posts/如何下载下不动的东西.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
+++
|
||||
title = "如何下载下不动的东西"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-12T23:38:00+08:00
|
||||
lastmod = 2022-09-13T00:19:34+08:00
|
||||
tags = ["newbie", "article", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
一些软件下起来每秒才 20~30 kb 的速度,焦急地盯着它下了一半然后就失败了?
|
||||
|
||||
或许有一些方法可以拯救这个状况。
|
||||
|
||||
|
||||
### 科学上网环境 {#科学上网环境}
|
||||
|
||||
最根本的解决方案是有一个「正常」的上网环境,但是这个方法实现起来太过五花八门,而且即使有了相关工具可能对于小白来说也可能无法运用上。
|
||||
|
||||
|
||||
### 使用一些镜像站或是代理站 {#使用一些镜像站或是代理站}
|
||||
|
||||
国内一些 IT 公司都有运营自己的镜像站,[缓存]({{< relref "../main/nw_缓存.md" >}})了一些常用的软件。
|
||||
|
||||
例如由淘宝维护的 npmmirror 镜像站:<https://registry.npmmirror.com>
|
||||
|
||||
或是一些由志愿者维护运行的[代理]({{< relref "../main/nw_代理.md" >}})网站,可以加速从 GitHub 下载软件时的速度。
|
||||
|
||||
例如,fastgit :[使用指南 | FastGit UK](https://doc.fastgit.org/zh-cn/guide.html) 。
|
||||
|
||||
使用例子:
|
||||
|
||||
假设 Hugo 的 GitHub 下载地址为:
|
||||
|
||||
<https://github.com/gohugoio/hugo/releases/download/v0.102.3/hugo_extended_0.102.3_Windows-64bit.zip>
|
||||
|
||||
那么 fastgit 加速下载地址为:
|
||||
|
||||
<https://download.fastgit.xyz/gohugoio/hugo/releases/download/v0.102.3/hugo_extended_0.102.3_Windows-64bit.zip>
|
||||
|
||||
|
||||
### 使用一些下载器进行下载(不推荐) {#使用一些下载器进行下载-不推荐}
|
||||
|
||||
例如迅雷,它会有专门的服务器[缓存]({{< relref "../main/nw_缓存.md" >}})用户下载的内容,所以一些国外下不动东西用迅雷进行下载有可能是下载的了的……但问题是,考虑迅雷带来的广告和对于用户隐私的损害,对比起下载速度是否值得呢?
|
||||
|
||||
|
||||
## 一些常用软件的下载 {#一些常用软件的下载}
|
||||
|
||||
> 写在前面:我并没有对于这些软件进行测试(因为我现在系统不是 Win 系统),所以对于其软件是否能够正常运行及其安全性不做担保……如果你会校验,可以尝试自己校验试试。
|
||||
|
||||
|
||||
### Git {#git}
|
||||
|
||||
npmmirror 下载:<https://registry.npmmirror.com/-/binary/git-for-windows/v2.37.3.windows.1/Git-2.37.3-64-bit.exe>
|
||||
|
||||
|
||||
### Hugo {#hugo}
|
||||
|
||||
fastgit 下载:<https://download.fastgit.org/gohugoio/hugo/releases/download/v0.102.3/hugo_extended_0.102.3_Windows-64bit.zip>
|
7
content/posts/存储强度.md
Normal file
7
content/posts/存储强度.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
+++
|
||||
title = "存储强度"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:48+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
7
content/posts/帕金森定律.md
Normal file
7
content/posts/帕金森定律.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
+++
|
||||
title = "帕金森定律"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:50+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
9
content/posts/必要难度理论.md
Normal file
9
content/posts/必要难度理论.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
+++
|
||||
title = "必要难度理论"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:50+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
存取记忆如果太过于简单,那么也会更快遗忘,就像在石头上刻字一样,必须给自己记笔记时增加一点困难。
|
9
content/posts/文献笔记.md
Normal file
9
content/posts/文献笔记.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
+++
|
||||
title = "文献笔记"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:49+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
读文献材料而下来的,内容应该尽可能简洁,然后应该每天抽出一定时间去整理笔记,下下[永久笔记]({{< relref "永久笔记.md" >}})。
|
10
content/posts/曝光效应.md
Normal file
10
content/posts/曝光效应.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
title = "曝光效应"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:49+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
当我们熟悉某个事物的时候,大脑会错误地认为我们已经真的理解了
|
||||
**熟悉不等于理解!**
|
143
content/posts/来把 org-roam 笔记发布出去吧.md
Normal file
143
content/posts/来把 org-roam 笔记发布出去吧.md
Normal file
|
@ -0,0 +1,143 @@
|
|||
+++
|
||||
title = "来把 org-roam 笔记发布出去吧"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-08-30T19:10:00+08:00
|
||||
lastmod = 2022-08-30T20:49:47+08:00
|
||||
tags = ["article", "publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
[org-roam]({{< relref "../main/org_roam.md" >}}) 很好,不过笔记积累久了就会产生分享欲,想要在线发布出去……最近摸爬滚打几天终于是弄出来了……
|
||||
|
||||
|
||||
## 方案选择 {#方案选择}
|
||||
|
||||
首先先去网上搜索了一遍,发现还是有一些前人踩路的……
|
||||
|
||||
- [Neil's Digital Garden](https://commonplace.doubleloop.net/) 这个网页弄得很漂亮,完成度也很高,然后具体一看源代码,通篇 JavaScript ……额,倒不是说 JS 坏话啦,不过我现在没打算在学 JS 的,而且 npm 确实很折磨人。
|
||||
|
||||
[How I publish my wiki with org-publish](https://commonplace.doubleloop.net/20200821142536-how_i_publish_my_wiki_with_org_publish) 所使用的代码也确实有点复杂了(我,纯纯菜狐)。
|
||||
|
||||
- [My Org Roam Notes Workflow - Hugo Cisneros](https://hugocisneros.com/blog/my-org-roam-notes-workflow/) 这篇文章讲的也不错,不过其博客主题源代码并没有和 org-roam 相关的,好像只有一些框架。好吧,也知道弄 Emacs 相关的作业没那么好抄的,心理准备还是有的。
|
||||
|
||||
不过博客讲了如何使用 Python 分析 org-roam 的数据库解析出关系图谱,不过我现在的想法是只把我一部分笔记发布出去,而我又想通过 Drone 这个 CI 平台自动构建网站,所以也用不到了……
|
||||
|
||||
- 最后试了试 [jethrokuan/braindump](https://github.com/jethrokuan/braindump) 方案,这个也是 org-mode 作者在用的,所以也算是钦定方案了(
|
||||
|
||||
但实际其采用的脚本我无法使用,可能和我用的 Doom Emacs batch 环境有问题吧,也不知道怎么解决(我,究极菜狐)……所以最后只能自己慢慢折腾了!
|
||||
|
||||
|
||||
## 准备 {#准备}
|
||||
|
||||
首先要先下载 ox-hugo 包,先把 org-mode 所用的 .org 文件转换成 .md 再给 hugo 解析……没错,Emacser 就是这么自由,虽说 hugo 原生就支持 org 文件,不过 Markdown 支持更优秀的话用 Markdown 也不是不行……(反正也是自动转换的)
|
||||
|
||||
|
||||
### 代码 {#代码}
|
||||
|
||||
```elisp
|
||||
(setq org-hugo-base-dir "~/Documents/roam-publish/")
|
||||
|
||||
(defun my/org-roam-filter-by-tag (tag-name)
|
||||
(lambda (node)
|
||||
(member tag-name (org-roam-node-tags node))))
|
||||
|
||||
(defun my/org-roam-list-notes-by-tag (tag-name)
|
||||
(mapcar #'org-roam-node-file
|
||||
(seq-filter
|
||||
(daviwil/org-roam-filter-by-tag tag-name)
|
||||
(org-roam-node-list))))
|
||||
|
||||
(defun my/org-roam-export-all ()
|
||||
"Re-exports all Org-roam files to Hugo markdown."
|
||||
(interactive)
|
||||
(dolist (org-file (my/org-roam-list-notes-by-tag "publish"))
|
||||
;(dolist (org-file (directory-files-recursively org-roam-directory "\.org$"))
|
||||
(with-current-buffer (find-file org-file)
|
||||
(org-hugo-export-wim-to-md))))
|
||||
|
||||
(defun my/org-roam-creat-node ()
|
||||
"creat node and add NODE tag"
|
||||
(interactive)
|
||||
(org-id-get-create)
|
||||
(org-set-tags ":NODE:")
|
||||
(save-buffer)
|
||||
(org-hugo-export-wim-to-md))
|
||||
```
|
||||
|
||||
第一行是指定 ox-hugo 生成的博客路径。
|
||||
|
||||
第二第三个函数虽然前缀是 my 但其实根本是网上找的……作用是将 org-oroam 笔记中筛选出标签带 "publish" 的笔记,然后挨个用 org-hugo-export-wim-to-md 执行。
|
||||
|
||||
最后一个函数就是完全自己写的了,完全没有技术含量,无非就是把一些函数堆叠起来,不过真心好用……[论 Emacs 的易折腾性]({{< relref "../main/论_emacs_的易折腾性.md" >}})。
|
||||
|
||||
|
||||
## 究极折腾 {#究极折腾}
|
||||
|
||||
|
||||
### 路径问题 {#路径问题}
|
||||
|
||||
写好函数之后就能把笔记发布并转换为 .md 文件了,但实际上 ox-hugo 不知道是不是我配置问题,出来的链接都带有我 org-mode 设置的文件夹路径,所以得自己清洗一些……
|
||||
|
||||
```shell
|
||||
sed -i 's/..\/main\///' content/posts/*.md
|
||||
sed -i "s/..\/references\///" content/posts/*.md
|
||||
sed -i "s/..\article\///" content/posts/*.md
|
||||
sed -i 's/..\/main\///' content/posts/*.md
|
||||
sed -i "s/..\/references\///" content/posts/*.md
|
||||
sed -i "s/..\article\///" content/posts/*.md
|
||||
sed -i 's/..\/main\///' content/posts/*.md
|
||||
sed -i "s/..\/references\///" content/posts/*.md
|
||||
sed -i "s/..\article\///" content/posts/*.md
|
||||
```
|
||||
|
||||
具体而言就是用 Linux 里的 sed 命令将路径删掉,至于为什么要重复三次是因为一次似乎洗不干净我也懒得找具体原因,所以直接暴力重复三次了……
|
||||
|
||||
然后 Hugo 默认配置下找不到路径将会直接报错退出,对于 roam 这种经常附个链接又不具体写的情况不友好,搜索下来发现官方文档已经有具体方案了。
|
||||
|
||||
[Links and Cross Referencess | Hugo](https://gohugo.io/content-management/cross-references/#ref-and-relref-configuration)
|
||||
|
||||
只要在配置文件写入 refLinksErrorLevel = "WARNING" 这行配置就行了,配置成警告而不报错导致中止。
|
||||
|
||||
|
||||
### 搜索问题 {#搜索问题}
|
||||
|
||||
主题自带的搜索无法搜索中文,不过相比 Emacs 相关问题,Hugo 相关真是好找太多了
|
||||
|
||||
然后参考了这个方案 [Hugo JS Searching with Fuse.js · GitHub](https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae) ,评论区下面也有人做了中文优化的 [Hugo JS Searching with Fuse.js · GitHub](https://gist.github.com/onegit20/db426ec7c90c545391168a12ebadbd4e) ,能抄作业就是爽啦!
|
||||
|
||||
|
||||
### 评论问题 {#评论问题}
|
||||
|
||||
其实到这里直接 hugo 命令生成静态文件就好了,但趁着折腾劲没过去还得再造会儿~
|
||||
|
||||
然后打算为自己这个网站加一个评论区,这次不像我博客那样选用要用 GitHub 的方案了,毕竟 GitHub 对完全没技术背景的人来说挺不友好的,所以打算这次选一个完全不用任何额外条件评论功能。
|
||||
|
||||
方案是选择是 [Isso](https://isso-comments.de/) ,一个 Python + Sqlite3 的评论实现,总之安装过程就是直接 docker-compose 拉起来就完事了,不过最后嵌入到网站实际使用发现就有麻烦了,因为这个主题选择采用动态加载方式,第二篇文章会加载到侧面,而这里的评论区是不会加载的……鼓捣了半天终于摸索出一个解决方案……
|
||||
|
||||
根据官网文档 [Advanced integration](https://isso-comments.de/docs/guides/advanced-integration/) ,解决方案是加载文档时将原来评论区移除,然后附加到新位置上,然后用
|
||||
|
||||
```javascript
|
||||
window.Isso.init()
|
||||
window.Isso.fetchComments()
|
||||
```
|
||||
|
||||
重新加载评论框…,然后不要忘了在博客模板文件里配置的时候将 section 设置成
|
||||
|
||||
```html
|
||||
<section id="isso-thread" data-title="{{ .Title }}" data-isso-id="{{ .RelPermalink }}">
|
||||
|
||||
```
|
||||
|
||||
按路径加载的模式,这样才能确保新评论框加载时没有沿用到旧评论框。
|
||||
|
||||
|
||||
### 反向链接 {#反向链接}
|
||||
|
||||
模板自带一个反向链接面板,够是够用的,不过 org-roam-v2 新增了酷炫的任意块链接功能怎么能错过呢?所以鼓捣了一下,用 Python bs4 包解析 hugo 生成的 HTML 文件里的内部链接,然后在计算出反链再塞回到原来的文件里……
|
||||
|
||||
具体代码非常稀烂……都是大循环直接搞定的……要是真想借鉴的话我也放在了我的 Gitea 仓库上……
|
||||
|
||||
|
||||
## 结语 {#结语}
|
||||
|
||||
总之就是十二分折腾,估计燃尽了我几周的能量吧……
|
8
content/posts/栈.md
Normal file
8
content/posts/栈.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
+++
|
||||
title = "栈"
|
||||
author = ["SouthFox"]
|
||||
date = 2022-09-03T00:32:00+08:00
|
||||
lastmod = 2022-09-03T00:36:28+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
11
content/posts/永久笔记.md
Normal file
11
content/posts/永久笔记.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
+++
|
||||
title = "永久笔记"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:50+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
永久笔记是指通过浏览文献笔记中的观点产生的总结或是里面产生的衍生想法、论点和讨论。
|
||||
记下的永久足够多,就能产生想法群,而产生出新的论文。
|
||||
它应该是原子化的,
|
10
content/posts/番茄工作法.md
Normal file
10
content/posts/番茄工作法.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
title = "番茄工作法"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:48+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
一种切分时间段,让人专注当下的时间管理法。
|
||||
如果任务切分的足够好,那么就可以[在心流状态下写作]({{< relref "../references/[De]ShenKe*ALunSi7.md#要如何在心流状态下写作-p39" >}})。
|
7
content/posts/确认偏差.md
Normal file
7
content/posts/确认偏差.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
+++
|
||||
title = "确认偏差"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:48+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
7
content/posts/缓存.md
Normal file
7
content/posts/缓存.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
+++
|
||||
title = "缓存"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:50+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
10
content/posts/蔡格尼克效应.md
Normal file
10
content/posts/蔡格尼克效应.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
title = "蔡格尼克效应"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:48+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
人们会优先关注自己还未完成的任务,并忽略已经完成的任务。
|
||||
GTD 和[番茄工作法]({{< relref "番茄工作法.md" >}})既是从这个理念发散出去的结果。
|
9
content/posts/计算机程序的构造和解释(SICP).md
Normal file
9
content/posts/计算机程序的构造和解释(SICP).md
Normal file
|
@ -0,0 +1,9 @@
|
|||
+++
|
||||
title = "计算机程序的构造和解释(SICP)"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-09-02T22:42:43+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
[SICP 第一课]({{< relref "SICP 第一课.md" >}})
|
9
content/posts/邓宁_克鲁格效应.md
Normal file
9
content/posts/邓宁_克鲁格效应.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
+++
|
||||
title = "邓宁-克鲁格效应"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:51+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
愚昧的人往往倾向于高估自己,错误地判断自己的技能水准。
|
10
content/posts/闪念笔记.md
Normal file
10
content/posts/闪念笔记.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
title = "闪念笔记"
|
||||
author = ["SouthFox"]
|
||||
lastmod = 2022-08-27T14:37:48+08:00
|
||||
tags = ["publish"]
|
||||
draft = false
|
||||
+++
|
||||
|
||||
相当于计算机概念中的[缓存]({{< relref "缓存.md" >}}),可记在任意载体上(餐巾纸、草稿纸等)。
|
||||
把脑子中的浮光掠影记下来,闪念笔记必须在一两天内进行整理,丢弃不要的,留下有用的,整理成文献笔记或者[永久笔记]({{< relref "永久笔记.md" >}})。
|
16
content/search.md
Normal file
16
content/search.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: "Search Results"
|
||||
sitemap:
|
||||
priority : 0.1
|
||||
layout: "search"
|
||||
---
|
||||
|
||||
|
||||
This file exists solely to respond to /search URL with the related `search` layout template.
|
||||
|
||||
No content shown here is rendered, all content is based in the template layouts/page/search.html
|
||||
|
||||
Setting a very low sitemap priority will tell search engines this is not important content.
|
||||
|
||||
This implementation uses Fusejs, jquery and mark.js
|
||||
|
9
fix.sh
Normal file
9
fix.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
sed -i 's/..\/main\///' content/posts/*.md
|
||||
sed -i "s/..\/references\///" content/posts/*.md
|
||||
sed -i "s/..\article\///" content/posts/*.md
|
||||
sed -i 's/..\/main\///' content/posts/*.md
|
||||
sed -i "s/..\/references\///" content/posts/*.md
|
||||
sed -i "s/..\article\///" content/posts/*.md
|
||||
sed -i 's/..\/main\///' content/posts/*.md
|
||||
sed -i "s/..\/references\///" content/posts/*.md
|
||||
sed -i "s/..\article\///" content/posts/*.md
|
198
soup.py
Normal file
198
soup.py
Normal file
|
@ -0,0 +1,198 @@
|
|||
#!/usr/bin/env python3
|
||||
import glob
|
||||
import re
|
||||
import urllib.parse
|
||||
from collections import defaultdict
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
|
||||
def re_link(link):
|
||||
urls = re.findall(r'href=[\'"]?([^\'" >]+)', link)
|
||||
return urls
|
||||
|
||||
def new_section(soup):
|
||||
new_div = soup.new_tag("div")
|
||||
new_div["class"] = 'bl-section'
|
||||
new_h4 = soup.new_tag("h4")
|
||||
new_h4.string = "反向链接"
|
||||
new_div.append(new_h4)
|
||||
bl_div = soup.new_tag("div")
|
||||
bl_div["class"] = 'backlinks'
|
||||
new_div.append(bl_div)
|
||||
bl_ul = soup.new_tag("ul")
|
||||
new_div.append(bl_ul)
|
||||
|
||||
return new_div
|
||||
|
||||
|
||||
def soup_link():
|
||||
files = glob.glob("public/posts/*/*.html")
|
||||
|
||||
pages_dict = defaultdict(dict)
|
||||
for file in files:
|
||||
with open(file, 'r') as f:
|
||||
soup = BeautifulSoup(f.read(), "lxml")
|
||||
|
||||
temp_link = soup.find_all(name='a',class_='internal-link')
|
||||
page_link = []
|
||||
for i in temp_link:
|
||||
i = i.get("href")
|
||||
page_link.append(i)
|
||||
|
||||
nodes = soup.find_all(class_ = "NODE")
|
||||
nodes_dict = {}
|
||||
file_name = file.split('/')[-2]
|
||||
|
||||
for node in nodes:
|
||||
node_dict = {}
|
||||
node_element = node.parent.parent
|
||||
node_dict["name"] = node_element.contents[0]
|
||||
|
||||
iii = node_element.find_next_sibling()
|
||||
node_content = ''
|
||||
while node_element.name != iii.name:
|
||||
node_content += str(iii)
|
||||
iii = iii.find_next_sibling()
|
||||
if iii == None or (iii.name == 'div' and '🔗反向链接' in iii.text):
|
||||
break
|
||||
|
||||
node_id_link = '/' + file_name + '/#' +node_element["id"]
|
||||
node_dict["links"] = re_link(node_content)
|
||||
node_dict["id-link"] = node_id_link
|
||||
node_dict["backlinks"] = []
|
||||
nodes_dict[node_element["id"]] = node_dict
|
||||
|
||||
for i in nodes_dict:
|
||||
for node_link in nodes_dict[i]["links"]:
|
||||
if node_link in page_link:
|
||||
page_link.remove(node_link)
|
||||
|
||||
pages_dict[file_name]["name"] = soup.title.string
|
||||
pages_dict[file_name]["links"] = page_link
|
||||
pages_dict[file_name]["backlinks"] = []
|
||||
pages_dict[file_name]["nodes"] = nodes_dict
|
||||
|
||||
return pages_dict
|
||||
|
||||
pages_dict = soup_link()
|
||||
backlinks_dict = {}
|
||||
backlinks_dict = pages_dict
|
||||
pages_dict = dict(pages_dict)
|
||||
|
||||
for page in pages_dict:
|
||||
try:
|
||||
for link in pages_dict[page]["links"]:
|
||||
link = urllib.parse.unquote(link)
|
||||
if '#' in link:
|
||||
link = link.split('/')
|
||||
if len(link) > 2:
|
||||
# ['', 'posts', '卡片笔记写作法', '#要如何在心流状态下写作-p39']
|
||||
link_page = link[-2]
|
||||
link_node = link[-1][1:]
|
||||
|
||||
backlinks_dict[link_page]["nodes"][link_node]["backlinks"].append(page)
|
||||
|
||||
for node in pages_dict[page]["nodes"]:
|
||||
for link in pages_dict[page]["nodes"][node]["links"]:
|
||||
link = urllib.parse.unquote(link)
|
||||
link = link.split('/')
|
||||
|
||||
if len(link) == 1:
|
||||
link_node = link[0][1:]
|
||||
link = '#' + node
|
||||
backlinks_dict[page]["nodes"][link_node]["backlinks"].append(link)
|
||||
elif len(link) > 2:
|
||||
# ['', 'posts', '卡片笔记写作法', '#卡片笔记中有哪些索引-p9']
|
||||
if link[-2] == page:
|
||||
link_node = link[-1][1:]
|
||||
link = link[-1]
|
||||
backlinks_dict[page]["nodes"][link_node]["backlinks"].append(link)
|
||||
else:
|
||||
if link[-1].startswith('#'):
|
||||
link_page = link[-2]
|
||||
link_node = link_node = link[-1][1:]
|
||||
backlinks_dict[link_page]["nodes"][link_node]["backlinks"].append(pages_dict[page]["nodes"][node]["id-link"])
|
||||
else:
|
||||
link_page = link[-2]
|
||||
backlinks_dict[link_page]["backlinks"].append(pages_dict[page]["nodes"][node]["id-link"])
|
||||
except KeyError as e:
|
||||
print('except:', e)
|
||||
|
||||
del(pages_dict)
|
||||
|
||||
for page in backlinks_dict:
|
||||
write_flag = 0
|
||||
try:
|
||||
with open('public/posts/' + page + '/index.html', 'r+') as f:
|
||||
soup = BeautifulSoup(f.read(), "lxml")
|
||||
except FileNotFoundError as e:
|
||||
print('except:', e)
|
||||
continue
|
||||
|
||||
for i in backlinks_dict[page]["backlinks"]:
|
||||
backlink_filename = i.split('/')[-2]
|
||||
backlink_nodename = i.split('/')[-1][1:]
|
||||
backlink_name = backlinks_dict[backlink_filename]["nodes"][backlink_nodename]["name"].rstrip()
|
||||
i = "/posts" + i
|
||||
|
||||
new_li = soup.new_tag("li")
|
||||
new_a = soup.new_tag("a", href=i)
|
||||
new_a.string = backlink_name
|
||||
new_li.append(new_a)
|
||||
|
||||
bl_section = soup.find(class_="bl-section")
|
||||
if bl_section != None:
|
||||
bl_section.find_next("ul").append(new_li)
|
||||
write_flag = 1
|
||||
|
||||
for i in backlinks_dict[page]["nodes"]:
|
||||
if backlinks_dict[page]["nodes"][i]["backlinks"] == []:
|
||||
continue
|
||||
new_bl = new_section(soup)
|
||||
for ii in backlinks_dict[page]["nodes"][i]["backlinks"]:
|
||||
link = ii.split('/')
|
||||
if len(link) == 1:
|
||||
if link[0].startswith('#'):
|
||||
backlink_nodename = link[0][1:]
|
||||
backlink_name = backlinks_dict[page]["nodes"][backlink_nodename]["name"].rstrip()
|
||||
else:
|
||||
backlink_nodename = link[0]
|
||||
backlink_name = backlinks_dict[backlink_nodename]["name"].rstrip() #FIXME
|
||||
ii = '/posts/' + backlink_nodename + '/'
|
||||
if len(link) > 1:
|
||||
backlink_pagename = link[1]
|
||||
backlink_nodename = link[2][1:]
|
||||
backlink_name = backlinks_dict[backlink_pagename]["nodes"][backlink_nodename]["name"].rstrip()
|
||||
|
||||
new_li = soup.new_tag("li")
|
||||
new_a = soup.new_tag("a", href=ii)
|
||||
new_a.string = backlink_name
|
||||
new_li.append(new_a)
|
||||
new_bl.append(new_li)
|
||||
|
||||
bl_section = soup.find(id=i)
|
||||
iii = bl_section.find_next_sibling()
|
||||
heading = int(bl_section.name[1:])
|
||||
|
||||
while (True):
|
||||
if iii.name == 'div' and '🔗反向链接' in iii.text:
|
||||
iii.find_previous_sibling().append(new_bl)
|
||||
break
|
||||
if iii.find_next_sibling() == None:
|
||||
iii.append(new_bl)
|
||||
break
|
||||
if iii.name.startswith('h') and (int(iii.name[1:]) <= heading):
|
||||
iii.find_previous_sibling().append(new_bl)
|
||||
break
|
||||
iii = iii.find_next_sibling()
|
||||
|
||||
write_flag = 1
|
||||
|
||||
if write_flag == 1:
|
||||
with open('public/posts/' + page + '/index.html', 'r+') as f:
|
||||
f.write(str(soup))
|
||||
print("write " + page + '!')
|
||||
|
||||
|
||||
|
BIN
static/SWJ.png
(Stored with Git LFS)
Normal file
BIN
static/SWJ.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
static/emojimix.png
(Stored with Git LFS)
Normal file
BIN
static/emojimix.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
static/favicon.ico
Executable file
BIN
static/favicon.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
static/ox-hugo/2022-09-13_22-14-26_Learning-How-does-a-CDN-work.svg
(Stored with Git LFS)
Normal file
BIN
static/ox-hugo/2022-09-13_22-14-26_Learning-How-does-a-CDN-work.svg
(Stored with Git LFS)
Normal file
Binary file not shown.
2
themes/cortex/.gitignore
vendored
Normal file
2
themes/cortex/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/node_modules/
|
||||
/.cache/
|
20
themes/cortex/LICENSE
Normal file
20
themes/cortex/LICENSE
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 YOUR_NAME_HERE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7
themes/cortex/README.org
Normal file
7
themes/cortex/README.org
Normal file
|
@ -0,0 +1,7 @@
|
|||
#+TITLE: Cortex Theme
|
||||
|
||||
Theme for my braindump. Currently largely copied from [[https://github.com/azlen/roam-themes][notes.azlen.me]].
|
||||
|
||||
** Search
|
||||
|
||||
In order for search to work, you must have a `/content/search/_index.md` file, so that `/search` is a valid url.
|
4
themes/cortex/archetypes/default.md
Normal file
4
themes/cortex/archetypes/default.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
+++
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
+++
|
360
themes/cortex/assets/css/main.css
Normal file
360
themes/cortex/assets/css/main.css
Normal file
|
@ -0,0 +1,360 @@
|
|||
/* @import url("https://rsms.me/inter/inter.css"); */
|
||||
|
||||
html,
|
||||
body {
|
||||
font-family: "Inter", sans-serif;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
background: #fafafc;
|
||||
line-height: 1.4;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@supports (font-variation-settings: normal) {
|
||||
html {
|
||||
font-family: "Inter var", sans-serif;
|
||||
}
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.7em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border-bottom: 1px #ccc solid;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.site-title {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#logo {
|
||||
display: inline-block;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
#logo svg {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow-x: auto !important;
|
||||
white-space: nowrap;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.grid {
|
||||
max-width: 100%;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.page {
|
||||
white-space: normal;
|
||||
background: #ffffff;
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.05);
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
max-width: 625px;
|
||||
height: 100% !important;
|
||||
max-height: 100%;
|
||||
overflow-y: auto;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wide {
|
||||
max-width: 1250px;
|
||||
}
|
||||
|
||||
.page:last-child {
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
color: rgba(10, 132, 255, 1);
|
||||
}
|
||||
|
||||
a.active {
|
||||
background-color: rgba(10, 132, 255, 0.15);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* === 外部链接加图标 ====*/
|
||||
a.external-link {border-bottom: 0px;}
|
||||
a.external-link:after {
|
||||
display:inline-block;
|
||||
content:"";
|
||||
width: 21px;
|
||||
height:16px;
|
||||
background:
|
||||
transparent
|
||||
50% 200%/54%
|
||||
url(/SWJ.png) no-repeat;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin-left: 1rem;
|
||||
font-style: italic;
|
||||
font-family: Georgia, bitstream charter, serif;
|
||||
border-left: 3px solid;
|
||||
border-left-color: currentcolor;
|
||||
border-color: var(--text-color);
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
overflow: auto;
|
||||
padding: 1em;
|
||||
margin: 1em auto;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table, td, th {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
#svg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
iframe {
|
||||
overflow: hidden;
|
||||
overflow-y: hidden;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.tippy-box > .tippy-arrow:before {
|
||||
transform: scale(2);
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~="light"] {
|
||||
color: #26323d;
|
||||
box-shadow: 0 0 20px 4px rgba(154, 161, 177, 0.15),
|
||||
0 4px 80px -8px rgba(36, 40, 47, 0.25),
|
||||
0 4px 4px -2px rgba(91, 94, 105, 0.15);
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~="light"][data-placement^="top"] > .tippy-arrow:before {
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~="light"][data-placement^="bottom"]
|
||||
> .tippy-arrow:before {
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~="light"][data-placement^="left"] > .tippy-arrow:before {
|
||||
border-left-color: #fff;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~="light"][data-placement^="right"] > .tippy-arrow:before {
|
||||
border-right-color: #fff;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~="light"] > .tippy-backdrop {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~="light"] > .tippy-svg-arrow {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.bl-section {
|
||||
padding: 2em 1em;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 0, 0, 0.25),
|
||||
rgba(0, 0, 0, 0.125),
|
||||
rgba(0, 0, 0, 0.25)
|
||||
)
|
||||
no-repeat 50% 1em / 100% 1px;
|
||||
}
|
||||
|
||||
.backlinks {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.bl-section h4 {
|
||||
color: #aaa;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.backlinks a {
|
||||
flex: 100%;
|
||||
color: rgba(10, 132, 255, 0.75);
|
||||
}
|
||||
|
||||
dl {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
margin: 1em 0;
|
||||
}
|
||||
dl > * {
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
|
||||
dt {
|
||||
width: 30%;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
dd {
|
||||
width: 60%;
|
||||
padding-left: 1em;
|
||||
margin-left: 0px;
|
||||
}
|
||||
dd + dd {
|
||||
width: 100%;
|
||||
padding-left: calc(30% + 1em);
|
||||
}
|
||||
dt + dt {
|
||||
padding-right: 60%;
|
||||
}
|
||||
dt + dt + dd {
|
||||
margin-top: -1.625em; /* own height including padding */
|
||||
padding-left: calc(30% + 1em);
|
||||
}
|
||||
|
||||
#search {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.search-extract {
|
||||
margin-left: 10px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.search-extract::before {
|
||||
content: " :: ";
|
||||
}
|
||||
|
||||
.svg-icon.search-icon {
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
|
||||
/* On hover: blue strokes */
|
||||
&:focus,
|
||||
&:hover {
|
||||
.search-path {
|
||||
stroke: #299ecc;
|
||||
}
|
||||
}
|
||||
|
||||
/* On click: thicker black strokes */
|
||||
&:active {
|
||||
.search-path {
|
||||
stroke: #111516;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
body {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
header {
|
||||
border-right-width: 0;
|
||||
border-bottom-width: 1px;
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
#logo {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#logo svg {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
header > * {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.page {
|
||||
padding-bottom: 150px;
|
||||
}
|
||||
|
||||
.search-extract {
|
||||
display: none;
|
||||
}
|
||||
}
|
117
themes/cortex/assets/js/URI.js
Normal file
117
themes/cortex/assets/js/URI.js
Normal file
|
@ -0,0 +1,117 @@
|
|||
/*! URI.js v1.19.2 http://medialize.github.io/URI.js/ */
|
||||
/* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js */
|
||||
/*
|
||||
URI.js - Mutating URLs
|
||||
IPv6 Support
|
||||
|
||||
Version: 1.19.2
|
||||
|
||||
Author: Rodney Rehm
|
||||
Web: http://medialize.github.io/URI.js/
|
||||
|
||||
Licensed under
|
||||
MIT License http://www.opensource.org/licenses/mit-license
|
||||
|
||||
https://mths.be/punycode v1.4.0 by @mathias URI.js - Mutating URLs
|
||||
Second Level Domain (SLD) Support
|
||||
|
||||
Version: 1.19.2
|
||||
|
||||
Author: Rodney Rehm
|
||||
Web: http://medialize.github.io/URI.js/
|
||||
|
||||
Licensed under
|
||||
MIT License http://www.opensource.org/licenses/mit-license
|
||||
|
||||
URI.js - Mutating URLs
|
||||
|
||||
Version: 1.19.2
|
||||
|
||||
Author: Rodney Rehm
|
||||
Web: http://medialize.github.io/URI.js/
|
||||
|
||||
Licensed under
|
||||
MIT License http://www.opensource.org/licenses/mit-license
|
||||
|
||||
*/
|
||||
(function(k,n){"object"===typeof module&&module.exports?module.exports=n():"function"===typeof define&&define.amd?define(n):k.IPv6=n(k)})(this,function(k){var n=k&&k.IPv6;return{best:function(l){l=l.toLowerCase().split(":");var h=l.length,c=8;""===l[0]&&""===l[1]&&""===l[2]?(l.shift(),l.shift()):""===l[0]&&""===l[1]?l.shift():""===l[h-1]&&""===l[h-2]&&l.pop();h=l.length;-1!==l[h-1].indexOf(".")&&(c=7);var m;for(m=0;m<h&&""!==l[m];m++);if(m<c)for(l.splice(m,1,"0000");l.length<c;)l.splice(m,0,"0000");
|
||||
for(m=0;m<c;m++){h=l[m].split("");for(var k=0;3>k;k++)if("0"===h[0]&&1<h.length)h.splice(0,1);else break;l[m]=h.join("")}h=-1;var p=k=0,n=-1,u=!1;for(m=0;m<c;m++)u?"0"===l[m]?p+=1:(u=!1,p>k&&(h=n,k=p)):"0"===l[m]&&(u=!0,n=m,p=1);p>k&&(h=n,k=p);1<k&&l.splice(h,k,"");h=l.length;c="";""===l[0]&&(c=":");for(m=0;m<h;m++){c+=l[m];if(m===h-1)break;c+=":"}""===l[h-1]&&(c+=":");return c},noConflict:function(){k.IPv6===this&&(k.IPv6=n);return this}}});
|
||||
(function(k){function n(c){throw new RangeError(H[c]);}function l(c,f){for(var h=c.length,m=[];h--;)m[h]=f(c[h]);return m}function h(c,f){var h=c.split("@"),m="";1<h.length&&(m=h[0]+"@",c=h[1]);c=c.replace(F,".");h=c.split(".");h=l(h,f).join(".");return m+h}function c(c){for(var f=[],h=0,m=c.length,l,a;h<m;)l=c.charCodeAt(h++),55296<=l&&56319>=l&&h<m?(a=c.charCodeAt(h++),56320==(a&64512)?f.push(((l&1023)<<10)+(a&1023)+65536):(f.push(l),h--)):f.push(l);return f}function m(c){return l(c,function(c){var f=
|
||||
"";65535<c&&(c-=65536,f+=q(c>>>10&1023|55296),c=56320|c&1023);return f+=q(c)}).join("")}function w(c,f){return c+22+75*(26>c)-((0!=f)<<5)}function p(c,h,m){var l=0;c=m?f(c/700):c>>1;for(c+=f(c/h);455<c;l+=36)c=f(c/35);return f(l+36*c/(c+38))}function D(c){var h=[],l=c.length,k=0,q=128,a=72,b,d;var e=c.lastIndexOf("-");0>e&&(e=0);for(b=0;b<e;++b)128<=c.charCodeAt(b)&&n("not-basic"),h.push(c.charCodeAt(b));for(e=0<e?e+1:0;e<l;){b=k;var g=1;for(d=36;;d+=36){e>=l&&n("invalid-input");var r=c.charCodeAt(e++);
|
||||
r=10>r-48?r-22:26>r-65?r-65:26>r-97?r-97:36;(36<=r||r>f((2147483647-k)/g))&&n("overflow");k+=r*g;var A=d<=a?1:d>=a+26?26:d-a;if(r<A)break;r=36-A;g>f(2147483647/r)&&n("overflow");g*=r}g=h.length+1;a=p(k-b,g,0==b);f(k/g)>2147483647-q&&n("overflow");q+=f(k/g);k%=g;h.splice(k++,0,q)}return m(h)}function u(h){var l,m,k,t=[];h=c(h);var a=h.length;var b=128;var d=0;var e=72;for(k=0;k<a;++k){var g=h[k];128>g&&t.push(q(g))}for((l=m=t.length)&&t.push("-");l<a;){var r=2147483647;for(k=0;k<a;++k)g=h[k],g>=b&&
|
||||
g<r&&(r=g);var A=l+1;r-b>f((2147483647-d)/A)&&n("overflow");d+=(r-b)*A;b=r;for(k=0;k<a;++k)if(g=h[k],g<b&&2147483647<++d&&n("overflow"),g==b){var y=d;for(r=36;;r+=36){g=r<=e?1:r>=e+26?26:r-e;if(y<g)break;var I=y-g;y=36-g;t.push(q(w(g+I%y,0)));y=f(I/y)}t.push(q(w(y,0)));e=p(d,A,l==m);d=0;++l}++d;++b}return t.join("")}var B="object"==typeof exports&&exports&&!exports.nodeType&&exports,C="object"==typeof module&&module&&!module.nodeType&&module,x="object"==typeof global&&global;if(x.global===x||x.window===
|
||||
x||x.self===x)k=x;var E=/^xn--/,z=/[^\x20-\x7E]/,F=/[\x2E\u3002\uFF0E\uFF61]/g,H={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,q=String.fromCharCode,t;var v={version:"1.3.2",ucs2:{decode:c,encode:m},decode:D,encode:u,toASCII:function(c){return h(c,function(c){return z.test(c)?"xn--"+u(c):c})},toUnicode:function(c){return h(c,function(c){return E.test(c)?D(c.slice(4).toLowerCase()):
|
||||
c})}};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return v});else if(B&&C)if(module.exports==B)C.exports=v;else for(t in v)v.hasOwnProperty(t)&&(B[t]=v[t]);else k.punycode=v})(this);
|
||||
(function(k,n){"object"===typeof module&&module.exports?module.exports=n():"function"===typeof define&&define.amd?define(n):k.SecondLevelDomains=n(k)})(this,function(k){var n=k&&k.SecondLevelDomains,l={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",
|
||||
bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",
|
||||
ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ","do":" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",
|
||||
es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",
|
||||
id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ","in":" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",
|
||||
kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",
|
||||
mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",
|
||||
ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",
|
||||
ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",
|
||||
tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",
|
||||
rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",
|
||||
tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",
|
||||
us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",
|
||||
org:"ae",de:"com "},has:function(h){var c=h.lastIndexOf(".");if(0>=c||c>=h.length-1)return!1;var k=h.lastIndexOf(".",c-1);if(0>=k||k>=c-1)return!1;var n=l.list[h.slice(c+1)];return n?0<=n.indexOf(" "+h.slice(k+1,c)+" "):!1},is:function(h){var c=h.lastIndexOf(".");if(0>=c||c>=h.length-1||0<=h.lastIndexOf(".",c-1))return!1;var k=l.list[h.slice(c+1)];return k?0<=k.indexOf(" "+h.slice(0,c)+" "):!1},get:function(h){var c=h.lastIndexOf(".");if(0>=c||c>=h.length-1)return null;var k=h.lastIndexOf(".",c-1);
|
||||
if(0>=k||k>=c-1)return null;var n=l.list[h.slice(c+1)];return!n||0>n.indexOf(" "+h.slice(k+1,c)+" ")?null:h.slice(k+1)},noConflict:function(){k.SecondLevelDomains===this&&(k.SecondLevelDomains=n);return this}};return l});
|
||||
(function(k,n){"object"===typeof module&&module.exports?module.exports=n(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"===typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],n):k.URI=n(k.punycode,k.IPv6,k.SecondLevelDomains,k)})(this,function(k,n,l,h){function c(a,b){var d=1<=arguments.length,e=2<=arguments.length;if(!(this instanceof c))return d?e?new c(a,b):new c(a):new c;if(void 0===a){if(d)throw new TypeError("undefined is not a valid argument for URI");
|
||||
a="undefined"!==typeof location?location.href+"":""}if(null===a&&d)throw new TypeError("null is not a valid argument for URI");this.href(a);return void 0!==b?this.absoluteTo(b):this}function m(a){return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function w(a){return void 0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}function p(a){return"Array"===w(a)}function D(a,b){var d={},c;if("RegExp"===w(b))d=null;else if(p(b)){var g=0;for(c=b.length;g<c;g++)d[b[g]]=!0}else d[b]=
|
||||
!0;g=0;for(c=a.length;g<c;g++)if(d&&void 0!==d[a[g]]||!d&&b.test(a[g]))a.splice(g,1),c--,g--;return a}function u(a,b){var d;if(p(b)){var c=0;for(d=b.length;c<d;c++)if(!u(a,b[c]))return!1;return!0}var g=w(b);c=0;for(d=a.length;c<d;c++)if("RegExp"===g){if("string"===typeof a[c]&&a[c].match(b))return!0}else if(a[c]===b)return!0;return!1}function B(a,b){if(!p(a)||!p(b)||a.length!==b.length)return!1;a.sort();b.sort();for(var d=0,c=a.length;d<c;d++)if(a[d]!==b[d])return!1;return!0}function C(a){return a.replace(/^\/+|\/+$/g,
|
||||
"")}function x(a){return escape(a)}function E(a){return encodeURIComponent(a).replace(/[!'()*]/g,x).replace(/\*/g,"%2A")}function z(a){return function(b,d){if(void 0===b)return this._parts[a]||"";this._parts[a]=b||null;this.build(!d);return this}}function F(a,b){return function(d,c){if(void 0===d)return this._parts[a]||"";null!==d&&(d+="",d.charAt(0)===b&&(d=d.substring(1)));this._parts[a]=d;this.build(!c);return this}}var H=h&&h.URI;c.version="1.19.2";var f=c.prototype,q=Object.prototype.hasOwnProperty;
|
||||
c._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:c.preventInvalidHostname,duplicateQueryParameters:c.duplicateQueryParameters,escapeQuerySpace:c.escapeQuerySpace}};c.preventInvalidHostname=!1;c.duplicateQueryParameters=!1;c.escapeQuerySpace=!0;c.protocol_expression=/^[a-z][a-z0-9.+-]*$/i;c.idn_expression=/[^a-z0-9\._-]/i;c.punycode_expression=/(xn--)/i;c.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
|
||||
c.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
|
||||
c.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/ig;c.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g};c.defaultPorts={http:"80",https:"443",ftp:"21",
|
||||
gopher:"70",ws:"80",wss:"443"};c.hostProtocols=["http","https"];c.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/;c.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"};c.getDomAttribute=function(a){if(a&&a.nodeName){var b=a.nodeName.toLowerCase();if("input"!==b||"image"===a.type)return c.domAttributes[b]}};c.encode=E;c.decode=decodeURIComponent;c.iso8859=
|
||||
function(){c.encode=escape;c.decode=unescape};c.unicode=function(){c.encode=E;c.decode=decodeURIComponent};c.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@",
|
||||
"%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}};c.encodeQuery=function(a,b){var d=c.encode(a+"");void 0===b&&(b=c.escapeQuerySpace);return b?d.replace(/%20/g,"+"):d};c.decodeQuery=
|
||||
function(a,b){a+="";void 0===b&&(b=c.escapeQuerySpace);try{return c.decode(b?a.replace(/\+/g,"%20"):a)}catch(d){return a}};var t={encode:"encode",decode:"decode"},v,G=function(a,b){return function(d){try{return c[b](d+"").replace(c.characters[a][b].expression,function(d){return c.characters[a][b].map[d]})}catch(e){return d}}};for(v in t)c[v+"PathSegment"]=G("pathname",t[v]),c[v+"UrnPathSegment"]=G("urnpath",t[v]);t=function(a,b,d){return function(e){var g=d?function(a){return c[b](c[d](a))}:c[b];
|
||||
e=(e+"").split(a);for(var f=0,h=e.length;f<h;f++)e[f]=g(e[f]);return e.join(a)}};c.decodePath=t("/","decodePathSegment");c.decodeUrnPath=t(":","decodeUrnPathSegment");c.recodePath=t("/","encodePathSegment","decode");c.recodeUrnPath=t(":","encodeUrnPathSegment","decode");c.encodeReserved=G("reserved","encode");c.parse=function(a,b){b||(b={preventInvalidHostname:c.preventInvalidHostname});var d=a.indexOf("#");-1<d&&(b.fragment=a.substring(d+1)||null,a=a.substring(0,d));d=a.indexOf("?");-1<d&&(b.query=
|
||||
a.substring(d+1)||null,a=a.substring(0,d));"//"===a.substring(0,2)?(b.protocol=null,a=a.substring(2),a=c.parseAuthority(a,b)):(d=a.indexOf(":"),-1<d&&(b.protocol=a.substring(0,d)||null,b.protocol&&!b.protocol.match(c.protocol_expression)?b.protocol=void 0:"//"===a.substring(d+1,d+3)?(a=a.substring(d+3),a=c.parseAuthority(a,b)):(a=a.substring(d+1),b.urn=!0)));b.path=a;return b};c.parseHost=function(a,b){a||(a="");a=a.replace(/\\/g,"/");var d=a.indexOf("/");-1===d&&(d=a.length);if("["===a.charAt(0)){var e=
|
||||
a.indexOf("]");b.hostname=a.substring(1,e)||null;b.port=a.substring(e+2,d)||null;"/"===b.port&&(b.port=null)}else{var g=a.indexOf(":");e=a.indexOf("/");g=a.indexOf(":",g+1);-1!==g&&(-1===e||g<e)?(b.hostname=a.substring(0,d)||null,b.port=null):(e=a.substring(0,d).split(":"),b.hostname=e[0]||null,b.port=e[1]||null)}b.hostname&&"/"!==a.substring(d).charAt(0)&&(d++,a="/"+a);b.preventInvalidHostname&&c.ensureValidHostname(b.hostname,b.protocol);b.port&&c.ensureValidPort(b.port);return a.substring(d)||
|
||||
"/"};c.parseAuthority=function(a,b){a=c.parseUserinfo(a,b);return c.parseHost(a,b)};c.parseUserinfo=function(a,b){var d=a.indexOf("/"),e=a.lastIndexOf("@",-1<d?d:a.length-1);-1<e&&(-1===d||e<d)?(d=a.substring(0,e).split(":"),b.username=d[0]?c.decode(d[0]):null,d.shift(),b.password=d[0]?c.decode(d.join(":")):null,a=a.substring(e+1)):(b.username=null,b.password=null);return a};c.parseQuery=function(a,b){if(!a)return{};a=a.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"");if(!a)return{};for(var d={},e=a.split("&"),
|
||||
g=e.length,f,h,k=0;k<g;k++)if(f=e[k].split("="),h=c.decodeQuery(f.shift(),b),f=f.length?c.decodeQuery(f.join("="),b):null,q.call(d,h)){if("string"===typeof d[h]||null===d[h])d[h]=[d[h]];d[h].push(f)}else d[h]=f;return d};c.build=function(a){var b="",d=!1;a.protocol&&(b+=a.protocol+":");a.urn||!b&&!a.hostname||(b+="//",d=!0);b+=c.buildAuthority(a)||"";"string"===typeof a.path&&("/"!==a.path.charAt(0)&&d&&(b+="/"),b+=a.path);"string"===typeof a.query&&a.query&&(b+="?"+a.query);"string"===typeof a.fragment&&
|
||||
a.fragment&&(b+="#"+a.fragment);return b};c.buildHost=function(a){var b="";if(a.hostname)b=c.ip6_expression.test(a.hostname)?b+("["+a.hostname+"]"):b+a.hostname;else return"";a.port&&(b+=":"+a.port);return b};c.buildAuthority=function(a){return c.buildUserinfo(a)+c.buildHost(a)};c.buildUserinfo=function(a){var b="";a.username&&(b+=c.encode(a.username));a.password&&(b+=":"+c.encode(a.password));b&&(b+="@");return b};c.buildQuery=function(a,b,d){var e="",g,f;for(g in a)if(q.call(a,g))if(p(a[g])){var h=
|
||||
{};var k=0;for(f=a[g].length;k<f;k++)void 0!==a[g][k]&&void 0===h[a[g][k]+""]&&(e+="&"+c.buildQueryParameter(g,a[g][k],d),!0!==b&&(h[a[g][k]+""]=!0))}else void 0!==a[g]&&(e+="&"+c.buildQueryParameter(g,a[g],d));return e.substring(1)};c.buildQueryParameter=function(a,b,d){return c.encodeQuery(a,d)+(null!==b?"="+c.encodeQuery(b,d):"")};c.addQuery=function(a,b,d){if("object"===typeof b)for(var e in b)q.call(b,e)&&c.addQuery(a,e,b[e]);else if("string"===typeof b)void 0===a[b]?a[b]=d:("string"===typeof a[b]&&
|
||||
(a[b]=[a[b]]),p(d)||(d=[d]),a[b]=(a[b]||[]).concat(d));else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");};c.setQuery=function(a,b,d){if("object"===typeof b)for(var e in b)q.call(b,e)&&c.setQuery(a,e,b[e]);else if("string"===typeof b)a[b]=void 0===d?null:d;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");};c.removeQuery=function(a,b,d){var e;if(p(b))for(d=0,e=b.length;d<e;d++)a[b[d]]=void 0;else if("RegExp"===w(b))for(e in a)b.test(e)&&
|
||||
(a[e]=void 0);else if("object"===typeof b)for(e in b)q.call(b,e)&&c.removeQuery(a,e,b[e]);else if("string"===typeof b)void 0!==d?"RegExp"===w(d)?!p(a[b])&&d.test(a[b])?a[b]=void 0:a[b]=D(a[b],d):a[b]!==String(d)||p(d)&&1!==d.length?p(a[b])&&(a[b]=D(a[b],d)):a[b]=void 0:a[b]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");};c.hasQuery=function(a,b,d,e){switch(w(b)){case "String":break;case "RegExp":for(var g in a)if(q.call(a,g)&&b.test(g)&&
|
||||
(void 0===d||c.hasQuery(a,g,d)))return!0;return!1;case "Object":for(var f in b)if(q.call(b,f)&&!c.hasQuery(a,f,b[f]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter");}switch(w(d)){case "Undefined":return b in a;case "Boolean":return a=!(p(a[b])?!a[b].length:!a[b]),d===a;case "Function":return!!d(a[b],b,a);case "Array":return p(a[b])?(e?u:B)(a[b],d):!1;case "RegExp":return p(a[b])?e?u(a[b],d):!1:!(!a[b]||!a[b].match(d));
|
||||
case "Number":d=String(d);case "String":return p(a[b])?e?u(a[b],d):!1:a[b]===d;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");}};c.joinPaths=function(){for(var a=[],b=[],d=0,e=0;e<arguments.length;e++){var g=new c(arguments[e]);a.push(g);g=g.segment();for(var f=0;f<g.length;f++)"string"===typeof g[f]&&b.push(g[f]),g[f]&&d++}if(!b.length||!d)return new c("");b=(new c("")).segment(b);""!==a[0].path()&&"/"!==a[0].path().slice(0,
|
||||
1)||b.path("/"+b.path());return b.normalize()};c.commonPath=function(a,b){var d=Math.min(a.length,b.length),c;for(c=0;c<d;c++)if(a.charAt(c)!==b.charAt(c)){c--;break}if(1>c)return a.charAt(0)===b.charAt(0)&&"/"===a.charAt(0)?"/":"";if("/"!==a.charAt(c)||"/"!==b.charAt(c))c=a.substring(0,c).lastIndexOf("/");return a.substring(0,c+1)};c.withinString=function(a,b,d){d||(d={});var e=d.start||c.findUri.start,g=d.end||c.findUri.end,f=d.trim||c.findUri.trim,h=d.parens||c.findUri.parens,k=/[a-z0-9-]=["']?$/i;
|
||||
for(e.lastIndex=0;;){var l=e.exec(a);if(!l)break;var m=l.index;if(d.ignoreHtml){var n=a.slice(Math.max(m-3,0),m);if(n&&k.test(n))continue}var p=m+a.slice(m).search(g);n=a.slice(m,p);for(p=-1;;){var q=h.exec(n);if(!q)break;p=Math.max(p,q.index+q[0].length)}n=-1<p?n.slice(0,p)+n.slice(p).replace(f,""):n.replace(f,"");n.length<=l[0].length||d.ignore&&d.ignore.test(n)||(p=m+n.length,l=b(n,m,p,a),void 0===l?e.lastIndex=p:(l=String(l),a=a.slice(0,m)+l+a.slice(p),e.lastIndex=m+l.length))}e.lastIndex=0;return a};
|
||||
c.ensureValidHostname=function(a,b){var d=!!a,e=!1;b&&(e=u(c.hostProtocols,b));if(e&&!d)throw new TypeError("Hostname cannot be empty, if protocol is "+b);if(a&&a.match(c.invalid_hostname_characters)){if(!k)throw new TypeError('Hostname "'+a+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(k.toASCII(a).match(c.invalid_hostname_characters))throw new TypeError('Hostname "'+a+'" contains characters other than [A-Z0-9.-:_]');}};c.ensureValidPort=function(a){if(a){var b=
|
||||
Number(a);if(!(/^[0-9]+$/.test(b)&&0<b&&65536>b))throw new TypeError('Port "'+a+'" is not a valid port');}};c.noConflict=function(a){if(a)return a={URI:this.noConflict()},h.URITemplate&&"function"===typeof h.URITemplate.noConflict&&(a.URITemplate=h.URITemplate.noConflict()),h.IPv6&&"function"===typeof h.IPv6.noConflict&&(a.IPv6=h.IPv6.noConflict()),h.SecondLevelDomains&&"function"===typeof h.SecondLevelDomains.noConflict&&(a.SecondLevelDomains=h.SecondLevelDomains.noConflict()),a;h.URI===this&&(h.URI=
|
||||
H);return this};f.build=function(a){if(!0===a)this._deferred_build=!0;else if(void 0===a||this._deferred_build)this._string=c.build(this._parts),this._deferred_build=!1;return this};f.clone=function(){return new c(this)};f.valueOf=f.toString=function(){return this.build(!1)._string};f.protocol=z("protocol");f.username=z("username");f.password=z("password");f.hostname=z("hostname");f.port=z("port");f.query=F("query","?");f.fragment=F("fragment","#");f.search=function(a,b){var d=this.query(a,b);return"string"===
|
||||
typeof d&&d.length?"?"+d:d};f.hash=function(a,b){var d=this.fragment(a,b);return"string"===typeof d&&d.length?"#"+d:d};f.pathname=function(a,b){if(void 0===a||!0===a){var d=this._parts.path||(this._parts.hostname?"/":"");return a?(this._parts.urn?c.decodeUrnPath:c.decodePath)(d):d}this._parts.path=this._parts.urn?a?c.recodeUrnPath(a):"":a?c.recodePath(a):"/";this.build(!b);return this};f.path=f.pathname;f.href=function(a,b){var d;if(void 0===a)return this.toString();this._string="";this._parts=c._parts();
|
||||
var e=a instanceof c,g="object"===typeof a&&(a.hostname||a.path||a.pathname);a.nodeName&&(g=c.getDomAttribute(a),a=a[g]||"",g=!1);!e&&g&&void 0!==a.pathname&&(a=a.toString());if("string"===typeof a||a instanceof String)this._parts=c.parse(String(a),this._parts);else if(e||g){e=e?a._parts:a;for(d in e)"query"!==d&&q.call(this._parts,d)&&(this._parts[d]=e[d]);e.query&&this.query(e.query,!1)}else throw new TypeError("invalid input");this.build(!b);return this};f.is=function(a){var b=!1,d=!1,e=!1,g=!1,
|
||||
f=!1,h=!1,k=!1,m=!this._parts.urn;this._parts.hostname&&(m=!1,d=c.ip4_expression.test(this._parts.hostname),e=c.ip6_expression.test(this._parts.hostname),b=d||e,f=(g=!b)&&l&&l.has(this._parts.hostname),h=g&&c.idn_expression.test(this._parts.hostname),k=g&&c.punycode_expression.test(this._parts.hostname));switch(a.toLowerCase()){case "relative":return m;case "absolute":return!m;case "domain":case "name":return g;case "sld":return f;case "ip":return b;case "ip4":case "ipv4":case "inet4":return d;case "ip6":case "ipv6":case "inet6":return e;
|
||||
case "idn":return h;case "url":return!this._parts.urn;case "urn":return!!this._parts.urn;case "punycode":return k}return null};var J=f.protocol,K=f.port,L=f.hostname;f.protocol=function(a,b){if(a&&(a=a.replace(/:(\/\/)?$/,""),!a.match(c.protocol_expression)))throw new TypeError('Protocol "'+a+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return J.call(this,a,b)};f.scheme=f.protocol;f.port=function(a,b){if(this._parts.urn)return void 0===a?"":this;void 0!==a&&(0===a&&
|
||||
(a=null),a&&(a+="",":"===a.charAt(0)&&(a=a.substring(1)),c.ensureValidPort(a)));return K.call(this,a,b)};f.hostname=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a){var d={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==c.parseHost(a,d))throw new TypeError('Hostname "'+a+'" contains characters other than [A-Z0-9.-]');a=d.hostname;this._parts.preventInvalidHostname&&c.ensureValidHostname(a,this._parts.protocol)}return L.call(this,a,b)};f.origin=function(a,
|
||||
b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){var d=this.protocol();return this.authority()?(d?d+"://":"")+this.authority():""}d=c(a);this.protocol(d.protocol()).authority(d.authority()).build(!b);return this};f.host=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?c.buildHost(this._parts):"";if("/"!==c.parseHost(a,this._parts))throw new TypeError('Hostname "'+a+'" contains characters other than [A-Z0-9.-]');this.build(!b);return this};
|
||||
f.authority=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a)return this._parts.hostname?c.buildAuthority(this._parts):"";if("/"!==c.parseAuthority(a,this._parts))throw new TypeError('Hostname "'+a+'" contains characters other than [A-Z0-9.-]');this.build(!b);return this};f.userinfo=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){var d=c.buildUserinfo(this._parts);return d?d.substring(0,d.length-1):d}"@"!==a[a.length-1]&&(a+="@");c.parseUserinfo(a,
|
||||
this._parts);this.build(!b);return this};f.resource=function(a,b){if(void 0===a)return this.path()+this.search()+this.hash();var d=c.parse(a);this._parts.path=d.path;this._parts.query=d.query;this._parts.fragment=d.fragment;this.build(!b);return this};f.subdomain=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,d)||""}d=this._parts.hostname.length-
|
||||
this.domain().length;d=this._parts.hostname.substring(0,d);d=new RegExp("^"+m(d));a&&"."!==a.charAt(a.length-1)&&(a+=".");if(-1!==a.indexOf(":"))throw new TypeError("Domains cannot contain colons");a&&c.ensureValidHostname(a,this._parts.protocol);this._parts.hostname=this._parts.hostname.replace(d,a);this.build(!b);return this};f.domain=function(a,b){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(b=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=
|
||||
this._parts.hostname.match(/\./g);if(d&&2>d.length)return this._parts.hostname;d=this._parts.hostname.length-this.tld(b).length-1;d=this._parts.hostname.lastIndexOf(".",d-1)+1;return this._parts.hostname.substring(d)||""}if(!a)throw new TypeError("cannot set domain empty");if(-1!==a.indexOf(":"))throw new TypeError("Domains cannot contain colons");c.ensureValidHostname(a,this._parts.protocol);!this._parts.hostname||this.is("IP")?this._parts.hostname=a:(d=new RegExp(m(this.domain())+"$"),this._parts.hostname=
|
||||
this._parts.hostname.replace(d,a));this.build(!b);return this};f.tld=function(a,b){if(this._parts.urn)return void 0===a?"":this;"boolean"===typeof a&&(b=a,a=void 0);if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.lastIndexOf(".");d=this._parts.hostname.substring(d+1);return!0!==b&&l&&l.list[d.toLowerCase()]?l.get(this._parts.hostname)||d:d}if(a)if(a.match(/[^a-zA-Z0-9-]/))if(l&&l.is(a))d=new RegExp(m(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(d,
|
||||
a);else throw new TypeError('TLD "'+a+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");d=new RegExp(m(this.tld())+"$");this._parts.hostname=this._parts.hostname.replace(d,a)}else throw new TypeError("cannot set TLD empty");this.build(!b);return this};f.directory=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return"";
|
||||
if("/"===this._parts.path)return"/";var d=this._parts.path.length-this.filename().length-1;d=this._parts.path.substring(0,d)||(this._parts.hostname?"/":"");return a?c.decodePath(d):d}d=this._parts.path.length-this.filename().length;d=this._parts.path.substring(0,d);d=new RegExp("^"+m(d));this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a));a&&"/"!==a.charAt(a.length-1)&&(a+="/");a=c.recodePath(a);this._parts.path=this._parts.path.replace(d,a);this.build(!b);return this};f.filename=function(a,
|
||||
b){if(this._parts.urn)return void 0===a?"":this;if("string"!==typeof a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this._parts.path.lastIndexOf("/");d=this._parts.path.substring(d+1);return a?c.decodePathSegment(d):d}d=!1;"/"===a.charAt(0)&&(a=a.substring(1));a.match(/\.?\//)&&(d=!0);var e=new RegExp(m(this.filename())+"$");a=c.recodePath(a);this._parts.path=this._parts.path.replace(e,a);d?this.normalizePath(b):this.build(!b);return this};f.suffix=function(a,b){if(this._parts.urn)return void 0===
|
||||
a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var d=this.filename(),e=d.lastIndexOf(".");if(-1===e)return"";d=d.substring(e+1);d=/^[a-z0-9%]+$/i.test(d)?d:"";return a?c.decodePathSegment(d):d}"."===a.charAt(0)&&(a=a.substring(1));if(d=this.suffix())e=a?new RegExp(m(d)+"$"):new RegExp(m("."+d)+"$");else{if(!a)return this;this._parts.path+="."+c.recodePath(a)}e&&(a=c.recodePath(a),this._parts.path=this._parts.path.replace(e,a));this.build(!b);return this};f.segment=
|
||||
function(a,b,d){var c=this._parts.urn?":":"/",g=this.path(),f="/"===g.substring(0,1);g=g.split(c);void 0!==a&&"number"!==typeof a&&(d=b,b=a,a=void 0);if(void 0!==a&&"number"!==typeof a)throw Error('Bad segment "'+a+'", must be 0-based integer');f&&g.shift();0>a&&(a=Math.max(g.length+a,0));if(void 0===b)return void 0===a?g:g[a];if(null===a||void 0===g[a])if(p(b)){g=[];a=0;for(var h=b.length;a<h;a++)if(b[a].length||g.length&&g[g.length-1].length)g.length&&!g[g.length-1].length&&g.pop(),g.push(C(b[a]))}else{if(b||
|
||||
"string"===typeof b)b=C(b),""===g[g.length-1]?g[g.length-1]=b:g.push(b)}else b?g[a]=C(b):g.splice(a,1);f&&g.unshift("");return this.path(g.join(c),d)};f.segmentCoded=function(a,b,d){var e;"number"!==typeof a&&(d=b,b=a,a=void 0);if(void 0===b){a=this.segment(a,b,d);if(p(a)){var g=0;for(e=a.length;g<e;g++)a[g]=c.decode(a[g])}else a=void 0!==a?c.decode(a):void 0;return a}if(p(b))for(g=0,e=b.length;g<e;g++)b[g]=c.encode(b[g]);else b="string"===typeof b||b instanceof String?c.encode(b):b;return this.segment(a,
|
||||
b,d)};var M=f.query;f.query=function(a,b){if(!0===a)return c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"===typeof a){var d=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace),e=a.call(this,d);this._parts.query=c.buildQuery(e||d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);this.build(!b);return this}return void 0!==a&&"string"!==typeof a?(this._parts.query=c.buildQuery(a,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),
|
||||
this):M.call(this,a,b)};f.setQuery=function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"===typeof a||a instanceof String)e[a]=void 0!==b?b:null;else if("object"===typeof a)for(var g in a)q.call(a,g)&&(e[g]=a[g]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");this._parts.query=c.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=b);this.build(!d);return this};f.addQuery=
|
||||
function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);c.addQuery(e,a,void 0===b?null:b);this._parts.query=c.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==typeof a&&(d=b);this.build(!d);return this};f.removeQuery=function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);c.removeQuery(e,a,b);this._parts.query=c.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace);"string"!==
|
||||
typeof a&&(d=b);this.build(!d);return this};f.hasQuery=function(a,b,d){var e=c.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return c.hasQuery(e,a,b,d)};f.setSearch=f.setQuery;f.addSearch=f.addQuery;f.removeSearch=f.removeQuery;f.hasSearch=f.hasQuery;f.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()};
|
||||
f.normalizeProtocol=function(a){"string"===typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!a));return this};f.normalizeHostname=function(a){this._parts.hostname&&(this.is("IDN")&&k?this._parts.hostname=k.toASCII(this._parts.hostname):this.is("IPv6")&&n&&(this._parts.hostname=n.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!a));return this};f.normalizePort=function(a){"string"===typeof this._parts.protocol&&
|
||||
this._parts.port===c.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!a));return this};f.normalizePath=function(a){var b=this._parts.path;if(!b)return this;if(this._parts.urn)return this._parts.path=c.recodeUrnPath(this._parts.path),this.build(!a),this;if("/"===this._parts.path)return this;b=c.recodePath(b);var d="";if("/"!==b.charAt(0)){var e=!0;b="/"+b}if("/.."===b.slice(-3)||"/."===b.slice(-2))b+="/";b=b.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/");e&&(d=b.substring(1).match(/^(\.\.\/)+/)||
|
||||
"")&&(d=d[0]);for(;;){var g=b.search(/\/\.\.(\/|$)/);if(-1===g)break;else if(0===g){b=b.substring(3);continue}var f=b.substring(0,g).lastIndexOf("/");-1===f&&(f=g);b=b.substring(0,f)+b.substring(g+3)}e&&this.is("relative")&&(b=d+b.substring(1));this._parts.path=b;this.build(!a);return this};f.normalizePathname=f.normalizePath;f.normalizeQuery=function(a){"string"===typeof this._parts.query&&(this._parts.query.length?this.query(c.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=
|
||||
null,this.build(!a));return this};f.normalizeFragment=function(a){this._parts.fragment||(this._parts.fragment=null,this.build(!a));return this};f.normalizeSearch=f.normalizeQuery;f.normalizeHash=f.normalizeFragment;f.iso8859=function(){var a=c.encode,b=c.decode;c.encode=escape;c.decode=decodeURIComponent;try{this.normalize()}finally{c.encode=a,c.decode=b}return this};f.unicode=function(){var a=c.encode,b=c.decode;c.encode=E;c.decode=unescape;try{this.normalize()}finally{c.encode=a,c.decode=b}return this};
|
||||
f.readable=function(){var a=this.clone();a.username("").password("").normalize();var b="";a._parts.protocol&&(b+=a._parts.protocol+"://");a._parts.hostname&&(a.is("punycode")&&k?(b+=k.toUnicode(a._parts.hostname),a._parts.port&&(b+=":"+a._parts.port)):b+=a.host());a._parts.hostname&&a._parts.path&&"/"!==a._parts.path.charAt(0)&&(b+="/");b+=a.path(!0);if(a._parts.query){for(var d="",e=0,g=a._parts.query.split("&"),f=g.length;e<f;e++){var h=(g[e]||"").split("=");d+="&"+c.decodeQuery(h[0],this._parts.escapeQuerySpace).replace(/&/g,
|
||||
"%26");void 0!==h[1]&&(d+="="+c.decodeQuery(h[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}b+="?"+d.substring(1)}return b+=c.decodeQuery(a.hash(),!0)};f.absoluteTo=function(a){var b=this.clone(),d=["protocol","username","password","hostname","port"],e,g;if(this._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a instanceof c||(a=new c(a));if(b._parts.protocol)return b;b._parts.protocol=a._parts.protocol;if(this._parts.hostname)return b;for(e=0;g=d[e];e++)b._parts[g]=
|
||||
a._parts[g];b._parts.path?(".."===b._parts.path.substring(-2)&&(b._parts.path+="/"),"/"!==b.path().charAt(0)&&(d=(d=a.directory())?d:0===a.path().indexOf("/")?"/":"",b._parts.path=(d?d+"/":"")+b._parts.path,b.normalizePath())):(b._parts.path=a._parts.path,b._parts.query||(b._parts.query=a._parts.query));b.build();return b};f.relativeTo=function(a){var b=this.clone().normalize();if(b._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");a=(new c(a)).normalize();var d=
|
||||
b._parts;var e=a._parts;var g=b.path();a=a.path();if("/"!==g.charAt(0))throw Error("URI is already relative");if("/"!==a.charAt(0))throw Error("Cannot calculate a URI relative to another relative URI");d.protocol===e.protocol&&(d.protocol=null);if(d.username===e.username&&d.password===e.password&&null===d.protocol&&null===d.username&&null===d.password&&d.hostname===e.hostname&&d.port===e.port)d.hostname=null,d.port=null;else return b.build();if(g===a)return d.path="",b.build();g=c.commonPath(g,a);
|
||||
if(!g)return b.build();e=e.path.substring(g.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");d.path=e+d.path.substring(g.length)||"./";return b.build()};f.equals=function(a){var b=this.clone(),d=new c(a);a={};var e;b.normalize();d.normalize();if(b.toString()===d.toString())return!0;var g=b.query();var f=d.query();b.query("");d.query("");if(b.toString()!==d.toString()||g.length!==f.length)return!1;b=c.parseQuery(g,this._parts.escapeQuerySpace);f=c.parseQuery(f,this._parts.escapeQuerySpace);for(e in b)if(q.call(b,
|
||||
e)){if(!p(b[e])){if(b[e]!==f[e])return!1}else if(!B(b[e],f[e]))return!1;a[e]=!0}for(e in f)if(q.call(f,e)&&!a[e])return!1;return!0};f.preventInvalidHostname=function(a){this._parts.preventInvalidHostname=!!a;return this};f.duplicateQueryParameters=function(a){this._parts.duplicateQueryParameters=!!a;return this};f.escapeQuerySpace=function(a){this._parts.escapeQuerySpace=!!a;return this};return c});
|
61
themes/cortex/assets/js/full-text-search.js
Normal file
61
themes/cortex/assets/js/full-text-search.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
; (async function() {
|
||||
const encoder = (str) => str.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/)
|
||||
const contentIndex = new FlexSearch.Document({
|
||||
cache: true,
|
||||
charset: "latin:extra",
|
||||
optimize: true,
|
||||
index: [
|
||||
{
|
||||
field: "content",
|
||||
tokenize: "reverse",
|
||||
encode: encoder,
|
||||
},
|
||||
{
|
||||
field: "title",
|
||||
tokenize: "forward",
|
||||
encode: encoder,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const { content } = await fetchData
|
||||
for (const [key, value] of Object.entries(content)) {
|
||||
contentIndex.add({
|
||||
id: key,
|
||||
title: value.title,
|
||||
content: removeMarkdown(value.content),
|
||||
})
|
||||
}
|
||||
|
||||
const formatForDisplay = (id) => ({
|
||||
id,
|
||||
url: id,
|
||||
title: content[id].title,
|
||||
content: content[id].content,
|
||||
})
|
||||
|
||||
registerHandlers((e) => {
|
||||
term = e.target.value
|
||||
const searchResults = contentIndex.search(term, [
|
||||
{
|
||||
field: "content",
|
||||
limit: 10,
|
||||
},
|
||||
{
|
||||
field: "title",
|
||||
limit: 5,
|
||||
},
|
||||
])
|
||||
const getByField = (field) => {
|
||||
const results = searchResults.filter((x) => x.field === field)
|
||||
if (results.length === 0) {
|
||||
return []
|
||||
} else {
|
||||
return [...results[0].result]
|
||||
}
|
||||
}
|
||||
const allIds = new Set([...getByField("title"), ...getByField("content")])
|
||||
const finalResults = [...allIds].map(formatForDisplay)
|
||||
displayResults(finalResults, true)
|
||||
})
|
||||
})()
|
9
themes/cortex/assets/js/fuse.min.js
vendored
Normal file
9
themes/cortex/assets/js/fuse.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
themes/cortex/assets/js/lunr.min.js
vendored
Normal file
1
themes/cortex/assets/js/lunr.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
218
themes/cortex/assets/js/page.js
Normal file
218
themes/cortex/assets/js/page.js
Normal file
|
@ -0,0 +1,218 @@
|
|||
let pages = [window.location.pathname];
|
||||
let switchDirectionWindowWidth = 900;
|
||||
let animationLength = 200;
|
||||
let isso_onload_init = false;
|
||||
|
||||
function stackNote(href, level) {
|
||||
level = Number(level) || pages.length;
|
||||
uri = URI(window.location);
|
||||
stacks = [];
|
||||
if (uri.hasQuery("stack")) {
|
||||
stacks = uri.query(true).stack;
|
||||
if (!Array.isArray(stacks)) {
|
||||
stacks = [stacks];
|
||||
}
|
||||
stacks = stacks.slice(0, level - 1);
|
||||
}
|
||||
stacks.push(URI(href).suffix("").path());
|
||||
uri.setQuery("stack", stacks);
|
||||
|
||||
old_stacks = stacks.slice(0, level - 1);
|
||||
state = { stacks: old_stacks, level: level };
|
||||
window.history.pushState(state, "", uri.href());
|
||||
}
|
||||
|
||||
function unstackNotes(level) {
|
||||
let container = document.querySelector(".grid");
|
||||
let children = Array.prototype.slice.call(container.children);
|
||||
|
||||
for (let i = level; i < pages.length; i++) {
|
||||
container.removeChild(children[i]);
|
||||
destroyPreviews(children[i]);
|
||||
}
|
||||
pages = pages.slice(0, level);
|
||||
}
|
||||
|
||||
function fetchNote(href, level, animate = false) {
|
||||
if (pages.indexOf(URI(href).path()) > -1) return;
|
||||
isso_del = (pages.length == level);
|
||||
|
||||
level = Number(level) || pages.length;
|
||||
const request = new Request(href);
|
||||
fetch(request)
|
||||
.then((response) => response.text())
|
||||
.then((text) => {
|
||||
unstackNotes(level);
|
||||
let container = document.querySelector(".grid");
|
||||
let fragment = document.createElement("template");
|
||||
fragment.innerHTML = text;
|
||||
document.querySelectorAll(".comment").forEach(el => el.remove());
|
||||
let element = fragment.content.querySelector(".page");
|
||||
container.appendChild(element);
|
||||
pages.push(URI(href).path());
|
||||
|
||||
setTimeout(
|
||||
function (element, level) {
|
||||
element.dataset.level = level + 1;
|
||||
initializePreviews(element, level + 1);
|
||||
|
||||
href = URI(href);
|
||||
if (href.fragment() !== "") {
|
||||
document.getElementById(decodeURI(href.fragment())).scrollIntoView();
|
||||
} else {
|
||||
element.scrollIntoView();
|
||||
}
|
||||
|
||||
// if (animate) {
|
||||
// element.animate([{ opacity: 0 }, { opacity: 1 }], animationLength);
|
||||
// }
|
||||
|
||||
if (isso_onload_init) {
|
||||
window.Isso.init();
|
||||
window.Isso.fetchComments();
|
||||
}
|
||||
|
||||
if (window.MathJax) {
|
||||
window.MathJax.typeset();
|
||||
}
|
||||
}.bind(null, element, level),
|
||||
10
|
||||
);
|
||||
|
||||
updateLinkStatuses();
|
||||
});
|
||||
}
|
||||
|
||||
function updateLinkStatuses() {
|
||||
links = Array.prototype.slice.call(document.querySelectorAll("a"));
|
||||
links.forEach(function (link) {
|
||||
if (pages.indexOf(link.getAttribute("href")) > -1) {
|
||||
link.classList.add("active");
|
||||
if (link._tippy) link._tippy.disable();
|
||||
} else {
|
||||
link.classList.remove("active");
|
||||
if (link._tippy) link._tippy.enable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function destroyPreviews(page) {
|
||||
links = Array.prototype.slice.call(page.querySelectorAll("a"));
|
||||
links.forEach(function (link) {
|
||||
if (link.hasOwnProperty("_tippy")) {
|
||||
link._tippy.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let tippyOptions = {
|
||||
allowHTML: true,
|
||||
theme: "light",
|
||||
interactive: true,
|
||||
interactiveBorder: 10,
|
||||
delay: 500,
|
||||
touch: ["hold", 500],
|
||||
maxWidth: "none",
|
||||
inlinePositioning: false,
|
||||
placement: "right",
|
||||
};
|
||||
|
||||
function createPreview(link, html, overrideOptions) {
|
||||
level = Number(link.dataset.level);
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.width = "400px";
|
||||
iframe.height = "300px";
|
||||
iframe.srcdoc = html;
|
||||
tip = tippy(
|
||||
link,
|
||||
Object.assign(
|
||||
{},
|
||||
tippyOptions,
|
||||
{
|
||||
content: iframe.outerHTML
|
||||
// '<iframe width="400px" height="300px" srcdoc="' +
|
||||
// escape(html) +
|
||||
// '"></iframe>',
|
||||
},
|
||||
overrideOptions
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function initializePreviews(page, level) {
|
||||
level = level || pages.length;
|
||||
|
||||
links = Array.prototype.slice.call(page.querySelectorAll("a:not(.rooter)"));
|
||||
|
||||
links.forEach(async function (element) {
|
||||
var rawHref = element.getAttribute("href");
|
||||
element.dataset.level = level;
|
||||
|
||||
if (rawHref === "") {
|
||||
rawHref = "/posts/404/"
|
||||
element.href = "/posts/404/"
|
||||
}
|
||||
|
||||
if (
|
||||
rawHref &&
|
||||
!(
|
||||
rawHref.indexOf("http://") === 0 ||
|
||||
rawHref.indexOf("https://") === 0 ||
|
||||
rawHref.indexOf("#") === 0 ||
|
||||
rawHref.includes("journal/index") ||
|
||||
rawHref.includes(".pdf") ||
|
||||
rawHref.includes(".svg")
|
||||
)
|
||||
) {
|
||||
var prefetchLink = element.href;
|
||||
async function myFetch() {
|
||||
let response = await fetch(prefetchLink);
|
||||
let fragment = document.createElement("template");
|
||||
fragment.innerHTML = await response.text();
|
||||
let ct = await response.headers.get("content-type");
|
||||
if (ct.includes("text/html")) {
|
||||
createPreview(element, fragment.content.querySelector('.content').outerHTML, {
|
||||
placement:
|
||||
window.innerWidth > switchDirectionWindowWidth
|
||||
? "right"
|
||||
: "top",
|
||||
});
|
||||
|
||||
element.addEventListener("click", function (e) {
|
||||
if (!e.ctrlKey && !e.metaKey) {
|
||||
e.preventDefault();
|
||||
stackNote(element.href, this.dataset.level);
|
||||
fetchNote(element.href, this.dataset.level, (animate = true));
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
return myFetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener("popstate", function (event) {
|
||||
// TODO: check state and pop pages if possible, rather than reloading.
|
||||
window.location = window.location; // this reloads the page.
|
||||
});
|
||||
|
||||
window.onload = async function () {
|
||||
initializePreviews(document.querySelector(".page"));
|
||||
|
||||
let stacks = [];
|
||||
uri = URI(window.location);
|
||||
if (uri.hasQuery("stack")) {
|
||||
stacks = uri.query(true).stack;
|
||||
if (!Array.isArray(stacks)) {
|
||||
stacks = [stacks];
|
||||
}
|
||||
for (let i = 0; i < stacks.length; i++) {
|
||||
fetchNote(stacks[i], i + 1, (animate = false));
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
}
|
||||
window.Isso.init();
|
||||
window.Isso.fetchComments();
|
||||
}
|
||||
isso_onload_init = true;
|
||||
};
|
6
themes/cortex/assets/js/popper.js
Normal file
6
themes/cortex/assets/js/popper.js
Normal file
File diff suppressed because one or more lines are too long
109
themes/cortex/assets/js/search.js
Normal file
109
themes/cortex/assets/js/search.js
Normal file
|
@ -0,0 +1,109 @@
|
|||
summaryInclude=60;
|
||||
var fuseOptions = {
|
||||
shouldSort: true,
|
||||
includeMatches: true,
|
||||
// threshold: 0.0,
|
||||
threshold: 0.3,
|
||||
tokenize:true,
|
||||
location: 0,
|
||||
distance: 100,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1,
|
||||
keys: [
|
||||
{name:"title",weight:0.8},
|
||||
{name:"contents",weight:0.5},
|
||||
{name:"tags",weight:0.3}
|
||||
// , {name:"categories",weight:0.3}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var searchQuery = param("s");
|
||||
if(searchQuery){
|
||||
$("#search-query").val(searchQuery);
|
||||
executeSearch(searchQuery);
|
||||
}else {
|
||||
$('#search-results').append("<p>Please enter a word or phrase above</p>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function executeSearch(searchQuery){
|
||||
$.getJSON( "/index.json", function( data ) {
|
||||
var pages = data;
|
||||
var fuse = new Fuse(pages, fuseOptions);
|
||||
var result = fuse.search(searchQuery);
|
||||
console.log({"matches":result});
|
||||
if(result.length > 0){
|
||||
populateResults(result);
|
||||
}else{
|
||||
$('#search-results').append("<p>没有相应结果</p>");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populateResults(result){
|
||||
$.each(result,function(key,value){
|
||||
var contents= value.item.contents;
|
||||
var snippet = "";
|
||||
var snippetHighlights=[];
|
||||
var tags =[];
|
||||
if( fuseOptions.tokenize ){
|
||||
snippetHighlights.push(searchQuery);
|
||||
}else{
|
||||
$.each(value.matches,function(matchKey,mvalue){
|
||||
if(mvalue.key == "tags" || mvalue.key == "categories" ){
|
||||
snippetHighlights.push(mvalue.value);
|
||||
}else if(mvalue.key == "contents"){
|
||||
start = mvalue.indices[0][0]-summaryInclude>0?mvalue.indices[0][0]-summaryInclude:0;
|
||||
end = mvalue.indices[0][1]+summaryInclude<contents.length?mvalue.indices[0][1]+summaryInclude:contents.length;
|
||||
snippet += contents.substring(start,end);
|
||||
snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0],mvalue.indices[0][1]-mvalue.indices[0][0]+1));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(snippet.length<1){
|
||||
snippet += contents.substring(0,summaryInclude*2);
|
||||
}
|
||||
//pull template from hugo templarte definition
|
||||
var templateDefinition = $('#search-result-template').html();
|
||||
//replace values
|
||||
var output = render(templateDefinition,{key:key,title:value.item.title,link:value.item.permalink,tags:value.item.tags,categories:value.item.categories,snippet:snippet});
|
||||
$('#search-results').append(output);
|
||||
|
||||
$.each(snippetHighlights,function(snipkey,snipvalue){
|
||||
$("#summary-"+key).mark(snipvalue);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function param(name) {
|
||||
return decodeURIComponent((location.search.split(name + '=')[1] || '').split('&')[0]).replace(/\+/g, ' ');
|
||||
}
|
||||
|
||||
function render(templateString, data) {
|
||||
var conditionalMatches,conditionalPattern,copy;
|
||||
conditionalPattern = /\$\{\s*isset ([a-zA-Z]*) \s*\}(.*)\$\{\s*end\s*}/g;
|
||||
//since loop below depends on re.lastInxdex, we use a copy to capture any manipulations whilst inside the loop
|
||||
copy = templateString;
|
||||
while ((conditionalMatches = conditionalPattern.exec(templateString)) !== null) {
|
||||
if(data[conditionalMatches[1]]){
|
||||
//valid key, remove conditionals, leave contents.
|
||||
copy = copy.replace(conditionalMatches[0],conditionalMatches[2]);
|
||||
}else{
|
||||
//not valid, remove entire section
|
||||
copy = copy.replace(conditionalMatches[0],'');
|
||||
}
|
||||
}
|
||||
templateString = copy;
|
||||
//now any conditionals removed we can do simple substitution
|
||||
var key, find, re;
|
||||
for (key in data) {
|
||||
find = '\\$\\{\\s*' + key + '\\s*\\}';
|
||||
re = new RegExp(find, 'g');
|
||||
templateString = templateString.replace(re, data[key]);
|
||||
}
|
||||
return templateString;
|
||||
}
|
1
themes/cortex/assets/js/tex-mml-chtml.js
Normal file
1
themes/cortex/assets/js/tex-mml-chtml.js
Normal file
File diff suppressed because one or more lines are too long
2
themes/cortex/assets/js/tippy.js
Normal file
2
themes/cortex/assets/js/tippy.js
Normal file
File diff suppressed because one or more lines are too long
0
themes/cortex/layouts/404.html
Normal file
0
themes/cortex/layouts/404.html
Normal file
1
themes/cortex/layouts/_default/_markup/render-link.html
Normal file
1
themes/cortex/layouts/_default/_markup/render-link.html
Normal file
|
@ -0,0 +1 @@
|
|||
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" class="external-link" {{ else }} class="internal-link" {{ end }}>{{ .Text }}</a>
|
8
themes/cortex/layouts/_default/baseof.html
Normal file
8
themes/cortex/layouts/_default/baseof.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
{{- partial "head.html" . -}}
|
||||
<body>
|
||||
{{- partial "header.html" . -}}
|
||||
{{- block "main" . }}{{- end }}
|
||||
</body>
|
||||
</html>
|
6
themes/cortex/layouts/_default/index.json
Normal file
6
themes/cortex/layouts/_default/index.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{- $.Scratch.Add "index" slice -}}
|
||||
{{- range .Site.RegularPages -}}
|
||||
{{- $.Scratch.Add "index" (dict "title" .Title "tags" .Params.tags "categories" .Params.categories "contents" .Plain "permalink" .Permalink "date" .Date "section" .Section) -}}
|
||||
{{- end -}}
|
||||
{{- $.Scratch.Get "index" | jsonify -}}
|
||||
|
6
themes/cortex/layouts/_default/list.html
Normal file
6
themes/cortex/layouts/_default/list.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{ range .Data.Pages }}
|
||||
{{ .Data.Pages }}
|
||||
<li>
|
||||
<a href="{{ .Permalink | relURL }}">{{ .Title }}</a> - <time>{{ .Date.Format "02 Jan 2006" }}</time>
|
||||
</li>
|
||||
{{ end }}
|
26
themes/cortex/layouts/_default/search.html
Normal file
26
themes/cortex/layouts/_default/search.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
{{ define "main" }}
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.2.0/fuse.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js"></script>
|
||||
{{ $searchjs := resources.Get "js/search.js" }}
|
||||
<script src="{{$searchjs.Permalink}}" type="text/javascript"></script>
|
||||
<section class="resume-section p-3 p-lg-5 d-flex flex-column">
|
||||
<div class="my-auto" >
|
||||
<form action="{{ "search" | absURL }}">
|
||||
<input id="search-query" name="s" placeholder=" 搜点啥?"/>
|
||||
</form>
|
||||
<div id="search-results">
|
||||
<h3></h3>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- this template is sucked in by search.js and appended to the search-results div above. So editing here will adjust style -->
|
||||
<script id="search-result-template" type="text/x-js-template">
|
||||
<div id="summary-${key}">
|
||||
<h4><a href="${link}">${title}</a></h4>
|
||||
<p>${snippet}</p>
|
||||
${ isset tags }<p>Tags: ${tags}</p>${ end }
|
||||
${ isset categories }<p>Categories: ${categories}</p>${ end }
|
||||
</div>
|
||||
</script>
|
||||
{{ end }}
|
13
themes/cortex/layouts/_default/section.html
Normal file
13
themes/cortex/layouts/_default/section.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{ define "main" }}
|
||||
<div class="grid-container">
|
||||
<div class="grid">
|
||||
<div class="page">
|
||||
<div class="content">
|
||||
{{ range .Pages }}
|
||||
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
24
themes/cortex/layouts/_default/single.html
Normal file
24
themes/cortex/layouts/_default/single.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
{{define "main"}}
|
||||
<div class="grid-container">
|
||||
<div class="grid">
|
||||
<div class="page" data-level="1">
|
||||
<div class="content">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
{{ partial "backlinks.html" . }}
|
||||
</div>
|
||||
{{ partial "comment.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ $urijs := resources.Get "js/URI.js" }}
|
||||
<script src="{{$urijs.Permalink}}" type="text/javascript"></script>
|
||||
{{ $pagejs := resources.Get "js/page.js" }}
|
||||
<script src="{{$pagejs.Permalink}}" type="text/javascript"></script>
|
||||
{{ $mathjs := resources.Get "js/tex-mml-chtml.js" }}
|
||||
<script id="MathJax-script" async src="{{$mathjs.Permalink}}"></script>
|
||||
{{ $popperjs := resources.Get "js/popper.js" }}
|
||||
<script src="{{$popperjs.Permalink}}" type="text/javascript"></script>
|
||||
{{ $tippyjs := resources.Get "js/tippy.js" }}
|
||||
<script src="{{$tippyjs.Permalink}}" type="text/javascript"></script>
|
||||
{{end}}
|
27
themes/cortex/layouts/index.atom.xml
Normal file
27
themes/cortex/layouts/index.atom.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
{{ if .IsHome }}
|
||||
<title>{{ .Title }}</title>
|
||||
{{ else }}
|
||||
<title>{{ .Title }} - {{ .Site.Title }}</title>
|
||||
{{ end }}
|
||||
<link href="{{ .Permalink }}index.xml" rel="self"/>
|
||||
<link href="{{ .Permalink }}"/>{{ if not .Date.IsZero }}
|
||||
<updated>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>{{ end }}
|
||||
<id>{{ .Permalink }}</id>{{ with .Site.Author.name }}
|
||||
<author>
|
||||
<name>{{.}}</name>{{ with $.Site.Author.email }}
|
||||
<email>{{.}}</email>{{end}}
|
||||
</author>{{end}}
|
||||
<generator>Hugo -- gohugo.io</generator>{{ range first 15 (where .Data.Pages "Type" "in" .Site.Params.mainSections) }}
|
||||
<entry>
|
||||
{{ `<title type="html"><![CDATA[` | safeHTML }}{{ .Title }}]]></title>
|
||||
<link href="{{ .Permalink }}"/>
|
||||
<id>{{ .Permalink }}</id>{{ with .Site.Params.Author }}
|
||||
<author>
|
||||
<name>{{.}}</name>
|
||||
</author>{{end}}
|
||||
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
|
||||
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
|
||||
{{ `<content type="html"><![CDATA[` | safeHTML }}{{ .Content }}]]></content>
|
||||
</entry>{{ end }}
|
||||
</feed>
|
7
themes/cortex/layouts/index.html
Normal file
7
themes/cortex/layouts/index.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{define "main"}}
|
||||
<div class="page" data-level="1">
|
||||
<div class="content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
20
themes/cortex/layouts/partials/backlinks.html
Normal file
20
themes/cortex/layouts/partials/backlinks.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{{ $re := $.File.BaseFileName }}
|
||||
{{ $backlinks := slice }}
|
||||
{{ range .Site.AllPages }}
|
||||
{{ if and (findRE $re .RawContent) (not (eq $re .File.BaseFileName)) }}
|
||||
{{ $backlinks = $backlinks | append . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if gt (len $backlinks) 0 }}
|
||||
<div class="bl-section">
|
||||
<h4>🔗反向链接</h4>
|
||||
<div class="backlinks">
|
||||
<ul>
|
||||
{{ range $backlinks }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
12
themes/cortex/layouts/partials/comment.html
Normal file
12
themes/cortex/layouts/partials/comment.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<div class="comment">
|
||||
<h4>评论</h4>
|
||||
<script
|
||||
data-isso-lang="zh_CN"
|
||||
data-isso-max-comments-nested="5"
|
||||
data-isso-reveal-on-click="5"
|
||||
data-isso-vote="false"
|
||||
src="//dodder.southfox.gay/js/embed.min.js"
|
||||
></script>
|
||||
<section id="isso-thread" data-title="{{ .Title }}" data-isso-id="{{ .Permalink }}">
|
||||
<noscript>Javascript needs to be activated to view comments.</noscript>
|
||||
</div>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue