mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
Merge branch 'master' of https://github.com/LCTT/TranslateProject into new
This commit is contained in:
commit
b5201133dd
143
published/20180810 How To Remove Or Disable Ubuntu Dock.md
Normal file
143
published/20180810 How To Remove Or Disable Ubuntu Dock.md
Normal file
@ -0,0 +1,143 @@
|
||||
如何移除或禁用 Ubuntu Dock
|
||||
======
|
||||
|
||||
![](https://1.bp.blogspot.com/-pClnjEJfPQc/W21nHNzU2DI/AAAAAAAABV0/HGXuQOYGzokyrGYQtRFeF_hT3_3BKHupQCLcBGAs/s640/ubuntu-dock.png)
|
||||
|
||||
> 如果你想用其它 dock(例如 Plank dock)或面板来替换 Ubuntu 18.04 中的 Dock,或者你想要移除或禁用 Ubuntu Dock,本文会告诉你如何做。
|
||||
|
||||
Ubuntu Dock - 屏幕左侧栏,可用于固定应用程序或访问已安装的应用程序。使用默认的 Ubuntu 会话时,[无法][1]使用 Gnome Tweaks 禁用它(禁用无效)。但是如果你需要,还是有几种方法来摆脱它的。下面我将列出 4 种方法可以移除或禁用 Ubuntu Dock,以及每个方法的缺点(如果有的话),还有如何撤销每个方法的更改。本文还包括在没有 Ubuntu Dock 的情况下访问<ruby>活动概览<rt>Activities Overview</rt></ruby>和已安装应用程序列表的其它方法。
|
||||
|
||||
### 如何在没有 Ubuntu Dock 的情况下访问活动概览
|
||||
|
||||
如果没有 Ubuntu Dock,你可能无法访问活动的或已安装的应用程序列表(可以通过单击 Dock 底部的“显示应用程序”按钮从 Ubuntu Dock 访问)。例如,如果你想使用 Plank Dock 就是这样。
|
||||
|
||||
显然,如果你安装了 Dash to Panel 扩展来替代 Ubuntu Dock,那么还好。因为 Dash to Panel 提供了一个按钮来访问活动概览或已安装的应用程序。
|
||||
|
||||
根据你计划用来替代 Ubuntu Dock 的软件,如果无法访问活动概览,那么你可以启用“活动概览热角”选项,只需将鼠标移动到屏幕的左上角即可打开活动概览。访问已安装的应用程序列表的另一种方法是使用快捷键:`Super + A`。
|
||||
|
||||
如果要启用“活动概览热角”,使用以下命令:
|
||||
|
||||
```
|
||||
gsettings set org.gnome.shell enable-hot-corners true
|
||||
```
|
||||
|
||||
如果以后要撤销此操作并禁用该热角,那么你需要使用以下命令:
|
||||
|
||||
```
|
||||
gsettings set org.gnome.shell enable-hot-corners false
|
||||
```
|
||||
|
||||
你可以使用 Gnome Tweaks 应用程序(该选项位于 Gnome Tweaks 的 “Top Bar” 部分)启用或禁用“活动概览热角” 选项,可以使用以下命令进行安装它:
|
||||
|
||||
```
|
||||
sudo apt install gnome-tweaks
|
||||
```
|
||||
|
||||
### 如何移除或禁用 Ubuntu Dock
|
||||
|
||||
下面你将找到 4 种摆脱 Ubuntu Dock 的方法,环境在 Ubuntu 18.04 下。
|
||||
|
||||
#### 方法 1: 移除 Gnome Shell Ubuntu Dock 包
|
||||
|
||||
摆脱 Ubuntu Dock 的最简单方法就是删除包。
|
||||
|
||||
这将会从你的系统中完全移除 Ubuntu Dock 扩展,但同时也移除了 `ubuntu-desktop` 元数据包。如果你移除 `ubuntu-desktop` 元数据包,不会马上出现问题,因为它本身没有任何作用。`ubuntu-desktop ` 元数据包依赖于组成 Ubuntu 桌面的大量包。它的依赖关系不会被删除,也不会被破坏。问题是如果你以后想升级到新的 Ubuntu 版本,那么将不会安装任何新的 `ubuntu-desktop` 依赖项。
|
||||
|
||||
为了解决这个问题,你可以在升级到较新的 Ubuntu 版本之前安装 `ubuntu-desktop` 元数据包(例如,如果你想从 Ubuntu 18.04 升级到 18.10)。
|
||||
|
||||
如果你对此没有意见,并且想要从系统中删除 Ubuntu Dock 扩展包,使用以下命令:
|
||||
|
||||
```
|
||||
sudo apt remove gnome-shell-extension-ubuntu-dock
|
||||
```
|
||||
|
||||
如果以后要撤消更改,只需使用以下命令安装扩展:
|
||||
|
||||
```
|
||||
sudo apt install gnome-shell-extension-ubuntu-dock
|
||||
```
|
||||
|
||||
或者重新安装 `ubuntu-desktop` 元数据包(这将会安装你可能已删除的任何 `ubuntu-desktop` 依赖项,包括 Ubuntu Dock),你可以使用以下命令:
|
||||
|
||||
```
|
||||
sudo apt install ubuntu-desktop
|
||||
```
|
||||
|
||||
#### 方法 2:安装并使用 vanilla Gnome 会话而不是默认的 Ubuntu 会话
|
||||
|
||||
摆脱 Ubuntu Dock 的另一种方法是安装和使用原生 Gnome 会话。安装 原生 Gnome 会话还将安装此会话所依赖的其它软件包,如 Gnome 文档、地图、音乐、联系人、照片、跟踪器等。
|
||||
|
||||
通过安装原生 Gnome 会话,你还将获得默认 Gnome GDM 登录和锁定屏幕主题,而不是 Ubuntu 默认的 Adwaita Gtk 主题和图标。你可以使用 Gnome Tweaks 应用程序轻松更改 Gtk 和图标主题。
|
||||
|
||||
此外,默认情况下将禁用 AppIndicators 扩展(因此使用 AppIndicators 托盘的应用程序不会显示在顶部面板上),但你可以使用 Gnome Tweaks 启用此功能(在扩展中,启用 Ubuntu appindicators 扩展)。
|
||||
|
||||
同样,你也可以从原生 Gnome 会话启用或禁用 Ubuntu Dock,这在 Ubuntu 会话中是不可能的(使用 Ubuntu 会话时无法从 Gnome Tweaks 禁用 Ubuntu Dock)。
|
||||
|
||||
如果你不想安装原生 Gnome 会话所需的这些额外软件包,那么这个移除 Ubuntu Dock 的这个方法不适合你,请查看其它方法。
|
||||
|
||||
如果你对此没有意见,以下是你需要做的事情。要在 Ubuntu 中安装原生的 Gnome 会话,使用以下命令:
|
||||
|
||||
```
|
||||
sudo apt install vanilla-gnome-desktop
|
||||
```
|
||||
|
||||
安装完成后,重启系统。在登录屏幕上,单击用户名,单击 “Sign in” 按钮旁边的齿轮图标,然后选择 “GNOME” 而不是 “Ubuntu”,之后继续登录。
|
||||
|
||||
![](https://4.bp.blogspot.com/-mc-6H2MZ0VY/W21i_PIJ3pI/AAAAAAAABVo/96UvmRM1QJsbS2so1K8teMhsu7SdYh9zwCLcBGAs/s640/vanilla-gnome-session-ubuntu-login-screen.png)
|
||||
|
||||
如果要撤销此操作并移除原生 Gnome 会话,可以使用以下命令清除原生 Gnome 软件包,然后删除它安装的依赖项(第二条命令):
|
||||
|
||||
```
|
||||
sudo apt purge vanilla-gnome-desktop
|
||||
sudo apt autoremove
|
||||
```
|
||||
|
||||
然后重新启动,并以相同的方式从 GDM 登录屏幕中选择 Ubuntu。
|
||||
|
||||
#### 方法 3:从桌面上永久隐藏 Ubuntu Dock,而不是将其移除
|
||||
|
||||
如果你希望永久隐藏 Ubuntu Dock,不让它显示在桌面上,但不移除它或使用原生 Gnome 会话,你可以使用 Dconf 编辑器轻松完成此操作。这样做的缺点是 Ubuntu Dock 仍然会使用一些系统资源,即使你没有在桌面上使用它,但你也可以轻松恢复它而无需安装或移除任何包。
|
||||
|
||||
Ubuntu Dock 只对你的桌面隐藏,当你进入叠加模式(活动)时,你仍然可以看到并从那里使用 Ubuntu Dock。
|
||||
|
||||
要永久隐藏 Ubuntu Dock,使用 Dconf 编辑器导航到 `/org/gnome/shell/extensions/dash-to-dock` 并禁用以下选项(将它们设置为 `false`):`autohide`、`dock-fixed` 和 `intellihide`。
|
||||
|
||||
如果你愿意,可以从命令行实现此目的,运行以下命令:
|
||||
|
||||
```
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock autohide false
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed false
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock intellihide false
|
||||
```
|
||||
|
||||
如果你改变主意了并想撤销此操作,你可以使用 Dconf 编辑器从 `/org/gnome/shell/extensions/dash-to-dock` 中启动 `autohide`、 `dock-fixed` 和 `intellihide`(将它们设置为 `true`),或者你可以使用以下这些命令:
|
||||
|
||||
```
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock autohide true
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock intellihide true
|
||||
```
|
||||
|
||||
#### 方法 4:使用 Dash to Panel 扩展
|
||||
|
||||
[Dash to Panel][2] 是 Gnome Shell 的一个高度可配置面板,是 Ubuntu Dock 或 Dash to Dock 的一个很好的替代品(Ubuntu Dock 是从 Dash to Dock 分叉而来的)。安装和启动 Dash to Panel 扩展会禁用 Ubuntu Dock,因此你无需执行其它任何操作。
|
||||
|
||||
你可以从 [extensions.gnome.org][3] 来安装 Dash to Panel。
|
||||
|
||||
如果你改变主意并希望重新使用 Ubuntu Dock,那么你可以使用 Gnome Tweaks 应用程序禁用 Dash to Panel,或者通过单击以下网址旁边的 X 按钮完全移除 Dash to Panel: https://extensions.gnome.org/local/ 。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxuprising.com/2018/08/how-to-remove-or-disable-ubuntu-dock.html
|
||||
|
||||
作者:[Logix][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://plus.google.com/118280394805678839070
|
||||
[1]:https://bugs.launchpad.net/ubuntu/+source/gnome-tweak-tool/+bug/1713020
|
||||
[2]:https://www.linuxuprising.com/2018/05/gnome-shell-dash-to-panel-v14-brings.html
|
||||
[3]:https://extensions.gnome.org/extension/1160/dash-to-panel/
|
@ -7,7 +7,7 @@
|
||||
|
||||
### 怎么忽略我所做的命令行增强
|
||||
|
||||
通常情况下我会用别名将新的增强的命令行工具链接到原来的命令(如 `cat` 和 `ping`)。
|
||||
通常情况下我会用别名将新的增强的命令行工具覆盖原来的命令(如 `cat` 和 `ping`)。
|
||||
|
||||
如果我需要运行原来的命令的话(有时我确实需要这么做),我会像下面这样来运行未加修改的原始命令。(我用的是 Mac,你的用法可能不一样)
|
||||
|
||||
@ -18,25 +18,25 @@ $ command cat # 忽略函数和别名
|
||||
|
||||
### bat > cat
|
||||
|
||||
`cat` 用于打印文件的内容,如果你平时用命令行很多的话,例如语法高亮之类的功能会非常有用。我首先发现了 [ccat][3] 这个有语法高亮功能的工具,然后我发现了 [bat][4],它的功能有语法高亮,分页,行号和 git 集成。
|
||||
`cat` 用于打印文件的内容,如果你平时用命令行很多的话,例如语法高亮之类的功能会非常有用。我首先发现了 [ccat][3] 这个有语法高亮功能的工具,然后我发现了 [bat][4],它的功能有语法高亮、分页、行号和 git 集成。
|
||||
|
||||
`bat` 命令也能让我在输出里(多于一屏时)使用 `/` 搜索(和用 `less` 搜索功能一样)。
|
||||
`bat` 命令也能让我在(多于一屏的)输出里使用 `/` 搜索(和用 `less` 搜索功能一样)。
|
||||
|
||||
![Simple bat output][5]
|
||||
|
||||
我将别名 `cat` 链接到了 `bat` 命令:
|
||||
我将别名 `cat` 指到了 `bat` 命令:
|
||||
|
||||
```
|
||||
alias cat='bat'
|
||||
```
|
||||
|
||||
💾 [安装指引][4]
|
||||
- [安装指引][4]
|
||||
|
||||
### prettyping > ping
|
||||
|
||||
`ping` 非常有用,当我碰到“糟了,是不是 X 挂了?/我的网不通了?”这种情况下我最先想到的工具就是它了。但是 `prettyping`(“prettyping” 可不是指“pre typing”)在 `ping` 的基础上加了友好的输出,这可让我感觉命令行友好了很多呢。
|
||||
|
||||
![/images/cli-improved/ping.gif][6]
|
||||
![prettyping][6]
|
||||
|
||||
我也将 `ping` 用别名链接到了 `prettyping` 命令:
|
||||
|
||||
@ -44,16 +44,20 @@ alias cat='bat'
|
||||
alias ping='prettyping --nolegend'
|
||||
```
|
||||
|
||||
💾 [安装指引][7]
|
||||
- [安装指引][7]
|
||||
|
||||
### fzf > ctrl+r
|
||||
|
||||
在命令行上使用 `ctrl+r` 将允许你在命令历史里[反向搜索][8]使用过的命令,这是个挺好的小技巧,但是它需要你给出非常精确的输入才能正常运行。
|
||||
在终端里,使用 `ctrl+r` 将允许你在命令历史里[反向搜索][8]使用过的命令,这是个挺好的小技巧,尽管它有点麻烦。
|
||||
|
||||
`fzf` 这个工具相比于 `ctrl+r` 有了**巨大的**进步。它能针对命令行历史进行模糊查询,并且提供了对可能的合格结果进行全面交互式预览。
|
||||
|
||||
![视频](https://player.vimeo.com/video/217497007)
|
||||
|
||||
除了搜索命令历史,`fzf` 还能预览和打开文件,我在下面的视频里展示了这些功能。
|
||||
|
||||
![视频](https://player.vimeo.com/video/286345188)
|
||||
|
||||
为了这个预览的效果,我创建了一个叫 `preview` 的别名,它将 `fzf` 和前文提到的 `bat` 组合起来完成预览功能,还给上面绑定了一个定制的热键 `ctrl+o` 来打开 VS Code:
|
||||
|
||||
```
|
||||
@ -62,7 +66,7 @@ alias preview="fzf --preview 'bat --color \"always\" {}'"
|
||||
export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(code {})+abort'"
|
||||
```
|
||||
|
||||
💾 [安装指引][9]
|
||||
- [安装指引][9]
|
||||
|
||||
### htop > top
|
||||
|
||||
@ -72,10 +76,10 @@ export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(code {})+abort'"
|
||||
|
||||
一些很容易上手的热键:
|
||||
|
||||
* P - 按 CPU 使用率排序
|
||||
* M - 按内存使用排序
|
||||
* F4 - 用字符串过滤进程(例如只看包括 node 的进程)
|
||||
* space - 锚定一个单独进程,这样我能观察它是否有尖峰状态
|
||||
* `P` —— 按 CPU 使用率排序
|
||||
* `M` —— 按内存使用排序
|
||||
* `F4` —— 用字符串过滤进程(例如只看包括 node 的进程)
|
||||
* `space` —— 锚定一个单独进程,这样我能观察它是否有尖峰状态
|
||||
|
||||
![htop output][10]
|
||||
|
||||
@ -85,7 +89,7 @@ export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(code {})+abort'"
|
||||
alias top="sudo htop" # 给 top 加上别名并且绕过 Sierra 上的 bug
|
||||
```
|
||||
|
||||
💾 [安装指引][11]
|
||||
- [安装指引][11]
|
||||
|
||||
### diff-so-fancy > diff
|
||||
|
||||
@ -101,7 +105,7 @@ alias top="sudo htop" # 给 top 加上别名并且绕过 Sierra 上的 bug
|
||||
show = diff-so-fancy | less --tabs=1,5 -RFX
|
||||
```
|
||||
|
||||
💾 [安装指引][13]
|
||||
- [安装指引][13]
|
||||
|
||||
### fd > find
|
||||
|
||||
@ -121,23 +125,23 @@ $ fd cli -x wc -w # 搜索 "cli" 并且在每个搜索结果上运行 `wc -w`
|
||||
|
||||
![fd output][15]
|
||||
|
||||
💾 [安装指引][16]
|
||||
- [安装指引][16]
|
||||
|
||||
### ncdu > du
|
||||
|
||||
对我来说,知道当前磁盘空间被什么占用了非常重要。我用过 Mac 上的 [DaisyDisk][17],但是我觉得那个程序产生结果有点慢。
|
||||
|
||||
`du -sh` 命令是我经常会跑的命令(`-sh` 是指结果以“汇总”和“人类可读”的方式显示),我经常会想要深入挖掘那些占用了大量磁盘空间的目录,看看到底是什么在占用空间。
|
||||
`du -sh` 命令是我经常会运行的命令(`-sh` 是指结果以“汇总”和“人类可读”的方式显示),我经常会想要深入挖掘那些占用了大量磁盘空间的目录,看看到底是什么在占用空间。
|
||||
|
||||
`ncdu` 是一个非常棒的替代品。它提供了一个交互式的界面并且允许快速的扫描那些占用了大量磁盘空间的目录和文件,它又快又准。(尽管不管在哪个工具的情况下,扫描我的 home 目录都要很长时间,它有 550G)
|
||||
|
||||
一旦当我找到一个目录我想要“处理”一下(如删除,移动或压缩文件),我会使用 `commond+` 点击 [iTerm2][18] 上部的目录名字的方法在 Finder 中打开它。
|
||||
一旦当我找到一个目录我想要“处理”一下(如删除,移动或压缩文件),我会使用 `cmd` + 点击 [iTerm2][18] 顶部的目录名字的方法在 Finder 中打开它。
|
||||
|
||||
![ncdu output][19]
|
||||
|
||||
还有另外一个选择[一个叫 nnn 的另外选择][20],它提供了一个更漂亮的界面,它也提供文件尺寸和使用情况,实际上它更像一个全功能的文件管理器。
|
||||
还有另外[一个叫 nnn 的替代选择][20],它提供了一个更漂亮的界面,它也提供文件尺寸和使用情况,实际上它更像一个全功能的文件管理器。
|
||||
|
||||
我的 `ncdu` 使用下面的别名:
|
||||
我的 `du` 是如下的别名:
|
||||
|
||||
```
|
||||
alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
|
||||
@ -146,16 +150,16 @@ alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
|
||||
选项说明:
|
||||
|
||||
* `--color dark` 使用颜色方案
|
||||
* `-rr` 只读模式(防止误删和运行新的登陆程序)
|
||||
* `-rr` 只读模式(防止误删和运行新的 shell 程序)
|
||||
* `--exclude` 忽略不想操作的目录
|
||||
|
||||
💾 [安装指引][21]
|
||||
- [安装指引][21]
|
||||
|
||||
### tldr > man
|
||||
|
||||
几乎所有的命令行工具都有一个相伴的手册,它可以被 `man <命令名>` 来调出,但是在 `man` 的输出里找到东西可有点让人困惑,而且在一个包含了所有的技术细节的输出里找东西也挺可怕的。
|
||||
|
||||
这就是 TL;DR(译注:英文里“文档太长,没空去读”的缩写)项目创建的初衷。这是一个由社区驱动的文档系统,而且针对的是命令行。就我现在用下来,我还没碰到过一个命令没有它相应的文档,你[也可以做贡献][22]。
|
||||
这就是 TL;DR 项目(LCTT 译注:英文里“文档太长,没空去读”的缩写)创建的初衷。这是一个由社区驱动的文档系统,而且可以用在命令行上。就我现在使用的经验,我还没碰到过一个命令没有它相应的文档,你[也可以做贡献][22]。
|
||||
|
||||
![TLDR output for 'fd'][23]
|
||||
|
||||
@ -165,15 +169,15 @@ alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
|
||||
alias help='tldr'
|
||||
```
|
||||
|
||||
💾 [安装指引][24]
|
||||
- [安装指引][24]
|
||||
|
||||
### ack || ag > grep
|
||||
|
||||
`grep` 毫无疑问是一个强力的命令行工具,但是这些年来它已经被一些工具超越了,其中两个叫 `ack` 和 `ag`。
|
||||
|
||||
我个人对 `ack` 和 `ag` 都尝试过,而且没有非常明显的个人偏好,(那也就是说它们都很棒,并且很相似)。我倾向于默认只使用 `ack`,因为这三个字符就在指尖,很好打。并且 `ack` 有大量的 `ack --` 参数可以使用!(你一定会体会到这一点。)
|
||||
我个人对 `ack` 和 `ag` 都尝试过,而且没有非常明显的个人偏好,(也就是说它们都很棒,并且很相似)。我倾向于默认只使用 `ack`,因为这三个字符就在指尖,很好打。并且 `ack` 有大量的 `ack --bar` 参数可以使用!(你一定会体会到这一点。)
|
||||
|
||||
`ack` 和 `ag` 都使用正则表达式来搜索,这非常契合我的工作,我能指定文件类型搜索,类似于 `--js` 或 `--html` 这种文件标识。(尽管 `ag` 比 `ack` 在文件类型过滤器里包括了更多的文件类型。)
|
||||
`ack` 和 `ag` 默认都使用正则表达式来搜索,这非常契合我的工作,我能使用类似于 `--js` 或 `--html` 这种标识指定文件类型搜索。(尽管 `ag` 比 `ack` 在文件类型过滤器里包括了更多的文件类型。)
|
||||
|
||||
两个工具都支持常见的 `grep` 选项,如 `-B` 和 `-A` 用于在搜索的上下文里指代“之前”和“之后”。
|
||||
|
||||
@ -186,9 +190,8 @@ alias help='tldr'
|
||||
--pager=less -FRX
|
||||
```
|
||||
|
||||
💾 安装指引: [ack][26], [ag][27]
|
||||
|
||||
[关于 ack & ag 的更多信息][28]
|
||||
- 安装指引:[ack][26],[ag][27]
|
||||
- [关于 ack & ag 的更多信息][28]
|
||||
|
||||
### jq > grep 及其它
|
||||
|
||||
@ -224,7 +227,12 @@ $ npm i $(echo $(\
|
||||
}
|
||||
```
|
||||
|
||||
转换结果为:(译注:原文此处并未给出结果)
|
||||
转换结果为:
|
||||
|
||||
```
|
||||
node-jq@1.2.0
|
||||
uuid@3.2.1
|
||||
```
|
||||
|
||||
上面的结果会被作为 `npm install` 的输入,你瞧,我的升级就这样全部搞定了。(当然,这里有点小题大做了。)
|
||||
|
||||
@ -248,7 +256,7 @@ via: https://remysharp.com/2018/08/23/cli-improved
|
||||
作者:[Remy Sharp][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[DavidChenLiang](https://github.com/DavidChenLiang)
|
||||
校对:[pityonline](https://github.com/pityonline)
|
||||
校对:[pityonline](https://github.com/pityonline), [wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,6 +1,7 @@
|
||||
用这个漂亮的工具将方程式截图迅速转换为 LaTeX
|
||||
======
|
||||
**Mathpix 是一个漂亮的小工具,它允许你截取复杂数学方程式的截图,并立即将其转换为 LaTeX 可编辑文本。**
|
||||
|
||||
> Mathpix 是一个漂亮的小工具,它允许你截取复杂数学方程式的截图,并立即将其转换为 LaTeX 可编辑文本。
|
||||
|
||||
![Mathpix converts math equations images into LaTeX][1]
|
||||
|
||||
@ -10,15 +11,11 @@
|
||||
|
||||
[Mathpix][3] 是一个在这方面可以帮助你的小工具。
|
||||
|
||||
假设你正在阅读带有数学方程式的文档。如果你想在[LaTeX 文档][4]中使用这些方程,你需要使用你的 LaTeX 技能和有充足的时间。
|
||||
假设你正在阅读带有数学方程式的文档。如果你想在 [LaTeX 文档][4]中使用这些方程,你需要使用你的 LaTeX 技能,并且得有充足的时间。
|
||||
|
||||
但是 Mathpix 为您解决了这个问题。使用 Mathpix,你截取数学方程式的截图,它会立即为你提供 LaTeX 代码。然后,你可以在你[最喜欢的 LaTeX 编辑器] [2]中使用此代码。
|
||||
但是 Mathpix 为您解决了这个问题。使用 Mathpix,你可以截取数学方程式的截图,它会立即为你提供 LaTeX 代码。然后,你可以在你[最喜欢的 LaTeX 编辑器] [2]中使用此代码。
|
||||
|
||||
请参阅以下视频中的 Mathpix 使用:
|
||||
|
||||
<https://itsfoss.com/wp-content/uploads/2018/10/mathpix.mp4>
|
||||
|
||||
[视频来源][5]:Reddit 用户 [kaitlinmcunningham][6]
|
||||
请参阅[该视频](https://itsfoss.com/wp-content/uploads/2018/10/mathpix.mp4)中的 Mathpix 使用方式。([视频来源][5]:Reddit 用户 [kaitlinmcunningham][6])
|
||||
|
||||
不是超酷吗?我想编写 LaTeX 文档最困难的部分是那些复杂的方程式。对于像我这样懒人,Mathpix 是天赐之物。
|
||||
|
||||
@ -32,14 +29,13 @@ Mathpix 适用于 Linux、macOS、Windows 和 iOS。暂时还没有 Android 应
|
||||
|
||||
```
|
||||
sudo snap install mathpix-snipping-tool
|
||||
|
||||
```
|
||||
|
||||
使用 Mathpix 很简单。安装后,打开该工具。你会在顶部面板中找到它。你可以使用键盘快捷键 Ctrl+Alt+M 开始使用 Mathpix 截图。
|
||||
使用 Mathpix 很简单。安装后,打开该工具。你会在顶部面板中找到它。你可以使用键盘快捷键 `Ctrl+Alt+M` 开始使用 Mathpix 截图。
|
||||
|
||||
它会立即将方程图片转换为 LaTeX 代码。代码将被复制到剪贴板中,然后你可以将其粘贴到 LaTeX 编辑器中。
|
||||
|
||||
Mathpix 的光学字符识别技术[正在被][9]许多公司像 [WolframAlpha][10]、微软、谷歌等公司用于在处理数学符号时提升工具的图像识别能力。
|
||||
Mathpix 的光学字符识别技术[正在被][9]像 [WolframAlpha][10]、微软、谷歌等许多公司用于在处理数学符号时提升工具的图像识别能力。
|
||||
|
||||
总而言之,它对学生和学者来说是一个很棒的工具。它是免费使用的,我非常希望它是一个开源工具。但我们无法在生活中得到一切,不是么?
|
||||
|
||||
@ -52,7 +48,7 @@ via: https://itsfoss.com/mathpix/
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/10/vlock-720x340.png)
|
||||
|
||||
当你在共享系统上工作时,你可能不希望其他用户在你的控制台中悄悄地看你在做什么。如果是这样,我知道有个简单的技巧来锁定自己的会话,同时仍然允许其他用户在其他虚拟控制台上使用该系统。要感谢 **Vlock**(**V** irtual Console **lock**),这是一个命令行程序,用于锁定 Linux 控制台上的一个或多个会话。如有必要,你可以锁定整个控制台并完全禁用虚拟控制台切换功能。Vlock 对于有多个用户访问控制台的共享 Linux 系统特别有用。
|
||||
当你在共享的系统上工作时,你可能不希望其他用户偷窥你的控制台中看你在做什么。如果是这样,我知道有个简单的技巧来锁定自己的会话,同时仍然允许其他用户在其他虚拟控制台上使用该系统。要感谢 **Vlock**(**V**irtual Console **lock**),这是一个命令行程序,用于锁定 Linux 控制台上的一个或多个会话。如有必要,你可以锁定整个控制台并完全禁用虚拟控制台切换功能。Vlock 对于有多个用户访问控制台的共享 Linux 系统特别有用。
|
||||
|
||||
### 安装 Vlock
|
||||
|
||||
@ -12,96 +12,94 @@
|
||||
在 Debian、Ubuntu、Linux Mint 上,运行以下命令来安装 Vlock:
|
||||
|
||||
```
|
||||
$ sudo apt-get install vlock
|
||||
$ sudo apt-get install vlock
|
||||
```
|
||||
|
||||
在 Fedora 上:
|
||||
|
||||
```
|
||||
$ sudo dnf install vlock
|
||||
$ sudo dnf install vlock
|
||||
```
|
||||
|
||||
在 RHEL、CentOS 上:
|
||||
|
||||
```
|
||||
$ sudo yum install vlock
|
||||
$ sudo yum install vlock
|
||||
```
|
||||
|
||||
### 在Linux上锁定虚拟控制台会话
|
||||
### 在 Linux 上锁定虚拟控制台会话
|
||||
|
||||
Vlock 的一般语法是:
|
||||
|
||||
```
|
||||
vlock [ -acnshv ] [ -t <timeout> ] [ plugins... ]
|
||||
vlock [ -acnshv ] [ -t <timeout> ] [ plugins... ]
|
||||
```
|
||||
|
||||
这里:
|
||||
|
||||
* **a** – 锁定所有虚拟控制台会话,
|
||||
* **c** – 锁定当前虚拟控制台会话,
|
||||
* **n** – 在锁定所有会话之前切换到新的空控制台,
|
||||
* **s** – 禁用 SysRq 键机制,
|
||||
* **t** – 指定屏保插件的超时时间,
|
||||
* **h** – 显示帮助,
|
||||
* **v** – 显示版本。
|
||||
|
||||
|
||||
* `a` —— 锁定所有虚拟控制台会话,
|
||||
* `c` —— 锁定当前虚拟控制台会话,
|
||||
* `n` —— 在锁定所有会话之前切换到新的空控制台,
|
||||
* `s` —— 禁用 SysRq 键机制,
|
||||
* `t` —— 指定屏保插件的超时时间,
|
||||
* `h` —— 显示帮助,
|
||||
* `v` —— 显示版本。
|
||||
|
||||
让我举几个例子。
|
||||
|
||||
**1\. 锁定当前控制台会话**
|
||||
#### 1、 锁定当前控制台会话
|
||||
|
||||
在没有任何参数的情况下运行 Vlock 时,它默认锁定当前控制台会话 (TYY)。要解锁会话,你需要输入当前用户的密码或 root 密码。
|
||||
|
||||
```
|
||||
$ vlock
|
||||
$ vlock
|
||||
```
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/10/vlock-1-1.gif)
|
||||
|
||||
你还可以使用 **-c** 标志来锁定当前的控制台会话。
|
||||
你还可以使用 `-c` 标志来锁定当前的控制台会话。
|
||||
|
||||
```
|
||||
$ vlock -c
|
||||
$ vlock -c
|
||||
```
|
||||
|
||||
请注意,此命令仅锁定当前控制台。你可以按 **ALT+F2** 切换到其他控制台。有关在 TTY 之间切换的更多详细信息,请参阅以下指南。
|
||||
请注意,此命令仅锁定当前控制台。你可以按 `ALT+F2` 切换到其他控制台。有关在 TTY 之间切换的更多详细信息,请参阅以下指南。
|
||||
|
||||
此外,如果系统有多个用户,则其他用户仍可以访问其各自的 TTY。
|
||||
|
||||
**2\. 锁定所有控制台会话**
|
||||
#### 2、 锁定所有控制台会话
|
||||
|
||||
要同时锁定所有 TTY 并禁用虚拟控制台切换功能,请运行:
|
||||
|
||||
```
|
||||
$ vlock -a
|
||||
$ vlock -a
|
||||
```
|
||||
|
||||
同样,要解锁控制台会话,只需按下回车键并输入当前用户的密码或 root 用户密码。
|
||||
|
||||
请记住,**root 用户可以随时解锁任何 vlock 会话**,除非在编译时禁用。
|
||||
|
||||
**3\. 在锁定所有控制台之前切换到新的虚拟控制台**
|
||||
#### 3、 在锁定所有控制台之前切换到新的虚拟控制台
|
||||
|
||||
在锁定所有控制台之前,还可以使 Vlock 从 X 会话切换到新的空虚拟控制台。为此,请使用 **-n** 标志。
|
||||
在锁定所有控制台之前,还可以使 Vlock 从 X 会话切换到新的空虚拟控制台。为此,请使用 `-n` 标志。
|
||||
|
||||
```
|
||||
$ vlock -n
|
||||
$ vlock -n
|
||||
```
|
||||
|
||||
**4\. 禁用 SysRq 机制**
|
||||
#### 4、 禁用 SysRq 机制
|
||||
|
||||
你也许知道,魔术 SysRq 键机制允许用户在系统死机时执行某些操作。因此,用户可以使用 SysRq 解锁控制台。为了防止这种情况,请传递 **-s** 选项以禁用 SysRq 机制。请记住,这只适用于有 **-a** 选项的时候。
|
||||
你也许知道,魔术 SysRq 键机制允许用户在系统死机时执行某些操作。因此,用户可以使用 SysRq 解锁控制台。为了防止这种情况,请传递 `-s` 选项以禁用 SysRq 机制。请记住,这个选项只适用于有 `-a` 选项的时候。
|
||||
|
||||
```
|
||||
$ vlock -sa
|
||||
$ vlock -sa
|
||||
```
|
||||
|
||||
有关更多选项及其用法,请参阅帮助或手册页。
|
||||
|
||||
```
|
||||
$ vlock -h
|
||||
$ man vlock
|
||||
$ vlock -h
|
||||
$ man vlock
|
||||
```
|
||||
|
||||
Vlock 可防止未经授权的用户获得控制台访问权限。如果你在为 Linux 寻找一个简单的控制台锁定机制,那么 Vlock 值得一试!
|
||||
@ -111,7 +109,6 @@ Vlock 可防止未经授权的用户获得控制台访问权限。如果你在
|
||||
干杯!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-lock-virtual-console-sessions-on-linux/
|
||||
@ -119,7 +116,7 @@ via: https://www.ostechnix.com/how-to-lock-virtual-console-sessions-on-linux/
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,3 +1,4 @@
|
||||
Translating by Felix
|
||||
20 questions DevOps job candidates should be prepared to answer
|
||||
======
|
||||
|
||||
|
@ -0,0 +1,132 @@
|
||||
What breaks our systems: A taxonomy of black swans
|
||||
======
|
||||
|
||||
Find and fix outlier events that create issues before they trigger severe production problems.
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/black-swan-pair_0.png?itok=MkshwqVg)
|
||||
|
||||
Black swans are a metaphor for outlier events that are severe in impact (like the 2008 financial crash). In production systems, these are the incidents that trigger problems that you didn't know you had, cause major visible impact, and can't be fixed quickly and easily by a rollback or some other standard response from your on-call playbook. They are the events you tell new engineers about years after the fact.
|
||||
|
||||
Black swans, by definition, can't be predicted, but sometimes there are patterns we can find and use to create defenses against categories of related problems.
|
||||
|
||||
For example, a large proportion of failures are a direct result of changes (code, environment, or configuration). Each bug triggered in this way is distinctive and unpredictable, but the common practice of canarying all changes is somewhat effective against this class of problems, and automated rollbacks have become a standard mitigation.
|
||||
|
||||
As our profession continues to mature, other kinds of problems are becoming well-understood classes of hazards with generalized prevention strategies.
|
||||
|
||||
### Black swans observed in the wild
|
||||
|
||||
All technology organizations have production problems, but not all of them share their analyses. The organizations that publicly discuss incidents are doing us all a service. The following incidents describe one class of a problem and are by no means isolated instances. We all have black swans lurking in our systems; it's just some of us don't know it yet.
|
||||
|
||||
#### Hitting limits
|
||||
|
||||
Running headlong into any sort of limit can produce very severe incidents. A canonical example of this was [Instapaper's outage in February 2017][1] . I challenge any engineer who has carried a pager to read the outage report without a chill running up their spine. Instapaper's production database was on a filesystem that, unknown to the team running the service, had a 2TB limit. With no warning, it stopped accepting writes. Full recovery took days and required migrating its database.
|
||||
|
||||
Limits can strike in various ways. Sentry hit [limits on maximum transaction IDs in Postgres][2] . Platform.sh hit [size limits on a pipe buffer][3] . SparkPost [triggered AWS's DDoS protection][4] . Foursquare hit a performance cliff when one of its [datastores ran out of RAM][5]
|
||||
|
||||
One way to get advance knowledge of system limits is to test periodically. Good load testing (on a production replica) ought to involve write transactions and should involve growing each datastore beyond its current production size. It's easy to forget to test things that aren't your main datastores (such as Zookeeper). If you hit limits during testing, you have time to fix the problems. Given that resolution of limits-related issues can involve major changes (like splitting a datastore), time is invaluable.
|
||||
|
||||
When it comes to cloud services, if your service generates unusual loads or uses less widely used products or features (such as older or newer ones), you may be more at risk of hitting limits. It's worth load testing these, too. But warn your cloud provider first.
|
||||
|
||||
Finally, where limits are known, add monitoring (with associated documentation) so you will know when your systems are approaching those ceilings. Don't rely on people still being around to remember.
|
||||
|
||||
#### Spreading slowness
|
||||
|
||||
> "The world is much more correlated than we give credit to. And so we see more of what Nassim Taleb calls 'black swan events'—rare events happen more often than they should because the world is more correlated."
|
||||
> —[Richard Thaler][6]
|
||||
|
||||
HostedGraphite's postmortem on how an [AWS outage took down its load balancers][7] (which are not hosted on AWS) is a good example of just how much correlation exists in distributed computing systems. In this case, the load-balancer connection pools were saturated by slow connections from customers that were hosted in AWS. The same kinds of saturation can happen with application threads, locks, and database connections—any kind of resource monopolized by slow operations.
|
||||
|
||||
HostedGraphite's incident is an example of externally imposed slowness, but often slowness can result from saturation somewhere in your own system creating a cascade and causing other parts of your system to slow down. An [incident at Spotify][8] demonstrates such spread—the streaming service's frontends became unhealthy due to saturation in a different microservice. Enforcing deadlines for all requests, as well as limiting the length of request queues, can prevent such spread. Your service will serve at least some traffic, and recovery will be easier because fewer parts of your system will be broken.
|
||||
|
||||
Retries should be limited with exponential backoff and some jitter. An outage at Square, in which its [Redis datastore became overloaded][9] due to a piece of code that retried failed transactions up to 500 times with no backoff, demonstrates the potential severity of excessive retries. The [Circuit Breaker][10] design pattern can be helpful here, too.
|
||||
|
||||
Dashboards should be designed to clearly show [utilization, saturation, and errors][11] for all resources so problems can be found quickly.
|
||||
|
||||
#### Thundering herds
|
||||
|
||||
Often, failure scenarios arise when a system is under unusually heavy load. This can arise organically from users, but often it arises from systems. A surge of cron jobs that starts at midnight is a venerable example. Mobile clients can also be a source of coordinated demand if they are programmed to fetch updates at the same time (of course, it is much better to jitter such requests).
|
||||
|
||||
Events occurring at pre-configured times aren't the only source of thundering herds. Slack experienced [multiple outages][12] over a short time due to large numbers of clients being disconnected and immediately reconnecting, causing large spikes of load. CircleCI saw a [severe outage][13] when a GitLab outage ended, leading to a surge of builds queued in its database, which became saturated and very slow.
|
||||
|
||||
Almost any service can be the target of a thundering herd. Planning for such eventualities—and testing that your plan works as intended—is therefore a must. Client backoff and [load shedding][14] are often core to such approaches.
|
||||
|
||||
If your systems must constantly ingest data that can't be dropped, it's key to have a scalable way to buffer this data in a queue for later processing.
|
||||
|
||||
#### Automation systems are complex systems
|
||||
|
||||
> "Complex systems are intrinsically hazardous systems."
|
||||
> —[Richard Cook, MD][15]
|
||||
|
||||
If your systems must constantly ingest data that can't be dropped, it's key to have a scalable way to buffer this data in a queue for later processing.
|
||||
|
||||
The trend for the past several years has been strongly towards more automation of software operations. Automation of anything that can reduce your system's capacity (e.g., erasing disks, decommissioning devices, taking down serving jobs) needs to be done with care. Accidents (due to bugs or incorrect invocations) with this kind of automation can take down your system very efficiently, potentially in ways that are hard to recover from.
|
||||
|
||||
The trend for the past several years has been strongly towards more automation of software operations. Automation of anything that can reduce your system's capacity (e.g., erasing disks, decommissioning devices, taking down serving jobs) needs to be done with care. Accidents (due to bugs or incorrect invocations) with this kind of automation can take down your system very efficiently, potentially in ways that are hard to recover from.
|
||||
|
||||
Christina Schulman and Etienne Perot of Google describe some examples in their talk [Help Protect Your Data Centers with Safety Constraints][16]. One incident sent Google's entire in-house content delivery network (CDN) to disk-erase.
|
||||
|
||||
Schulman and Perot suggest using a central service to manage constraints, which limits the pace at which destructive automation can operate, and being aware of system conditions (for example, avoiding destructive operations if the service has recently had an alert).
|
||||
|
||||
Automation systems can also cause havoc when they interact with operators (or with other automated systems). [Reddit][17] experienced a major outage when its automation restarted a system that operators had stopped for maintenance. Once you have multiple automation systems, their potential interactions become extremely complex and impossible to predict.
|
||||
|
||||
It will help to deal with the inevitable surprises if all this automation writes logs to an easily searchable, central place. Automation systems should always have a mechanism to allow them to be quickly turned off (fully or only for a subset of operations or targets).
|
||||
|
||||
### Defense against the dark swans
|
||||
|
||||
These are not the only black swans that might be waiting to strike your systems. There are many other kinds of severe problem that can be avoided using techniques such as canarying, load testing, chaos engineering, disaster testing, and fuzz testing—and of course designing for redundancy and resiliency. Even with all that, at some point your system will fail.
|
||||
|
||||
To ensure your organization can respond effectively, make sure your key technical staff and your leadership have a way to coordinate during an outage. For example, one unpleasant issue you might have to deal with is a complete outage of your network. It's important to have a fail-safe communications channel completely independent of your own infrastructure and its dependencies. For instance, if you run on AWS, using a service that also runs on AWS as your fail-safe communication method is not a good idea. A phone bridge or an IRC server that runs somewhere separate from your main systems is good. Make sure everyone knows what the communications platform is and practices using it.
|
||||
|
||||
Another principle is to ensure that your monitoring and your operational tools rely on your production systems as little as possible. Separate your control and your data planes so you can make changes even when systems are not healthy. Don't use a single message queue for both data processing and config changes or monitoring, for example—use separate instances. In [SparkPost: The Day the DNS Died][4], Jeremy Blosser presents an example where critical tools relied on the production DNS setup, which failed.
|
||||
|
||||
### The psychology of battling the black swan
|
||||
|
||||
To ensure your organization can respond effectively, make sure your key technical staff and your leadership have a way to coordinate during an outage.
|
||||
|
||||
Dealing with major incidents in production can be stressful. It really helps to have a structured incident-management process in place for these situations. Many technology organizations (
|
||||
|
||||
Dealing with major incidents in production can be stressful. It really helps to have a structured incident-management process in place for these situations. Many technology organizations ( [including Google][18] ) successfully use a version of FEMA's Incident Command System. There should be a clear way for any on-call individual to call for assistance in the event of a major problem they can't resolve alone.
|
||||
|
||||
For long-running incidents, it's important to make sure people don't work for unreasonable lengths of time and get breaks to eat and sleep (uninterrupted by a pager). It's easy for exhausted engineers to make a mistake or overlook something that might resolve the incident faster.
|
||||
|
||||
### Learn more
|
||||
|
||||
There are many other things that could be said about black (or formerly black) swans and strategies for dealing with them. If you'd like to learn more, I highly recommend these two books dealing with resilience and stability in production: Susan Fowler's [Production-Ready Microservices][19] and Michael T. Nygard's [Release It!][20].
|
||||
|
||||
Laura Nolan will present [What Breaks Our Systems: A Taxonomy of Black Swans][21] at [LISA18][22], October 29-31 in Nashville, Tennessee, USA.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/10/taxonomy-black-swans
|
||||
|
||||
作者:[Laura Nolan][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/lauranolan
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://medium.com/making-instapaper/instapaper-outage-cause-recovery-3c32a7e9cc5f
|
||||
[2]: https://blog.sentry.io/2015/07/23/transaction-id-wraparound-in-postgres.html
|
||||
[3]: https://medium.com/@florian_7764/technical-post-mortem-of-the-august-incident-82ab4c3d6547
|
||||
[4]: https://www.usenix.org/conference/srecon18americas/presentation/blosser
|
||||
[5]: https://groups.google.com/forum/#!topic/mongodb-user/UoqU8ofp134
|
||||
[6]: https://en.wikipedia.org/wiki/Richard_Thaler
|
||||
[7]: https://blog.hostedgraphite.com/2018/03/01/spooky-action-at-a-distance-how-an-aws-outage-ate-our-load-balancer/
|
||||
[8]: https://labs.spotify.com/2013/06/04/incident-management-at-spotify/
|
||||
[9]: https://medium.com/square-corner-blog/incident-summary-2017-03-16-2f65be39297
|
||||
[10]: https://en.wikipedia.org/wiki/Circuit_breaker_design_pattern
|
||||
[11]: http://www.brendangregg.com/usemethod.html
|
||||
[12]: https://slackhq.com/this-was-not-normal-really
|
||||
[13]: https://circleci.statuspage.io/incidents/hr0mm9xmm3x6
|
||||
[14]: https://www.youtube.com/watch?v=XNEIkivvaV4
|
||||
[15]: https://web.mit.edu/2.75/resources/random/How%20Complex%20Systems%20Fail.pdf
|
||||
[16]: https://www.usenix.org/conference/srecon18americas/presentation/schulman
|
||||
[17]: https://www.reddit.com/r/announcements/comments/4y0m56/why_reddit_was_down_on_aug_11/
|
||||
[18]: https://landing.google.com/sre/book/chapters/managing-incidents.html
|
||||
[19]: http://shop.oreilly.com/product/0636920053675.do
|
||||
[20]: https://www.oreilly.com/library/view/release-it/9781680500264/
|
||||
[21]: https://www.usenix.org/conference/lisa18/presentation/nolan
|
||||
[22]: https://www.usenix.org/conference/lisa18
|
@ -1,3 +1,5 @@
|
||||
Translating by cielllll
|
||||
|
||||
Three Alternatives for Enabling Two Factor Authentication For SSH On Ubuntu 16.04 And Debian Jessie
|
||||
======
|
||||
Security is now more important than ever and securing your SSH server is one of the most important things that you can do as a systems administrator. Traditionally this has meant disabling password authentication and instead using SSH keys. Whilst this is absolutely the first thing you should do that doesn't mean that SSH can't be made even more secure.
|
||||
|
@ -1,3 +1,5 @@
|
||||
translating---geekpi
|
||||
|
||||
6 open source tools for writing a book
|
||||
======
|
||||
|
||||
|
@ -0,0 +1,178 @@
|
||||
Translating by StdioA
|
||||
|
||||
Design faster web pages, part 2: Image replacement
|
||||
======
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2018/03/fasterwebsites2-816x345.jpg)
|
||||
|
||||
Welcome back to this series on building faster web pages. The last [article][1] talked about what you can achieve just through image compression. The example started with 1.2MB of browser fat, and reduced down to a weight of 488.9KB. That’s still not fast enough! This article continues the browser diet to lose more fat. You might think that partway through this process things are a bit crazy, but once finished, you’ll understand why.
|
||||
|
||||
### Preparation
|
||||
|
||||
Once again this article starts with an analysis of the web pages. Use the built-in screenshot function of Firefox to make a screenshot of the entire page. You’ll also want to install Inkscape [using sudo][2]:
|
||||
|
||||
```
|
||||
$ sudo dnf install inkscape
|
||||
```
|
||||
|
||||
If you want to know how to use Inkscape, there are already several [articles][3] in Fedora Magazine. This article will only explain some basic tasks for optimizing an SVG for web use.
|
||||
|
||||
### Analysis
|
||||
|
||||
Once again, this example uses the [getfedora.org][4] web page.
|
||||
|
||||
![Getfedora page with graphics marked][5]
|
||||
|
||||
This analysis is better done graphically, which is why it starts with a screenshot. The screenshot above marks all graphical elements of the page. In two cases or better in four cases, the Fedora websites team already used measures to replace images. The icons for social media are glyphs from a font and the language selector is an SVG.
|
||||
|
||||
There are several options for replacing:
|
||||
|
||||
|
||||
+ CSS3
|
||||
+ Fonts
|
||||
+ SVG
|
||||
+ HTML5 Canvas
|
||||
|
||||
|
||||
#### HTML5 Canvas
|
||||
|
||||
Briefly, HTML5 Canvas is an HTML element that allows you to draw with the help of scripts, mostly JavaScript, although it’s not widely used yet. As you draw with the help of scripts, the element can also be animated. Some examples of what you can achieve with HTML Canvas include this [triangle pattern,][6] [animated wave][7], and [text animation][8]. In this case, though, it seems not to be the right choice.
|
||||
|
||||
#### CSS3
|
||||
|
||||
With Cascading Style Sheets you can draw shapes and even animate them. CSS is often used for drawing elements like buttons. However, more complicated graphics via CSS are usually only seen in technical demonstration pages. This is because graphics are still better done visually as with coding.
|
||||
|
||||
#### Fonts
|
||||
|
||||
The usage of fonts for styling web pages is another way, and [Fontawesome][9] is quiet popular. For instance, you could replace the Flavor and the Spin icons with a font in this example. There is a negative side to using this method, which will be covered in the next part of this series, but it can be done easily.
|
||||
|
||||
#### SVG
|
||||
|
||||
This graphics format has existed for a long time and was always supposed to be used in the browser. For a long time not all browsers supported it, but that’s history. So the best way to replace pictures in this example is with SVG.
|
||||
|
||||
### Optimizing SVG for the web
|
||||
|
||||
To optimize an SVG for internet use requires several steps.
|
||||
|
||||
SVG is an XML dialect. Components like circle, rectangle, or text paths are described with nodes. Each node is an XML element. To keep the code clean, an SVG should use as few nodes as possible.
|
||||
|
||||
The SVG example is a circular icon with a coffee mug on it. You have 3 options to describe it with SVG.
|
||||
|
||||
#### Circle element with the mug on top
|
||||
|
||||
```
|
||||
<circle
|
||||
style="opacity:1;fill:#717d82;fill-opacity:1;stroke:none;stroke-width:9.51950836;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke"
|
||||
id="path36"
|
||||
cx="68.414307"
|
||||
cy="130.71523"
|
||||
r="3.7620001" />
|
||||
```
|
||||
|
||||
#### Circular path with the mug on top
|
||||
|
||||
```
|
||||
<path
|
||||
style="opacity:1;fill:#717d82;fill-opacity:1;stroke:none;stroke-width:1.60968435;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke"
|
||||
d="m 68.414044,126.95318 a 3.7618673,3.7618673 0 0 0 -3.76153,3.76204 3.7618673,3.7618673 0 0 0 3.76153,3.76205 3.7618673,3.7618673 0 0 0 3.76206,-3.76205 3.7618673,3.7618673 0 0 0 -3.76206,-3.76204 z"
|
||||
id="path20" />
|
||||
```
|
||||
|
||||
#### single path
|
||||
|
||||
```
|
||||
<path
|
||||
style="opacity:1;fill:#717d82;fill-opacity:1;stroke:none;stroke-width:1.60968435;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers fill stroke"
|
||||
d="m 68.414044,126.95318 a 3.7618673,3.7618673 0 0 0 -3.76153,3.76204 3.7618673,3.7618673 0 0 0 3.76153,3.76205 3.7618673,3.7618673 0 0 0 3.76206,-3.76205 3.7618673,3.7618673 0 0 0 -3.76206,-3.76204 z m -1.21542,0.92656 h 2.40554 c 0.0913,0.21025 0.18256,0.42071 0.27387,0.63097 h 0.47284 v 0.60099 h -0.17984 l -0.1664,1.05989 h 0.24961 l -0.34779,1.96267 -0.21238,-0.003 -0.22326,1.41955 h -2.12492 l -0.22429,-1.41955 -0.22479,0.003 -0.34829,-1.96267 h 0.26304 l -0.16692,-1.05989 h -0.1669 v -0.60099 h 0.44752 c 0.0913,-0.21026 0.18206,-0.42072 0.27336,-0.63097 z m 0.12608,0.19068 c -0.0614,0.14155 -0.12351,0.28323 -0.185,0.42478 h 2.52336 c -0.0614,-0.14155 -0.12248,-0.28323 -0.18397,-0.42478 z m -0.65524,0.63097 v 0.21911 l 0.0594,5.2e-4 h 3.35844 l 0.0724,-5.2e-4 v -0.21911 z m 0.16846,0.41083 0.1669,1.05937 h 2.80603 l 0.16693,-1.05937 -1.57046,0.008 z m -0.061,1.25057 0.27956,1.5782 1.34411,-0.0145 1.34567,0.0145 0.28059,-1.5782 z m 1.62367,1.75441 -1.08519,0.0124 0.19325,1.2299 h 1.79835 l 0.19328,-1.2299 z"
|
||||
id="path2714"
|
||||
inkscape:connector-curvature="0" />
|
||||
```
|
||||
|
||||
You probably can see the code becomes more complex and needs more characters to describe it. More characters in a file result, of course, in a larger size.
|
||||
|
||||
#### Node cleaning
|
||||
|
||||
If you open an example SVG in Inkscape and press F2, that activates the Node tool. You should see something like this:
|
||||
|
||||
![Inkscape - Node tool activated][10]
|
||||
|
||||
There are 5 nodes that aren’t necessary in this example — the ones in the middle of the lines. To remove them, select them one by one with the activated Node tool and press the **Del** key. After this, select the nodes which define this lines and make them corners again using the toolbar tool.
|
||||
|
||||
![Inkscape - Node tool make node a corner][11]
|
||||
|
||||
Without fixing the corners, handles are used that define the curve, which gets saved and will increase file size. You have to do this node cleaning by hand, as it can’t be effectively automated. Now you’re ready for the next stage.
|
||||
|
||||
Use the Save as function and choose Optimized svg. A dialogue window opens where you can select what to remove or keep.
|
||||
|
||||
![Inkscape - Dialog window for save as optimized SVG][12]
|
||||
|
||||
Even the little SVG in this example got down from 3.2 KB to 920 bytes, less than a third of its original size.
|
||||
|
||||
Back to the getfedora page: The grey voronoi pattern used in the background of the main section, after our optimization from Part 1 of this series, is down to 164.1 KB versus the original 211.12 KB size.
|
||||
|
||||
The original SVG it was exported from is 1.9 MB in size. After these SVG optimization steps, it’s only 500.4KB. Too big? Well, the current blue background is 564.98 KB in size. But there’s only a small difference between the SVG and the PNG.
|
||||
|
||||
#### Compressed files
|
||||
|
||||
```
|
||||
$ ls -lh
|
||||
insgesamt 928K
|
||||
-rw-r--r--. 1 user user 161K 19. Feb 19:44 grey-pattern.png
|
||||
-rw-rw-r--. 1 user user 160K 18. Feb 12:23 grey-pattern.png.gz
|
||||
-rw-r--r--. 1 user user 489K 19. Feb 19:43 greyscale-pattern-opti.svg
|
||||
-rw-rw-r--. 1 user user 112K 19. Feb 19:05 greyscale-pattern-opti.svg.gz
|
||||
```
|
||||
|
||||
This is the output of a small test I did to visualize this topic. You should probably see that the raster graphic — the PNG — is already compressed and can’t be anymore. The opposite is the SVG, an XML file. This is just text and can compressed, to less then a fourth of its size. As a result it is now around 50 KB smaller in size than the PNG.
|
||||
|
||||
Modern browsers can handle compressed files natively. Therefore, a lot of web servers have switched on mod_deflate (Apache) and gzip (nginx). That’s how we save space during delivery. Check out if it’s enabled at your server [here][13].
|
||||
|
||||
### Tooling for production
|
||||
|
||||
First of all, nobody wants to always optimize SVG in Inkscape. You can run Inkscape without a GUI in batch mode, but there’s no option to convert from Inkscape SVG to optimized SVG. You can only export raster graphics this way. But there are alternatives:
|
||||
|
||||
* SVGO (which seems not actively developed)
|
||||
* Scour
|
||||
|
||||
|
||||
|
||||
This example will use scour for optimization. To install it:
|
||||
|
||||
```
|
||||
$ sudo dnf install scour
|
||||
```
|
||||
|
||||
To automatically optimize an SVG file, run scour similarly to this:
|
||||
|
||||
```
|
||||
[user@localhost ]$ scour INPUT.svg OUTPUT.svg -p 3 --create-groups --renderer-workaround --strip-xml-prolog --remove-descriptive-elements --enable-comment-stripping --disable-embed-rasters --no-line-breaks --enable-id-stripping --shorten-ids
|
||||
```
|
||||
|
||||
This is the end of part two, in which you learned how to replace raster images with SVG and how to optimize it for usage. Stay tuned to the Fedora Magazine for part three, coming soon.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/design-faster-web-pages-part-2-image-replacement/
|
||||
|
||||
作者:[Sirko Kemter][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/gnokii/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://wp.me/p3XX0v-5fJ
|
||||
[2]: https://fedoramagazine.org/howto-use-sudo/
|
||||
[3]: https://fedoramagazine.org/?s=Inkscape
|
||||
[4]: https://getfedora.org
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2018/02/getfedora_mag.png
|
||||
[6]: https://codepen.io/Cthulahoop/pen/umcvo
|
||||
[7]: https://codepen.io/jackrugile/pen/BvLHg
|
||||
[8]: https://codepen.io/tholman/pen/lDLhk
|
||||
[9]: https://fontawesome.com/
|
||||
[10]: https://fedoramagazine.org/wp-content/uploads/2018/02/svg-optimization-nodes.png
|
||||
[11]: https://fedoramagazine.org/wp-content/uploads/2018/02/node_cleaning.png
|
||||
[12]: https://fedoramagazine.org/wp-content/uploads/2018/02/svg-optimizing-dialog.png
|
||||
[13]: https://checkgzipcompression.com/?url=http%3A%2F%2Fgetfedora.org
|
138
sources/tech/20181026 An Overview of Android Pie.md
Normal file
138
sources/tech/20181026 An Overview of Android Pie.md
Normal file
@ -0,0 +1,138 @@
|
||||
An Overview of Android Pie
|
||||
======
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/android-pie.jpg?itok=Sx4rbOWY)
|
||||
|
||||
Let’s talk about Android for a moment. Yes, I know it’s only Linux by way of a modified kernel, but what isn’t these days? And seeing as how the developers of Android have released what many (including yours truly) believe to be the most significant evolution of the platform to date, there’s plenty to talk about. Of course, before we get into that, it does need to be mentioned (and most of you will already know this) that the whole of Android isn’t open source. Although much of it is, when you get into the bits that connect to Google services, things start to close up. One major service is the Google Play Store, a functionality that is very much proprietary. But this isn’t about how much of Android is open or closed, this is about Pie.
|
||||
Delicious, nutritious … efficient and battery-saving Pie.
|
||||
|
||||
I’ve been working with Android Pie on my Essential PH-1 daily driver (a phone that I really love, but understand how shaky the ground is under the company). After using Android Pie for a while now, I can safely say you want it. It’s that good. But what about the ninth release of Android makes it so special? Let’s dig in and find out. Our focus will be on the aspects that affect users, not developers, so I won’t dive deep into the underlying works.
|
||||
|
||||
### Gesture-Based Navigation
|
||||
|
||||
Much has been made about Android’s new gesture-based navigation—much of it not good. To be honest, this was a feature that aroused all of my curiosity. When it was first announced, no one really had much of an idea what it would be like. Would users be working with multi touch gestures to navigate around the Android interface? Or would this be something completely different.
|
||||
|
||||
|
||||
![Android Pie][2]
|
||||
|
||||
Figure 1: The Android Pie recent apps overview.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
The reality is, gesture-based navigation is much more subtle and simple than what most assumed. And it all boils down to the Home button. With gesture-based navigation enabled, the Home button and the Recents button have been combined into a single feature. This means, in order to gain access to your recent apps, you can’t simply tap that square Recents button. Instead, the Recent apps overview (Figure 1) is opened with a short swipe up from the home button.
|
||||
|
||||
Another change is how the App Drawer is accessed. In similar fashion to opening the Recents overview, the App Drawer is opened via a long swipe up from the Home button.
|
||||
|
||||
As for the back button? It’s not been removed. Instead, what you’ll find is it appears (in the left side of the home screen dock) when an app calls for it. Sometimes that back button will appear, even if an app includes its own back button.
|
||||
|
||||
Thing is, however, if you don’t like gesture-based navigation, you can disable it. To do so, follow these steps:
|
||||
|
||||
1. Open Settings
|
||||
|
||||
2. Scroll down and tap System > Gestures
|
||||
|
||||
3. Tap Swipe up on Home button
|
||||
|
||||
4. Tap the On/Off slider (Figure 2) until it’s in the Off position
|
||||
|
||||
|
||||
|
||||
|
||||
### Battery Life
|
||||
|
||||
AI has become a crucial factor in Android. In fact, it is AI that has helped to greatly improve battery life in Android. This new feature is called Adaptive Battery and works by prioritizing battery power for the apps and services you use most. By using AI, Android learns how you use your Apps and, after a short period, can then shut down unused apps, so they aren’t draining your battery while waiting in memory.
|
||||
|
||||
The only caveat to Adaptive Battery is, should the AI pick up “bad habits” and your battery start to prematurely drain, the only way to reset the function is by way of a factory reset. Even with that small oversight, the improvement in battery life from Android Oreo to Pie is significant.
|
||||
|
||||
### Changes to Split Screen
|
||||
|
||||
Split Screen has been available to Android for some time. However, with Android Pie, how it’s used has slightly changed. This change only affects those who have gesture-based navigation enabled (otherwise, it remains the same). In order to work with Split Screen on Android 9.0, follow these steps:
|
||||
|
||||
![Adding an app][5]
|
||||
|
||||
Figure 3: Adding an app to split screen mode in Android Pie.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
1. Swipe upward from the Home button to open the Recent apps overview.
|
||||
|
||||
2. Locate the app you want to place in the top portion of the screen.
|
||||
|
||||
3. Long press the app’s circle icon (located at the top of the app card) to reveal a new popup menu (Figure 3)
|
||||
|
||||
4. Tap Split Screen and the app will open in the top half of the screen.
|
||||
|
||||
5. Locate the second app you want to open and, tap it to add it to the bottom half of the screen.
|
||||
|
||||
|
||||
|
||||
|
||||
Using Split Screen and closing apps with the feature remains the same as it was.
|
||||
|
||||
###
|
||||
|
||||
![Actions][7]
|
||||
|
||||
Figure 4: Android App Actions in action.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
### App Actions
|
||||
|
||||
This is another feature that was introduced some time ago, but was given some serious attention for the release of Android Pie. App Actions make it such that you can do certain things with an app, directly from the apps launcher.
|
||||
|
||||
For instance, if you long-press the GMail launcher, you can select to reply to a recent email, or compose a new email. Back in Android Oreo, that feature came in the form of a popup list of actions. With Android Pie, the feature now better fits with the Material Design scheme of things (Figure 4).
|
||||
|
||||
![Sound control][9]
|
||||
|
||||
Figure 5: Sound control in Android Pie.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
### Sound Controls
|
||||
|
||||
Ah, the ever-changing world of sound controls on Android. Android Oreo had an outstanding method of controlling your sound, by way of minor tweaks to the Do Not Disturb feature. With Android Pie, that feature finds itself in a continued state of evolution.
|
||||
|
||||
What Android Pie nailed is the quick access buttons to controlling sound on a device. Now, if you press either the volume up or down button, you’ll see a new popup menu that allows you to control if your device is silenced and/or vibrations are muted. By tapping the top icon in that popup menu (Figure 5), you can cycle through silence, mute, or full sound.
|
||||
|
||||
### Screenshots
|
||||
|
||||
Because I write about Android, I tend to take a lot of screenshots. With Android Pie came one of my favorite improvements: sharing screenshots. Instead of having to open Google Photos, locate the screenshot to be shared, open the image, and share the image, Pie gives you a pop-up menu (after you take a screenshot) that allows you to share, edit, or delete the image in question.
|
||||
|
||||
![Sharing ][11]
|
||||
|
||||
Figure 6: Sharing screenshots just got a whole lot easier.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
If you want to share the screenshot, take it, wait for the menu to pop up, tap Share (Figure 6), and then share it from the standard Android sharing menu.
|
||||
|
||||
### A More Satisfying Android Experience
|
||||
|
||||
The ninth iteration of Android has brought about a far more satisfying user experience. What I’ve illustrated only scratches the surface of what Android Pie brings to the table. For more information, check out Google’s official [Android Pie website][12]. And if your device has yet to receive the upgrade, have a bit of patience. Pie is well worth the wait.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/learn/2018/10/overview-android-pie
|
||||
|
||||
作者:[Jack Wallen][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linux.com/users/jlwallen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: /files/images/pie1png
|
||||
[2]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/pie_1.png?itok=BsSe8kqS (Android Pie)
|
||||
[3]: /licenses/category/used-permission
|
||||
[4]: /files/images/pie3png
|
||||
[5]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/pie_3.png?itok=F-NB1dqI (Adding an app)
|
||||
[6]: /files/images/pie4png
|
||||
[7]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/pie_4.png?itok=Ex-NzYSo (Actions)
|
||||
[8]: /files/images/pie5png
|
||||
[9]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/pie_5.png?itok=NMW2vIlL (Sound control)
|
||||
[10]: /files/images/pie6png
|
||||
[11]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/pie_6.png?itok=7Ik8_4jC (Sharing )
|
||||
[12]: https://www.android.com/versions/pie-9-0/
|
@ -0,0 +1,75 @@
|
||||
Translating by StdioA
|
||||
|
||||
Design faster web pages, part 3: Font and CSS tweaks
|
||||
======
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2018/10/designfaster3-816x345.jpg)
|
||||
|
||||
Welcome back to this series of articles on designing faster web pages. [Part 1][1] and [part 2][2] of this series covered how to lose browser fat through optimizing and replacing images. This part looks at how to lose additional fat in CSS ([Cascading Style Sheets][3]) and fonts.
|
||||
|
||||
### Tweaking CSS
|
||||
|
||||
First things first: let’s look at where the problem originates. CSS was once a huge step forward. You can use it to style several pages from a central style sheet. Nowadays, many web developers use frameworks like Bootstrap.
|
||||
|
||||
While these frameworks are certainly helpful, many people simply copy and paste the whole framework. Bootstrap is huge; the “minimal” version of 4.0 is currently 144.9 KB. Perhaps in the era of terabytes of data, this isn’t much. But as they say, even small cattle makes a mess.
|
||||
|
||||
Look back at the [getfedora.org][4] example. Recall in [part 1][1], the first analysis showed the CSS files used nearly ten times more space than the HTML itself. Here’s a display of the stylesheets used:
|
||||
|
||||
![][5]
|
||||
|
||||
That’s nine different stylesheets. Many styles in them that are also unused on the page.
|
||||
|
||||
#### Remove, merge, and compress/minify
|
||||
|
||||
The font-awesome CSS inhabits the extreme end of included, unused styles. There are only three glyphs of the font used on the page. To make that up in KB, the font-awesome CSS used at getfedora.org is originally 25.2 KB. After cleaning out all unused styles, it’s only 1.3 KB. This is only about 4% of its original size! For Bootstrap CSS, the difference is 118.3 KB original, and 13.2 KB after removing unused styles.
|
||||
|
||||
The next question is, must there be a bootstrap.css and a font-awesome.css? Or can they be combined? Yes, they can. That doesn’t save much file space, but the browser now requests fewer files to succesfully render the page.
|
||||
|
||||
Finally, after merging the CSS files, try to remove unused styles and minify them. In this way, you save 10.1 KB for a final size of 4.3 KB.
|
||||
|
||||
Unfortunately, there’s no packaged “minifier” tool in Fedoras repositories yet. However, there are hundreds of online services to do that for you. Or you can use [CSS-HTML-JS Minify][6], which is Python, and therefore easy to isntall. There’s not an available tool to purify CSS, but there are web services like [UnCSS][7].
|
||||
|
||||
### Font improvement
|
||||
|
||||
[CSS3][8] came with something a lot of web developer like. They could define fonts the browser downloads in the background to render the page. Since then, a lot of web designers are very happy, especially after they discovered the usage of icon fonts for web design. Font sets like [Font Awesome][9] are quiet popular today and widely used. Here’s the size of that content:
|
||||
|
||||
```
|
||||
current free version 912 glyphs/icons, smallest set ttf 30.9KB, woff 14.7KB, woff2 12.2KB, svg 107.2KB, eot 31.2
|
||||
```
|
||||
|
||||
So the question is, do you need all the glyphs? In all probability, no. You can get rid of them with [FontForge][10], but that’s a lot of work. You could also use [Fontello][11]. Use the public instance, or set up your own, as it’s free software and available on [Github][12].
|
||||
|
||||
The downside of such customized font sets is you must host the font by yourself. You can’t use other online font services to provide updates. But this may not really be a downside, compared to faster performance.
|
||||
|
||||
### Conclusion
|
||||
|
||||
Now you’ve done everything you can to the content itself, to minimize what the browser loads and interprets. From now on, only tricks with the administration of the server can help.
|
||||
|
||||
One easy to do, but which many people do wrong, is decide on some intelligent caching. For instance, a CSS or picture file can be cached for a week. Whatever you do, if you use a proxy service like Cloudflare or build your own proxy, minimze the pages first. Users like fast loading pages. They’ll (silently) thank you for it, and the server will have a smaller load, too.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/design-faster-web-pages-part-3-font-css-tweaks/
|
||||
|
||||
作者:[Sirko Kemter][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/gnokii/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/design-faster-web-pages-part-1-image-compression/
|
||||
[2]: https://fedoramagazine.org/design-faster-web-pages-part-2-image-replacement/
|
||||
[3]: https://en.wikipedia.org/wiki/Cascading_Style_Sheets
|
||||
[4]: https://getfedora.org
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2018/02/CSS_delivery_tool_-_Examine_how_a_page_uses_CSS_-_2018-02-24_15.00.46.png
|
||||
[6]: https://github.com/juancarlospaco/css-html-js-minify
|
||||
[7]: https://uncss-online.com/
|
||||
[8]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS3
|
||||
[9]: https://fontawesome.com/
|
||||
[10]: https://fontforge.github.io/en-US/
|
||||
[11]: http://fontello.com/
|
||||
[12]: https://github.com/fontello/fontello
|
@ -1,143 +0,0 @@
|
||||
如何移除或禁用 Ubuntu Dock
|
||||
======
|
||||
|
||||
![](https://1.bp.blogspot.com/-pClnjEJfPQc/W21nHNzU2DI/AAAAAAAABV0/HGXuQOYGzokyrGYQtRFeF_hT3_3BKHupQCLcBGAs/s640/ubuntu-dock.png)
|
||||
|
||||
**如果你想用其它 dock(例如 Plank dock)或面板来替换 Ubuntu 18.04 中的 Dock,或者你想要移除或禁用 Ubuntu Dock,本文会告诉你如何做。**
|
||||
|
||||
Ubuntu Dock - 屏幕左侧栏,可用于固定应用程序或访问已安装的应用程序。使用默认的 Ubuntu 会话时,[无法][1]使用 Gnome Tweaks 禁用它。如果你需要,还是有几种方法来摆脱它的。下面我将列出 4 种方法可以移除或禁用 Ubuntu Dock,以及每个方法的缺点(如果有的话),还有如何撤销每个方法的更改。本文还包括在没有 Ubuntu Dock 的情况下访问多任务视图和已安装应用程序列表的其它方法。
|
||||
(to 校正:Activities Overview 在本文翻译为多任务视图,如有不妥,请改正)
|
||||
### 如何在没有 Ubuntu Dock 的情况下访问多任务试图
|
||||
|
||||
如果没有 Ubuntu Dock,你可能无法访问活动的或已安装的应用程序列表(但是可以通过单击 Dock 底部的“显示应用程序”按钮从 Ubuntu Dock 访问)。例如,如果你想使用 Plank Dock。(to 校正:这里是什么意思呢)
|
||||
|
||||
显然,如果你安装了 Dash to Panel 扩展来使用它而不是 Ubuntu Dock,那么情况并非如此。因为 Dash to Panel 提供了一个按钮来访问多任务视图或已安装的应用程序。
|
||||
|
||||
根据你计划使用的 Dock 而不是 Ubuntu Dock,如果无法访问多任务视图,那么你可以启用 Activities Overview Hot Corner 选项,只需将鼠标移动到屏幕的左上角即可打开 Activities。访问已安装的应用程序列表的另一种方法是使用快捷键:`Super + A`。
|
||||
|
||||
如果要启用 Activities Overview hot corner,使用以下命令:
|
||||
```
|
||||
gsettings set org.gnome.shell enable-hot-corners true
|
||||
|
||||
```
|
||||
|
||||
如果以后要撤销此操作并禁用 hot corners,那么你需要使用以下命令:
|
||||
```
|
||||
gsettings set org.gnome.shell enable-hot-corners false
|
||||
|
||||
```
|
||||
|
||||
你可以使用 Gnome Tweaks 应用程序(该选项位于 Gnome Tweaks 的 `Top Bar` 部分)启用或禁用 Activities Overview Hot Corner 选项,可以使用以下命令进行安装:
|
||||
```
|
||||
sudo apt install gnome-tweaks
|
||||
|
||||
```
|
||||
|
||||
### 如何移除或禁用 Ubuntu Dock
|
||||
|
||||
下面你将找到 4 种摆脱 Ubuntu Dock 的方法,环境在 Ubuntu 18.04 下。
|
||||
|
||||
**方法 1: 移除 Gnome Shell Ubuntu Dock 包。**
|
||||
|
||||
摆脱 Ubuntu Dock 的最简单方法就是删除包。
|
||||
|
||||
这将会从你的系统中完全移除 Ubuntu Dock 扩展,但同时也移除了 `ubuntu-desktop` 元数据包。如果你移除 `ubuntu-desktop` 元数据包,不会马上出现问题,因为它本身没有任何作用。`ubuntu-meta` 包依赖于组成 Ubuntu 桌面的大量包。它的依赖关系不会被删除,也不会被破坏。问题是如果你以后想升级到新的 Ubuntu 版本,那么将不会安装任何新的 `ubuntu-desktop` 依赖项。
|
||||
|
||||
为了解决这个问题,你可以在升级到较新的 Ubuntu 版本之前安装 `ubuntu-desktop` 元包(例如,如果你想从 Ubuntu 18.04 升级到 18.10)。
|
||||
|
||||
如果你对此没有意见,并且想要从系统中删除 Ubuntu Dock 扩展包,使用以下命令:
|
||||
```
|
||||
sudo apt remove gnome-shell-extension-ubuntu-dock
|
||||
|
||||
```
|
||||
|
||||
如果以后要撤消更改,只需使用以下命令安装扩展:
|
||||
```
|
||||
sudo apt install gnome-shell-extension-ubuntu-dock
|
||||
|
||||
```
|
||||
|
||||
或者重新安装 `ubuntu-desktop` 元数据包(这将会安装你可能已删除的任何 ubuntu-desktop 依赖项,包括 Ubuntu Dock),你可以使用以下命令:
|
||||
```
|
||||
sudo apt install ubuntu-desktop
|
||||
|
||||
```
|
||||
|
||||
**选项2:安装并使用 vanilla Gnome 会话而不是默认的 Ubuntu 会话。**
|
||||
|
||||
摆脱 Ubuntu Dock 的另一种方法是安装和使用 vanilla Gnome 会话。安装 vanilla Gnome 会话还将安装此会话所依赖的其它软件包,如 Gnome 文档,地图,音乐,联系人,照片,跟踪器等。
|
||||
|
||||
通过安装 vanilla Gnome 会话,你还将获得默认 Gnome GDM 登录和锁定屏幕主题,而不是 Ubuntu 默认值,另外还有 Adwaita Gtk 主题和图标。你可以使用 Gnome Tweaks 应用程序轻松更改 Gtk 和图标主题。
|
||||
|
||||
此外,默认情况下将禁用 AppIndicators 扩展(因此使用 AppIndicators 托盘的应用程序不会显示在顶部面板上),但你可以使用 Gnome Tweaks 启用此功能(在扩展中,启用 Ubuntu appindicators 扩展)。
|
||||
|
||||
同样,你也可以从 vanilla Gnome 会话启用或禁用 Ubuntu Dock,这在 Ubuntu 会话中是不可能的(使用 Ubuntu 会话时无法从 Gnome Tweaks 禁用 Ubuntu Dock)。
|
||||
|
||||
如果你不想安装 vanilla Gnome 会话所需的这些额外软件包,那么这个移除 Ubuntu Dock 的这个选项不适合你,请查看其它选项。
|
||||
|
||||
如果你对此没有意见,以下是你需要做的事情。要在 Ubuntu 中安装普通的 Gnome 会话,使用以下命令:
|
||||
```
|
||||
sudo apt install vanilla-gnome-desktop
|
||||
|
||||
```
|
||||
|
||||
安装完成后,重启系统。在登录屏幕上,单击用户名,单击 `Sign in` 按钮旁边的齿轮图标,然后选择 `GNOME` 而不是 `Ubuntu`,之后继续登录。
|
||||
|
||||
![](https://4.bp.blogspot.com/-mc-6H2MZ0VY/W21i_PIJ3pI/AAAAAAAABVo/96UvmRM1QJsbS2so1K8teMhsu7SdYh9zwCLcBGAs/s640/vanilla-gnome-session-ubuntu-login-screen.png)
|
||||
|
||||
如果要撤销此操作并移除 vanilla Gnome 会话,可以使用以下命令清除 vanilla Gnome 软件包,然后删除它安装的依赖项(第二条命令):
|
||||
```
|
||||
sudo apt purge vanilla-gnome-desktop
|
||||
sudo apt autoremove
|
||||
|
||||
```
|
||||
|
||||
然后重新启动,并以相同的方式从 GDM 登录屏幕中选择 Ubuntu。
|
||||
|
||||
**选项 3:从桌面上永久隐藏 Ubuntu Dock,而不是将其移除。**
|
||||
|
||||
如果你希望永久隐藏 Ubuntu Dock,不让它显示在桌面上,但不移除它或使用 vanilla Gnome 会话,你可以使用 Dconf 编辑器轻松完成此操作。这样做的缺点是 Ubuntu Dock 仍然会使用一些系统资源,即使你没有在桌面上使用它,但你也可以轻松恢复它而无需安装或移除任何包。
|
||||
|
||||
Ubuntu Dock 只对你的桌面隐藏,当你进入叠加模式(Activities)时,你仍然可以看到并从那里使用 Ubuntu Dock。
|
||||
|
||||
要永久隐藏 Ubuntu Dock,使用 Dconf 编辑器导航到 `/org/gnome/shell/extensions/dash-to-dock` 并禁用以下选项(将它们设置为 false):`autohide`, `dock-fixed` 和 `intellihide`。
|
||||
|
||||
如果你愿意,可以从命令行实现此目的,运行以下命令:
|
||||
```
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock autohide false
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed false
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock intellihide false
|
||||
|
||||
```
|
||||
|
||||
如果你改变主意了并想撤销此操作,你可以使用 Dconf 编辑器从 `/org/gnome/shell/extensions/dash-to-dock` 中启动 `autohide`, `dock-fixed` 和 `intellihide`(将它们设置为 true),或者你可以使用以下这些命令:
|
||||
```
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock autohide true
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true
|
||||
gsettings set org.gnome.shell.extensions.dash-to-dock intellihide true
|
||||
|
||||
```
|
||||
|
||||
**选项 4:使用 Dash to Panel 扩展。**
|
||||
|
||||
[Dash to Panel][2] 是 Gnome Shell 的一个高度可配置面板,是 Ubuntu Dock 或 Dash to Dock 的一个很好的替代品(Ubuntu Dock 是从 Dash to Dock 克隆而来的)。安装和启动 Dash to Panel 扩展会禁用 Ubuntu Dock,因此你无需执行其它任何操作。
|
||||
|
||||
你可以从 [extensions.gnome.org][3] 来安装 Dash to Panel。
|
||||
|
||||
如果你改变主意并希望重新使用 Ubuntu Dock,那么你可以使用 Gnome Tweaks 应用程序禁用 Dash to Panel,或者通过单击以下网址旁边的 X 按钮完全移除 Dash to Panel: https://extensions.gnome.org/local/。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxuprising.com/2018/08/how-to-remove-or-disable-ubuntu-dock.html
|
||||
|
||||
作者:[Logix][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://plus.google.com/118280394805678839070
|
||||
[1]:https://bugs.launchpad.net/ubuntu/+source/gnome-tweak-tool/+bug/1713020
|
||||
[2]:https://www.linuxuprising.com/2018/05/gnome-shell-dash-to-panel-v14-brings.html
|
||||
[3]:https://extensions.gnome.org/extension/1160/dash-to-panel/
|
Loading…
Reference in New Issue
Block a user