Browse Source

更新部分配置和文章

master
lniwn 6 years ago
parent
commit
0b66295ffb
  1. 1
      .gitignore
  2. 3
      .gitmodules
  3. 4
      archetypes/default.md
  4. 4
      config.toml
  5. BIN
      content/posts/2019/CSS学习笔记/CSS学习笔记.xmind
  6. BIN
      content/posts/2019/CSS学习笔记/CSS盒尺寸.png
  7. 142
      content/posts/2019/CSS学习笔记/index.md
  8. BIN
      content/posts/2019/CSS学习笔记/替换元素尺寸计算规则.png
  9. 135
      content/posts/2019/centos部署笔记.md
  10. 22
      content/posts/2019/hugo部署笔记.md
  11. 54
      content/posts/2019/mongodb备忘录.md
  12. 2
      resources/_gen/assets/scss/scss/style.scss_c16d144eee185fbddd582cd5e25a4fae.content
  13. 2
      resources/_gen/assets/scss/scss/style.scss_c16d144eee185fbddd582cd5e25a4fae.json
  14. 12
      static/css/scroll-toc.css
  15. BIN
      static/img/electron.png
  16. 2
      themes/hermit

1
.gitignore vendored

@ -0,0 +1 @@
themes

3
.gitmodules vendored

@ -1,3 +0,0 @@
[submodule "themes/hermit"]
path = themes/hermit
url = https://github.com/Track3/hermit.git

4
archetypes/default.md

@ -2,5 +2,9 @@
title: "{{ replace .Name "-" " " | title }}" title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }} date: {{ .Date }}
draft: true draft: true
toc: true
images:
tags: [untagged]
categories:
--- ---

4
config.toml

@ -50,12 +50,12 @@ enableEmoji = true # Shorthand emojis in content files - https://gohugo.io/func
# Toggling this option needs to rebuild SCSS, requires Hugo extended version # Toggling this option needs to rebuild SCSS, requires Hugo extended version
justifyContent = false # Set "text-align: justify" to `.content`. justifyContent = false # Set "text-align: justify" to `.content`.
relatedPosts = false # Add a related content section to all single posts page relatedPosts = true # Add a related content section to all single posts page
code_copy_button = true code_copy_button = true
# Add custom css # Add custom css
# customCSS = ["css/foo.css", "css/bar.css"] customCSS = ["css/fix-toc.css"]
# Social Icons # Social Icons
# Check https://github.com/Track3/hermit#social-icons for more info. # Check https://github.com/Track3/hermit#social-icons for more info.

BIN
content/posts/2019/CSS学习笔记/CSS学习笔记.xmind

Binary file not shown.

BIN
content/posts/2019/CSS学习笔记/CSS盒尺寸.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

142
content/posts/2019/CSS学习笔记/index.md

