-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.xml
More file actions
111 lines (94 loc) · 11.8 KB
/
index.xml
File metadata and controls
111 lines (94 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Posts on 随风潜入夜</title>
<link>https://microgap.github.io/posts.html</link>
<description>Recent content in Posts on 随风潜入夜</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Thu, 12 Mar 2020 13:27:09 +0800</lastBuildDate>
<atom:link href="https://microgap.github.io/posts/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>行政区域代码数据库</title>
<link>https://microgap.github.io/2020/03/80d66b17f0c9c60b8acbec95e7f2360293dc708c.html</link>
<pubDate>Thu, 12 Mar 2020 13:27:09 +0800</pubDate>
<guid>https://microgap.github.io/2020/03/80d66b17f0c9c60b8acbec95e7f2360293dc708c.html</guid>
<description>项目需要用到省市四级联动,想要寻找一个符合国家标准规范的数据库,本以为会很容易,实际却困难重重.
首先,现成的SQL文件是很少的,网上提供的最多的是一段js代码,可惜我并不是做网站前端开发,解析那段js太累,放弃
其次,找到一些SQL文件,不过80%以上的都是把上面提到的js解析后存到了数据库, 所有信息均在一张表里,而主键是自定义的id,并不符合国家标准文件规范
还有一些收费的,提供的数据很丰富,不过我只需要一个简单的联动代码库,所以没必要去花这个费用
最后还是决定自己抓取一个标准化的数据库,供项目使用
数据库已经放到github上,欢迎有同样需求的使用,也希望大家一起查漏补缺,让它以后能日趋完善
Git: 项目地址</description>
</item>
<item>
<title>编译OpenWRT固件</title>
<link>https://microgap.github.io/2019/12/8e8485482fc7b12f20d7d9fd8caa1b012dd01a23.html</link>
<pubDate>Fri, 13 Dec 2019 22:56:15 +0800</pubDate>
<guid>https://microgap.github.io/2019/12/8e8485482fc7b12f20d7d9fd8caa1b012dd01a23.html</guid>
<description>折腾之路: 编译一个自用的斐讯K3固件 近两天同事拿出了他那翻了车的K3,想刷个固件折腾个“你懂的”,然后拿回家去用。看他折腾的挺欢快,我也想把那同一批翻车的K3重新刷个固件换换口味。观摩他刷过的几个版本的固件,要么直接不好用,要么是预装的软件包实在过多,不是很爽快,于是决定自己找源码来编译一份精简的,说折腾就折腾
安装Docker——Windows环境默认无法编译Linux软件,需要一些额外的帮助。可以选择安装cygwin,也可以用VM虚拟机装个linux,我选择了Docker 安装完Docker并启动后,如果提示直接点击“OK”键,然后等待一会儿电脑自动重启后即可使用。
安装Ubuntu——下载并安全完Docker以后,运行 Powershell 拉取一个Ubuntu最新的Docker镜像 PS C:\WINDOWS\system32&gt; docker pull ubuntu:latest PS C:\WINDOWS\system32&gt; docker pull ubuntu:latest latest: Pulling from library/ubuntu 7ddbc47eeb70: Pull complete c1bbdc448b72: Pull complete 8c3b70e39044: Pull complete 45d437916d57: Pull complete Digest: sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d Status: Downloaded newer image for ubuntu:latest 运行一个基于ubuntu镜像的container——新建一个文件夹,挂载到容器中,用来保存OpenWRT的源码以及编译后的固件 PS C:\WINDOWS\system32&gt; E: PS E:\&gt; mkdir Docker\target PS E:\&gt; cd Docker PS E:\Docker&gt; PS E:\Docker&gt; docker run -it --name openwrt -v E:/Docker/target:/app ubuntu:latest 如果Docker未设置过共享磁盘,此时右下角会弹出打开Docker的Setting界面,选择Shared Drives选项卡,选择E盘,点击Apply 输入用户名密码后确认。</description>
</item>
<item>
<title>Golang使用json库解码注意事项</title>
<link>https://microgap.github.io/2019/12/f2a283032e7a79bd415e0a797c41acb1ecd76209.html</link>
<pubDate>Fri, 13 Dec 2019 12:10:54 +0800</pubDate>
<guid>https://microgap.github.io/2019/12/f2a283032e7a79bd415e0a797c41acb1ecd76209.html</guid>
<description>type Response struct { Code int `json:&#34;code&#34;` Message string `json:&#34;message&#34;` } func main() { body := `{&#34;code&#34;: 100, &#34;message&#34;: &#34;测试&#34;} ` var r Response e := json.Unmarshal([]byte(body), &amp;r) if e == nil { fmt.Printf(&#34;%v&#34;, r) } else { fmt.Printf(&#34;error: %v&#34;,e) } } /// 输出:{100 测试} 使用Golang的标准json库需要注意以下两点 由于go语言的struct类型默认允许所有属性都可以是空值,所以json的Unmarshal方法,只验证待解析内容是否为正确的json格式,而不验证目标类型是否与待解析内容匹配 type Response struct { Code int `json:&#34;code1&#34;` // 在解析内容中code1不存在,返回默认值0 Message string `json:&#34;message1&#34;` // 在解析内容中message1不存在,返回默认值&#34;&#34; } func main() { body := `{&#34;code&#34;: 100, &#34;message&#34;: &#34;测试&#34;} ` var r Response e := json.</description>
</item>
<item>
<title>Golang 开发Web Api Services热加载</title>
<link>https://microgap.github.io/2019/12/729b52d0df24f84447c24f1e491a0d3573b78d28.html</link>
<pubDate>Thu, 05 Dec 2019 16:02:41 +0800</pubDate>
<guid>https://microgap.github.io/2019/12/729b52d0df24f84447c24f1e491a0d3573b78d28.html</guid>
<description>学习Go语言开发Webservice Api过程中,每次想要看一下代码修改后的结果,都需要重新编译一次代码后才可以在浏览器看到结果,虽然VS Code的F5很好用,但还是想要减少一些手动操作,于是上网找解决办法😏.
使用fswatch工具 参考 使用gin工具 Github 相关的实现方法不少,懒得找了,正巧,我用的web框架也叫gin,这里就用第二种方式吧
安装gin工具
go get -u github.com/codegangsta/gin 然后到项目根目录下输入命令
gin run main.go [gin] Listening on port 3000 [gin] Building... 冲杯🍵等一下
gin run main.go [gin] Listening on port 3000 [gin] Building... [gin] Build finished 两杯咖啡下肚,仍然停在这里,难道我打开方式不对? 浏览器打开 http://localhost:3000,&ldquo;该网页无法正常运作&rdquo;,好消息是后台有了新的进展
[gin] Listening on port 3000 [gin] Building... [gin] Build finished 2019/12/05 16:44:25 http: proxy error: dial tcp [::1]:3001: connect: connection refused [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.</description>
</item>
<item>
<title>Golang 在 Windows 10 编译找不到 gcc 的解决方法</title>
<link>https://microgap.github.io/2019/12/e4ca4ddb8de978d6cf139233c7ceb7821a94a6d6.html</link>
<pubDate>Wed, 04 Dec 2019 21:03:40 +0800</pubDate>
<guid>https://microgap.github.io/2019/12/e4ca4ddb8de978d6cf139233c7ceb7821a94a6d6.html</guid>
<description>学习Go语言,用到了Sqlite数据库,在Mac中没遇到问题,转到Windows 10后,编译时报找不到gcc的错误
# runtime/cgo exec: &#34;gcc&#34;: executable file not found in %PATH% exit status 2 Process exiting with code: 1 这是由于Windows环境中没有gcc编译器,首先想到的是安装cgywin,安装过程中要勾选gcc-core模块,安装后,将 {cgywin安装路径}\bin 添加至环境变量Path中
再次编译
# runtime/cgo gcc_libinit_windows.c: 在函数‘x_cgo_sys_thread_create’中: gcc_libinit_windows.c:57:12: 错误:implicit declaration of function ‘_beginthread’; did you mean ‘OpenThread’? [-Werror=implicit-function-declaration] thandle = _beginthread(func, 0, arg); ^~~~~~~~~~~~ OpenThread WTF?
上网找原因,Gihub上有人遇到了同样的问题,基本没什么办法,建议更换MinGW
好吧,再装个MinGW,MinGW是32位的,如果想装64位的需要下载MinGW-W64
这里也可以使用Golang官方推荐的TDM-GCC
下载后安装,默认路径,arch选择x86_64,安装完成后设置 C:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin 到环境变量Path,别忘了把之前设置的cgywin的路径给删掉
“x86_64-8.1.0-win32-seh-rt_v6-rev0” 是安装的MinGW版本号
重启VS Code,F5运行
API server listening at: 127.0.0.1:49263 [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.</description>
</item>
<item>
<title>Hugo布署到Github</title>
<link>https://microgap.github.io/2019/12/2d72055ed9aa6e2bcfae11059d7c1dd41c511663.html</link>
<pubDate>Tue, 03 Dec 2019 16:16:31 +0800</pubDate>
<guid>https://microgap.github.io/2019/12/2d72055ed9aa6e2bcfae11059d7c1dd41c511663.html</guid>
<description>在github新建站点仓库 仓库名称{Username}.github.io, 例:microgap.github.io
非github付费用户,站点仓库必须是Public类型 更多Github Pages相关内容参考这里 在github新建仓库用于存放Hugo源文件 例: Blog (_此仓库可以是Public,也可以是Private_) 将存放站点源文件的仓库克隆到本地 git clone git@github.com:Microgap/Blog.git &amp;&amp; cd Blog 复制Hugo站点源文件到Blog仓库 检查站点是否正常
hugo server -e m10c #m10c 是配置文件名称,按需修改 站点运行正常后,停止hugo服务,并删除Public文件夹
rm -rf public 将站点仓库作为子模块添加到源文件仓库 git submodule add -b master git@github.com:Microgap/microgap.github.io.git public 新建脚本 deploy.sh 脚本内容
#!/bin/sh # If a command fails then the deploy stops set -e printf &#34;\033[0;32mDeploying updates to GitHub...\033[0m\n&#34; # Build the project. hugo -e m10c # 此处按需更换使用的配置文件` # Go To Public folder cd public # Add changes to git.</description>
</item>
<item>
<title>Hexo使用NexT主题配置评论系统</title>
<link>https://microgap.github.io/2019/01/3cb9a68dd1b66525171ef0a3eefff6a977f1b4ea.html</link>
<pubDate>Tue, 22 Jan 2019 15:27:06 +0800</pubDate>
<guid>https://microgap.github.io/2019/01/3cb9a68dd1b66525171ef0a3eefff6a977f1b4ea.html</guid>
<description>使用next主题,配置评论系统 next内置集成多种评论系统,通过简单的设置即可让网站增加评论功能,目前支持以下几种
# Disqus # Changyan # Valine # LiveRe # Gitment # Gitalk 我这里使用Disqus评论系统,到 https://disqus.com 网站注册账号,然后按提示一步步下来即可,注意申请时的shortname 申请完成后,打开next主题下的_config.yml文件,找到
disqus: enable: false shortname: #填写申请到的shortname count: true lazyload: false 将enable改为true, shortname填上之前申请时生成的shortname,网站的disqus评论功能就可以使用了。
关闭自建page的评论功能 通过上面步骤设置完disqus评论后,发现除了“首页”以及“归档”两个系统自带的模块外,其它自建的页面(如:标签,分类)都可以直行评论,这并不符合实际需求,所以需要单独关闭这些page的评论功能
进入站点的source目录(hexo根目录下的source目录)然后找到对应的page目录,例如categories(分类),打开该目录下的index.md文件,在Front-matter处增加字段comments: false ,该页面的评论功能就被关闭了,以此类推,分别修改所有自建page即可
title: 分类 date: 2019-01-22 12:31:13 type: categories comments: false 修改scaffolds文件夹下的page.md文件 修改scaffolds文件夹下的page.md文件,添加comments: false,这样以后所有新建的page默认都是关闭评论功能</description>
</item>
</channel>
</rss>