2/05/2019
12/21/2018
Updating Plex Plugin in Freenas 11.2 Manually
need to manually run
1 | iocage pkg JAILNAME update |
1 | iocage pkg JAILNAME upgrade |
9/23/2018
freenas 查找删除文件
找空文件夹
1 | find . -empty |
删除空文件夹
1 | find . -empty -exec rm -rf {} \; |
查找文件并删除
1 | find . -name "*.png" -exec rm {} \; |
查找小于100M的文件
1 | find . -type f -size -100M |
8/07/2018
在openwrt上开启快速漫游
1,设置AP模式
参考官方wiki:https://wiki.openwrt.org/doc/recipes/dumbap
2,替换wpad-mini
1 2 3 | opkg update opkg remove wpad-mini opkg install wpad |
3,开启并配置802.11r
参考:https://www.reddit.com/r/openwrt/comments/515oea/finally_got_80211r_roaming_working/
4/07/2018
在LEDE软路由上运行Home Assistant
- 环境准备
运行Home Assistant需要python3.5以上的python环境.软件源里有现成的3.6,直接安装就好1opkg install python3 python3-pip安装虚拟环境
1pip3 install virtualenv - 指定安装位置,python版本
以 /mnt/sda3/homeassistant 路径为例1virtualenv /mnt/sda3/homeassistant -p /usr/bin/python3.6进虚拟环境
1source /mnt/sda3/homeassistant/bin/activate - 安装Home Assistant1python3 -m pip install homeassistant
- 测试运行一下1hass --open-ui
等两分钟初始化 看看能不能打开webui,默认端口8123 路由器ip:8123
Ctrl + C 中止
退出虚拟环境1deactivate - 控制脚本
建立/etc/init.d/hass-daemon
贴最下面的脚本,注意改成自己的安装目录1/etc/init.d/hass-daemon enable设置为开机启动
1/etc/init.d/hass-daemon start启动
1/etc/init.d/hass-daemon stop关闭
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 | #!/bin/sh /etc/rc.common START=99 # /etc/init.d Service Script for Home Assistant PRE_EXEC="cd /mnt/sda3/homeassistant; source bin/activate;" # Typically /usr/bin/hass HASS_BIN="hass" RUN_AS="root" PID_DIR="/var/run/hass" PID_FILE="$PID_DIR/hass.pid" CONFIG_DIR="/$RUN_AS/.homeassistant" LOG_DIR="/var/log/homeassistant" LOG_FILE="$LOG_DIR/home-assistant.log" FLAGS="-v --config $CONFIG_DIR --pid-file $PID_FILE --log-file $LOG_FILE --daemon" start() { create_piddir if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE) 2> /dev/null; then echo 'Service already running' >&2 return 1 fi echo -n 'Starting service… ' >&2 local CMD="$PRE_EXEC $HASS_BIN $FLAGS;" /bin/sh -c "$CMD" $RUN_AS if [ $? -ne 0 ]; then echo "Failed" >&2 else echo 'Done' >&2 fi } stop() { if [ ! -f "$PID_FILE" ] || ! kill -0 $(cat "$PID_FILE") 2> /dev/null; then echo 'Service not running' >&2 return 1 fi echo -n 'Stopping service… ' >&2 kill $(cat "$PID_FILE") while ps -p $(cat "$PID_FILE") > /dev/null 2>&1; do sleep 1;done; rm -f $PID_FILE echo 'Done' >&2 } create_piddir() { if [ ! -d "$PID_DIR" ]; then mkdir -p $PID_DIR chown $RUN_AS "$PID_DIR" fi } |
3/24/2018
3/19/2018
添加免费证书(备忘)
https://github.com/Neilpang/acme.sh/wiki/%E8%AF%B4%E6%98%8E
1,安装acme.sh
1 | curl https://get.acme.sh | sh |
2,将CloudFlare Global API KEY加入临时系统变量
1 2 | export CF_Key="******************" export CF_Email="********" |
3,获取证书
1 | ~/.acme.sh/acme.sh --issue -d lingbo.me -d *.lingbo.me --dns dns_cf |
ps,
How to get pkcs12(pfx) format
1 | acme.sh --toPkcs -d <domain> [--password pfx-password] |
1/23/2018
更新Home Assistant
1,停止运行HA
1 | sudo systemctl stop home-assistant@homeassistant.service |
2,切换用户
1 | sudo su -s /bin/bash homeassistant |
3,进环境
1 | source /srv/homeassistant/bin/activate |
4,更新
1 | pip3 install --upgrade homeassistant |
5,退出
6,运行HA
1 | sudo systemctl start home-assistant@homeassistant.service |
#备忘手札
9/14/2017
9/02/2017
4/27/2017
11/18/2016
不可扭曲如蛆虫
如果天空总是黑暗的,那就摸黑生存;如果发出声音是危险的,那就保持沉默;如果自觉无力发光,那就蜷伏于墙角。 但不要习惯了黑暗就为黑暗辩护;也不要为自己的苟且而得意;不要嘲讽那些比自己更勇敢的人们。我们可以卑微如尘土,但不可扭曲如蛆虫。
7/08/2016
6/22/2016
Shell去除空行的4种方法
节选自http://www.jb51.net/article/57953.htm
1)用tr命令
1 | cat 文件名 |tr -s ‘\n' |
2)用sed命令
1 | cat 文件名 |sed ‘/^$/d' |
3)用awk命令
1 | cat 文件名 |awk ‘{if($0!=”")print}' |
1 | cat 文件名 |awk ‘{if(length !=0) print $0}' |
4)用grep命令
grep -v “^$” 文件名
甲骨文云ubuntu系统关防火墙
6、Ubuntu系统 开放所有端口 iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F Ubuntu镜像默认设置了Iptable规则,关闭它, ap...
-
先打开VMware的SSH,检查一下对应的vmdk文件: vmkfstools -x check /path/to/your/machine.vmdk(修改成自己的路径及文件名) 如果提示“Disk needs repair.” 运行修复命令: vmkfstools -x rep...
-
from https://blog.csdn.net/ID_Rin/article/details/105341206 前提 : 设备安装了esxi6.7包括U1,U2,U3版本,设置显卡直通后卡开机界面dma_mapper_iommu loaded su...
-
rsync -ah --progress source-file destination-file sending incremental file list source-file 621.22M 57% 283.86MB/s 0:00:...




