Muhan Li

Tech Blog

前言

Bitwarden 是一个开源的密码管理器,可以帮助你存储和保护你的密码。它有一个云服务,但是你也可以选择自己搭建一个私有的 Bitwarden 服务器( 通过 docker 构建非常简单),这样你就可以完全控制你的数据。

本文介绍的是一个社区维护的 Bitwarden 服务器,叫做 Vaultwarden。Vaultwarden 兼容 Bitwarden 的客户端,支持 Bitwarden 的所有常用功能,并且官方需要订阅的高级功能都是免费的。

Attention is All You Need

Abstract: The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. The best performing models also connect the encoder and decoder through an attention mechanism. We propose a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely. Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train. Our model achieves 28.4 BLEU on the WMT 2014 English-to-German translation task, improving over the existing best results, including ensembles, by over 2 BLEU. On the WMT 2014 English-to-French translation task, our model establishes a new single-model state-of-the-art BLEU score of 41.0 after training for 3.5 days on eight GPUs, a small fraction of the training costs of the best models from the literature.

前言

前面说到, 换到 RouterOS 确实系统启动快了非常多, 资源消耗也非常小, 但是又引出了几个新的痛点…

  1. ROS 的界面实在是不直观, 高情商: 专业, 低情商: 难看. 维护的过程中给自己增加了难度.
  2. ROS 的 DHCP 不能指定网关, 只能用 magle 标记做透明代理, 而不直观的问题又增加了配置和排查的难度 :(

此外感觉网络拓扑整的太复杂并没有什么用, 还是应该用奥卡姆剃刀剃一下, 这样出问题也好排查.

看了半天还是决定用主路由 OPNsense + 旁路由 OpenClash 分流. 主路由经过试用, OPNsense 似乎有更好的响应速度和易用性, 所以就用它踢掉 pfSense. OPNsense 有全面的 API 接口 , 方便做一些自动化的开发, 也不需要学 ROS 的语法.

而且, OPNsense有非常好看的前端界面!

因为实在受不了 pfSense 开机太慢而且 WebUI 巨卡 [1] , 和一些 DNS 设置奇奇怪怪的问题, 终于下定决心把主路由给换了. 调研使用了一波以后, 发现还是 RouterOS 可以比较相对简单地实现需求 (well, ROS 以复杂出名.. but [2] ), 那正好开坑写一个系列, 重组内网服务器.

  1. 虽说把 pfSense 给换了, 但是有一说一这是一个相对完善的路由系统 (而且本身就是防火墙系统), 首先他有内置的 DNS 解析服务, 还有非常好用的 DHCP 静态分配, 可以给每一个主机指定单独的 DNS 服务器和 Gateway, 这样可以把一些奇怪的职责解耦到不同的旁路由上 [3] , 然后对设备终端也是非侵入的. 可能以后如果需要对外暴露服务的话我还得把这个防火墙请回来..
  2. 跑通 ROS 其实不复杂… 网上那么多教程, 或者跟着官方 Getting Started 几分钟就行了. 主要是高级设置, 或者说中级功能没有其他路由系统直观, 要实现高级功能反而还是好用的 (用到在学嘛), 而且官方文档很全面.
  3. 虽说在 DHCP Static 上指定 Gateway 不用单独每个终端设备去设置, 但是导致服务器之间耦合在一起了, 如果某个服务挂了其实并不能简单快速地恢复. 所以这次的目标就是用好 ROS 的监听, 让主路由可以独立完成所有任务, 然后其他花里胡哨的功能外挂去做, 这些服务挂了可以自动切回 ROS 维持基本需求. 说不定哪天墙塌了, 我直接把旁路由一关! …

Stanford University, Machine Learning, Andrew Ng, Coursera

Week 9: Anomaly Detection, Recommender Systems Part 2

Recommender Systems

Predicting Movie Ratings

Problem Formulation
Movie Alice (1) Bob (2) Carol (3) Dave (4) $x_1$ $x_2$
$x^{\left(1\right)}$ 5 5 0 0 0.9 0
$x^{\left(2\right)}$ 5 ? ? 0 1.0 0.01
$x^{\left(3\right)}$ ? 4 0 ? 0.99 0
$x^{\left(4\right)}$ 0 0 5 4 0.1 1.0
$x^{\left(5\right)}$ 0 0 5 ? 0 0.9

Stanford University, Machine Learning, Andrew Ng, Coursera

Week 9: Anomaly Detection, Recommender Systems Part 1

Anomaly Detection

Density Estimation

Problem Motivation

Dataset $\left\{ x^{\left(1\right)} ,\, x^{\left(2\right)} ,\,\dots,\, x^{\left(m\right)} \right\}$, is $x_\mathrm{test}$ anomalous?

Model $p\left(x\right) \begin{cases} \lt \varepsilon & \rightarrow \textsf{flag anomaly} \\ \geq \varepsilon & \rightarrow \textsf{OK} \end{cases}$

Stanford University, Machine Learning, Andrew Ng, Coursera

Week 8: Unsupervised Learning, Dimensionality Reduction

Unsupervised Learning

Clustering

Unsupervised Learning: Introduction

training set: $\left\{ x^{\left(1\right)},\, x^{\left(2\right)},\, x^{\left(3\right)},\, \dots ,\, x^{\left(m\right)} \right\}$

K-Means Algorithm

step 1: cluster assignment
step 2: move centroid

Stanford University, Machine Learning, Andrew Ng, Coursera

Week 7: Support Vector Machines

Support Vector Machines

Large Margin Classification

Optimization Objective

Logistic Regression

$h_{\theta}\left(x\right) = \dfrac{1}{1+e^{ -\theta^\mathsf{T}x }}$

if $y=1$, we want $h_{\theta}\left(x\right)\approx1$, $\theta^\mathsf{T}x\gg0$
if $y=0$, we want $h_{\theta}\left(x\right)\approx0$, $\theta^\mathsf{T}x\ll0$

cost function $-y \log h_{\theta}\left(x\right) - \left(1-y\right) \log \left( 1- h_{\theta}\left(x\right) \right)$

Stanford University, Machine Learning, Andrew Ng, Coursera

Week 6: Advice for Applying Machine Learning, Machine Learning System Design

Advice for Applying Machine Learning

Evaluating a Learning Algorithm

Deciding What to Try Next
  • get more training examples
  • try smaller sets of features
  • try getting additional features
  • try adding polynomial features
  • try decreasing / increasing $\lambda$

Stanford University, Machine Learning, Andrew Ng, Coursera

Week 5: Neural Networks: Learning

Neural Networks: Learning

Cost Function and Backpropagation

Binary Classification

$y = 0 \textrm{ or } 1$, 1 output unit: $h_\Theta \left(x\right) \in \mathbb{R} \quad s_L=1$

  • $L$: total number of layers in network
  • $s_l$: number of units in layer $l$

Multi-class Classification

$y \in \mathbb{R} ^K$, K output units: $h_\Theta \left(x\right) \in \mathbb{R} ^K \quad s_L=K$