@ -0,0 +1,142 @@
---
title: "CSS学习笔记"
date: 2019-08-13T15:16:33+08:00
draft: false
toc: true
images:
tags: [css]
categories: web
---
## 流、元素与基本尺寸
HTML元素分为两类:**块级元素**、**内联元素**。
### CSS盒尺寸
![CSS盒尺寸](CSS盒尺寸.png)
盒子模型,一共有四种盒子:content-box, padding-box, border-box, margin-box,给定元素的width, height是作用在content-box上的。对于块状元素,如果`width:auto`,则元素会如水流般充满整个容器,而一旦设定了width具体数值,则元素的流动性就会被阻断,可以参考这个[实例](https://demo.cssworld.cn/3/2-3.php)。
### CSS流体布局下的宽度分离原则
所谓“宽度分离元则”,就是CSS中的width属性不与影响宽度的padding/border(有时候包括margin)属性共存,而应该进行分离,width独立占用一层标签,padding、border、margin利用流动性在内部自适应呈现。
box-sizing会改变尺寸作用规则,理论上有下面这些写法:
```css
.box1 { box-sizing: content-box; } /* 默认值 */
.box2 { box-sizing: padding-box; } /* Firefox曾经支持 */
.box3 { box-sizing: border-box; } /* 全线支持 */
.box4 { box-sizing: margin-box; } /* 从未支持 */
```
替换元素的特性之一就是尺寸由内部元素决定,且无论其display属性值是inline还是block;对于非替换元素,如果其display属性值为block,则会具有流动性,宽度由外部尺寸决定。
对于普通文档流中的元素,百分比高度值要想起作用,其父级必须有一个可以生效的高度值。
绝对定位的宽高百分比计算是相对于padding box的,也就是说会把padding大小值计算在内,但是,非绝对定位元素则是相对于content box计算的。
### 内联元素
“内联元素”的“内联”特指“外在盒子”,和“display为inline的元素”不是一个概念。“内联元素”的典型特征就是可以和文字在一行显示。
内联盒子模型:
- 内容区域(content area)
- 内联盒子(inline box)
- 行框盒子(line box)
- 包含盒子(containing box)
在HTML5中存在“幽灵空白结点”,叫做`strut`
> Each line box starts with a zero-width inline box with the element's font and line height properties. We call that imaginary box a "struct".
## 盒尺寸四大家族
盒尺寸中的4个盒子content box, padding box, border box和margin box分别对应CSS世界中的content, padding, border和margin属性。
根据“外在盒子”是内联还是块级我们可以把元素分为内联元素和块级元素,而根据是否具有可替换内容,我们也可以把元素分为替换元素和非替换元素。
### 替换元素特性
- 内容的外观不受页面上的CSS的影响
- 有自己的尺寸
- 在很多CSS属性上有自己的一套表现规则
### 替换元素的尺寸计算规则
- 固有尺寸指的是替换内容原本的尺寸
- HTML尺寸介于固有尺寸和CSS尺寸之间,只能通过原生HTML属性改变
- CSS尺寸特指可以通过CSS的width和height或者max-width/min-width和max-height/min-height设置尺寸,对应盒尺寸中的content box
![替换元素尺寸计算规则](替换元素尺寸计算规则.png)
可以使用下面的方式实现透明图片占位:
```html
<img>
```
```css
img {
visibility: hidden;
display: inline-block;
}
img[src] {
visibility: visible;
}
```
没有`src`属性的`<img>`是非替换元素。
**我们无法改变替换元素内容的固有尺寸。**
`<img>`元素中的width和height之所以会改变图片大小,是因为图片中的content替换内容默认的适配方式是填充(fill),在CSS3中,`<img>`和其他一些替换元素的替换内容的适配方式可以通过`object-fit`属性修改。
在CSS中,我们把content属性生成的对象称为“匿名替换元素”。
### 深入理解content
- content与替换元素
- content内容生成技术
## 内联元素与流
块级元素负责结构,内联元素接管内容。
字母x的下边缘(线)就是我们的基线,内联元素默认是基线对齐的。
`ex`是CSS中的一个相对单位,指的是小写字母x的高度,即`x-height`。
仅包含文字的`<div>`高度是由`line-height`属性决定的。
对于非替换元素的纯内联元素,其可视高度完全由`line-height`决定。
### 深入`line-height`的各类属性值
`line-height`的默认值是`normal`,还支持数值、百分比值以及长度值。
- 数值,比如`line-height: 1.5`,其最终的计算值是和当前`font-size`相乘后的值。
- 百分比值,比如`line-height: 150%`,其最终的计算值是和当前`font-size`相乘后的值。
- 长度值,也就是带单位的值,如`line-height: 1.5em`,此处`em`是一个相对于`font-size`的相对单位,因此,最终的计算值也是和当前`font-size`相乘后的值。
**如果使用数值作为`line-height`的属性值,那么所有的子元素继承的都是这个值;但是,如果使用百分比值或者长度值作为属性值,那么所有的子元素继承的是最终计算的值。**
`line-height`的大值特性。
### `vertical-align`
属性值分为4类:
- 线类,如baseline、top、middle、bottom;
- 文本类,如text-top、text-bottom;
- 上标下标类,如sub、super;
- 数值百分比类,如20px、2em、20%等。
`vertical-align`只能应用于内联元素以及`display`值为`table-cell`的元素。

BIN
content/posts/2019/CSS学习笔记/替换元素尺寸计算规则.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

135
content/posts/2019/centos部署笔记.md

@ -0,0 +1,135 @@
---
title: "Centos部署笔记"
date: 2019-09-12T20:50:05+08:00
draft: false
toc: true
images:
tags: [centos]
categories: server
---
本文记录笔记全部基于CentOS7版本。
<!--more-->
## 系统安装
### 权限控制和分区
- 登录报错`-- lniwn: /home/lniwn: change directory failed: Permission denied
Logging in with /home="/".`
首先确认权限:
```shell
chown -R lniwn:lniwn /home/lniwn
chmod -R 700 /home/lniwn
```
然后确认SELinux配置,恢复文件上下文:
```shell
restorecon -R /home
```
- 挂载/home分区到指定的磁盘
```shell
# 分区
parted
select /dev/sdb1 # 切换磁盘
mklabel gpt # 创建分区表
mkpart extended 1 100% # 分区
mkfs.ext4 /dev/sdb1 # 格式化磁盘
print # 打印当前分区概况
exit
# /home转移
mkdir -p /srv/home
mount /dev/sdb1 /srv/home
cp -aR /home/* /srv/home/
diff -r /home /srv/home
rm -rf /home/*
umount /srv/home
mount /dev/sdb1 /home
# 开机自动挂载
blkid /dev/sdb1
# 编辑/etc/fstab文件,添加如下行
UUID=e087e709-20f9-42a4-a4dc-d74544c490a6 /home ext4 defaults 0 2
```
> - **UUID** – specifies the block device, you can alternatively use the device file **/dev/sdb1**.
> - **/home** – this is the mount point.
> - **etx4** – describes the filesystem type on the device/partition.
> - **defaults** – mount options, (here this value means rw, suid, dev, exec, auto, nouser, and async).
> - **0** – used by dump tool, 0 meaning don’t dump if filesystem is not present.
> - **2** – used by fsck tool for discovering filesystem check order, this value means check this device after root filesystem.
- 关闭SELinux
检查状态
```shell
sestatus
```
禁用
```shell
setenforce 0
```
编辑文件`/etc/selinux/config`,将`SELINUX`值修改为`disabled`。
重启系统生效。
### SSH默认端口修改
- 修改sshd默认端口
打开配置文件`vim /etc/ssh/sshd_config`
修改端口号`Port 12456`
防火墙增加端口白名单
```shell
firewall-cmd --zone=public --add-port 123456/tcp --permanent
```
刷新防火墙配置`firewall-cmd --reload`
重启sshd服务`systemctl restart sshd`
切记:*使用新端口正常连接后,再断开原有的连接,否则可能会永远连不上ssh了*
### 启动模式修改
- 切换GUI和CLI启动模式
```shell
systemctl set-default multi-user.target
```
```shell
systemctl set-default graphical.target
```
获取当前启动模式`systemctl get-default`
从CLI启动图形界面`startx`
- 配置启动时自动连接网络
```shell
cd /etc/sysconfig/network-scripts/
sed -i -e 's@^ONBOOT="no@ONBOOT="yes@' ifcfg-eth0
```
## 应用安装
### mongodb安装
官方安装文档<https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/>

22
content/posts/2019/hugo部署笔记.md

@ -4,15 +4,25 @@ date: 2019-07-26T22:08:48+08:00
draft: false draft: false
toc: false toc: false
images: images:
tags: [linux] tags: [go]
categories: 后端
--- ---
使用的主题 <https://github.com/Track3/hermit> ## 建站
遇到的坑: ```shell
hugo new site oaoa.me
```
- 目录过长时显示不全 ## 新建文章
代码获取:`git submodule add https://github.com/Track3/hermit.git themes/hermit` ```shell
hugo new posts/2019/my-blog.md
```
## 启动预览服务器
```shell
hugo server
```
从hexo迁移到hugo,还是有部分语法不一致的。

54
content/posts/2019/mongodb备忘录.md

@ -0,0 +1,54 @@
---
title: "Mongodb备忘录"
date: 2019-09-23T10:18:30+08:00
draft: false
toc: true
images:
tags: [database]
categories: server
---
- 创建唯一索引
```javascript
// 删除重复key
db.games2.aggregate([
{
"$group": {
"_id": "$game_id",
"dups": {
"$push": "$_id"
},
"count": {
"$sum": 1
}
}
},
{
"$match": {
"count": {
"$gt": 1
}
}
}
]).forEach(function(doc) {
doc.dups.shift();
db.games2.remove({
"_id": {
"$in": doc.dups
}
});
});
// 创建索引
db.games2.createIndex({"game_id": 1}, {unique: true});
```
- 查找具有相同字段值的文档
```javascript
db.games2.find({$where: "this.fileId == this.fileUid"});
```

2
resources/_gen/assets/scss/scss/style.scss_c16d144eee185fbddd582cd5e25a4fae.content

File diff suppressed because one or more lines are too long

2
resources/_gen/assets/scss/scss/style.scss_c16d144eee185fbddd582cd5e25a4fae.json

@ -1 +1 @@
{"Target":"css/style.min.568c54a56780af2a70c45272522247710b69dbfc080b315211fb98381e3796f8.css","MediaType":"text/css","Data":{"Integrity":"sha256-VoxUpWeArypwxFJyUiJHcQtp2/wICzFSEfuYOB43lvg="}} {"Target":"css/style.min.657bcb7af31123e4156b1a3d2ff60a636717e54ead74f882136b5114cf72b55e.css","MediaType":"text/css","Data":{"Integrity":"sha256-ZXvLevMRI+QVaxo9L/YKY2cX5U6tdPiCE2tRFM9ytV4="}}

12
static/css/scroll-toc.css

@ -0,0 +1,12 @@
#toc {
left: auto;
right: 1%;
top: 5%;
/* background: #494f5c; */
width: 20%;
height: 90%;
overflow-y: auto;
overflow-x: hidden;
margin-right: -20px;
padding-right:12px;
}

BIN
static/img/electron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

2
themes/hermit

@ -1 +1 @@
Subproject commit 16c9d78ae518aebb65c3bca5871b2550bbabca16 Subproject commit f647c23dac5bc6b0ab67552f8590470793b102d8
Loading…
Cancel
Save