如何设置 UAP-AC-Lite 的 inform url

那么有同学要问了,有 get-inform 命令吗,抱歉没有,试试 info

如何 SSH 登录 UniFi UAP-AC-Lite

  • 进入 Controller 管理页面
  • Settings
  • Network Settings
  • Device Authentication
    • Enable SSH Authentication
    • SSH Username
    • SSH Password
    • (optional) SSH Keys

“羽”的五笔编码

从来都是先输入“羽毛”再把“毛”删掉,从“羽毛”的编码nntf可得出“羽”的前两码一定是nn,但后面是啥,这么多年也没有试出来过。

就在刚刚,实在忍不住搜索了一下,答案竟然是nnyg,百思不得其解,先记在这里吧

Armbian@N1 盒子变成 Read-only File System

原因是 N1 盒子 emmc 出现坏块导致,解决方法:用 U 盘启动 N1 盒子进入 Armbian,然后输入下面的命令:

e2fsck /dev/mmcblk1p2

修复成功后拔掉 U 盘重启 N1 盒子。

How to Burn DMG to USB on macOS Catalina

如何在 macOS 系统把 dmg 镜像烧进 U 盘?

现在(2020年3月28日,March 28th, 2020)网上能搜到的内容都过时了,正解如下:

  1. Convert DMG to ISO——把 DMG 转为 ISO
  2. Use dd to burn ISO to USB——用 dd 命令把 ISO 烧进 U 盘

那么第一步,怎么把 DMG 转为 ISO 呢?这里需要用到一个工具叫 dmg2img,下面是 brew 安装方法:

brew install dmg2img

然后,

dmg2img <path_to_your_dmg_file> <path_to_your_iso_file>

就把 DMG 转为 ISO了。

第二步,把 ISO 烧进 U 盘:

sudo dd if=<path_to_your_iso_file> of=<your_destination_disk> bs=4m

具体可以用 diskutil list 命令查看自己 U 盘的标识

群晖安装 ohmyzsh

五步走:

  1. 套件中心——所有套件——第三方,找到Git Server,安装
  2. 套件中心——设置——套件来源——新增,位置写 https://packages.synocommunity.com,名称写 社群,确定
  3. 套件中心——社群,找到Z shell (with modules),安装
  4. SSH 登录群晖,粘贴下面的命令后回车
    sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    
  5. 由于群晖没有chsh,所以新建~/.profile文件,粘贴以下内容后保存
    if [[ -x /usr/local/bin/zsh ]]; then
    export SHELL=/usr/local/bin/zsh
    exec /usr/local/bin/zsh
    fi
    

macOS 查看监听指定端口的进程(Linux 等价 netstat -ntlp)

lsof -n -i4TCP:$PORT | grep LISTEN
lsof -n -iTCP:$PORT | grep LISTEN
lsof -n -i:$PORT | grep LISTEN

其中$PORT替换为指定的端口号,或者是用英文逗号连接的一组端口号。

from

git 命令行中文乱码的解决方法

git config --global core.quotepath false

找回 telnet 命令 on macOS High Sierra 10.13.*

macOS 升级到 High Sierra 后,telnet 命令竟然不见了!身为码畜,是可忍孰不可忍……

安装 Homebrew

如果你还没有安装过 Homebrew,先用下面的命令安装上:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装 telnet

也是一条命令的事儿……

brew install telnet

The END

TensorFlow API 用法详解:tf.equal

equal(
    x,
    y,
    name=None
)

对输入的 xy 两个 Tensor 逐元素(element-wise)做 (x == y) 逻辑比较,返回 bool 类型的 Tensor

参数

  • x 只支持以下类型:half, float32, float64, uint8, int8, int16, int32, int64, complex64, quint8, qint8, qint32, string, bool, complex128
  • y 的类型必须与 x 相同
  • name 给这个操作取一个名称,可选

返回

  • bool 类型的 Tensor

特性

  • 支持 broadcasting,详见 Numpy 文档

示例

基本用法:xy 拥有相同的 shape

import tensorflow as tf

a = tf.constant([1, 2], tf.int32)
b = tf.constant([2, 2], tf.int32)
with tf.Session() as sess:
    print(sess.run(tf.equal(a, b))) # 输出 [False  True]

broadcasting 用法:xy 不同 shape

x = tf.constant(["hehe", "haha", "hoho", "kaka"], tf.string)
y = tf.constant("hoho", tf.string)
with tf.Session() as sess:
    print(sess.run(tf.equal(x, y)))
# 输出 [False False  True False]

注意观察上面这个栗子,实际解决了在一个数组中查找某个元素索引(index)的问题,这个特性配合 tf.cast 在生成 one-hot 向量时将会特别有用。

a = tf.constant([[1], [2]], tf.int32)
b = tf.constant([[2, 1]], tf.int32)
with tf.Session() as sess:
    print(sess.run(tf.equal(a, b)))
# 输出
# [[False  True]
#  [ True False]]