管理员权限运行CMD
winget uninstall MicrosoftWindows.Client.WebExperience_cw5n1h2txyewy
rsync -ah --progress source-file destination-file
sending incremental file list
source-file
621.22M 57% 283.86MB/s 0:00:01
显示进度时,这将保留文件的权限/所有权。
from https://blog.csdn.net/ID_Rin/article/details/105341206
前提:
设备安装了esxi6.7包括U1,U2,U3版本,设置显卡直通后卡开机界面dma_mapper_iommu loaded successfully
等待3分钟,ping 设置的ip地址依然超时,不可以登录的问题!
设备:一台win电脑,一个U盘,
软件:UltraISO安装包 以及 ubuntu18.04.ISO镜像
操作:
1. win电脑下载安装UltraISO后,把Ubuntu的iso刻录到U盘,iso建议为18.04版本;
2. U盘插入设备,开机启动电脑选择U盘启动;
3. 打开Terminal
4. 输入:
输入lspci 快速查找
我的是NVIDIA 的GM107 GTX960 id:0000:01:00.0 #vendor:10de #device :139b
英特尔核显的pcie的id是00:02.0 #vendor:8086 #device :416
sudo parted -l #查看硬盘
sudo mount /dev/sda5 /mnt #挂载
ls /mnt/
cp /mnt/state.tgz ~/
cd ~
tar xvf state.tgz
tar xvf local.tgz
cd etc/vmware/
nano esx.conf
找到 /device/<PCI_ID>/owner = "passthru" #PCI_ID就是上面找到的0000:01:00.0 和 0000:00:02.0
使用 vmkernel 代替 passthru
按ctrl+X 退出 按Y确认回车 不放心的可以再nano一次进去看看
cd ~
tar czf local.tgz etc/
tar czf state.tgz local.tgz
sudo cp state.tgz /mnt/
重启电脑 拔U盘
大功告成!
1
2 3 4 5 6 7 |
:global ipaddr [/ip address get [/ip address find interface=pppoe4plex] address]
:set ipaddr [:pick $ipaddr 0 ([len $ipaddr] -3)] :global oldip [/ip firewall nat get [/ip firewall nat find comment="plexdstnat"] dst-address] :if ($ipaddr != $oldip) do={ :log info [/ip firewall nat set [/ip firewall nat find comment="plexdstnat"] dst-address=$ipaddr] :log info [/ip firewall nat set [/ip firewall nat find comment="plexsrcnat"] to-addresses=$ipaddr] } |
also here
备忘
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 | ################# CloudFlare variables ################# :local CFDebug "true" :global WANInterface "pppoe4plex" :local CFdomain "*****.lingbo.me" :local CFzone "lingbo.me" :local CFrecordType "A" :local CFemail "****************@gmail.com" :local CFtkn "bc24e143b3840****************9e13a5" :local CFzoneid "a926a****************accb8" :local CFid "661c43a****************95994087" ######################################################################### ######################## DO NOT EDIT BELOW ############################ ######################################################################### ################# Internal variables ################# :local resolvedIP "" :global WANip "" ################# Resolve and set IP-variables ################# :local currentIP [/ip address get [/ip address find interface=$WANInterface ] address]; :set WANip [:pick $currentIP 0 [:find $currentIP "/"]]; :set resolvedIP [:resolve $CFdomain]; ################# Build CF API Url (v4) ################# :local CFurl "https://api.cloudflare.com/client/v4/zones/" :set CFurl ($CFurl . "$CFzoneid/dns_records/$CFid"); ######## Write debug info to log ################# :if ($CFDebug = "true") do={ :log info ("CF: hostname = $CFdomain") :log info ("CF: resolvedIP = $resolvedIP") :log info ("CF: currentIP = $currentIP") :log info ("CF: WANip = $WANip") :log info ("CF: CFurl = $CFurl&content=$WANip") }; ######## Compare and update CF if necessary ##### :if ($resolvedIP != $WANip) do={ :log info ("CF: Updating CF, setting $CFDomain = $WANip") /tool fetch http-method=put mode=https url="$CFurl" http-header-field="X-Auth-Email:$CFemail,X-Auth-Key:$CFtkn,content-type:application/json" output=none http-data="{"type":"$CFrecordType","name":"$CFdomain","content":"$WANip"}" /ip dns cache flush } else={ :log info "CF: No Update Needed!" } |
1 | find /mnt/vol1/ptdataset/ptuser/download/ -name '*.mp4' -print0 | xargs -0 -I% cp -nrsv % /mnt/vol1/lnk/ |
拷贝整个目录并创建硬链接
1 | cp -al <origdir> <newdir> |
need to manually run
1 | iocage pkg JAILNAME update |
1 | iocage pkg JAILNAME upgrade |
找空文件夹
1 | find . -empty |
删除空文件夹
1 | find . -empty -exec rm -rf {} \; |
查找文件并删除
1 | find . -name "*.png" -exec rm {} \; |
查找小于100M的文件
1 | find . -type f -size -100M |
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/
1 | opkg install python3 python3-pip |
安装虚拟环境
1 | pip3 install virtualenv |
1 | virtualenv /mnt/sda3/homeassistant -p /usr/bin/python3.6 |
进虚拟环境
1 | source /mnt/sda3/homeassistant/bin/activate |
1 | python3 -m pip install homeassistant |
1 | hass --open-ui |
等两分钟初始化 看看能不能打开webui,默认端口8123 路由器ip:8123
Ctrl + C 中止
退出虚拟环境
1 | deactivate |
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 } |
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,停止运行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 |
#备忘手札
节选自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 “^$” 文件名
2、配置dnsmasq和ipset
为了防止 DNS 污染和把被认证域名解析到的 IP 存放到 ipset 中,我们要把需要通过代理访问的站点域名交由 dnsmasq 处理,域名列表可以自己收集也可以从 gfwlist 导出,最简单的方法就是使用 gfwlist2pac ,从生成的 pac 文件中提取出域名列表再进行加工即可用于 dnsmasq
首先使用 ipset 新建一个名为 redir 的 set 用于存放列表中的域名对应的 IP
1 | ipset -N redir iphash |
修改
1 | /etc/dnsmasq.conf |
在最后加入
1 | conf-dir=/etc/dnsmasq.d |
,新建并进入目录
1 | /etc/dnsmasq.d |
,新建一个名为 redir.conf 的配置文件,内容如下:
[output]#使用非标准端口的opendns避免DNS污染
server=/google.com/208.67.220.220#443
#将解析出来的IP保存到名为redir的ipset表中
ipset=/google.com/redir[/output]
完整的由 gfwlist 生成的域名配置文件从 这里 下载,最后将以下内容加入到防火墙自定义规则中即可实现开机自动代理
[output]ipset -N redir iphash
iptables -t nat -A PREROUTING -p tcp -m set –match-set redir dst -j REDIRECT –to-port 1080[/output]
至此智能透明代理部分配置完成
6、Ubuntu系统 开放所有端口 iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F Ubuntu镜像默认设置了Iptable规则,关闭它, ap...