Armbian 更换清华源

https://www.cnblogs.com/mrzzoxo/p/15145153.html

su - root切换root用户,环境变量(root登录的,可以跳过)

image

2、apt update && apt upgrade 更新下当前系统和软件包

3、nano /etc/apt/sources.list 修改bullseye仓库名

image

或者直接清空原配置,复制下面的粘贴进去(这里用的清华源)

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
 
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
 
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
4、修改完成 Ctrl O保存,Ctrl X退出

5、接下来就可以进行升级了,apt update && apt upgrade ,输入Y继续

image

6、弹出更新日志,输入q退出(当然你想看的话,可以慢慢看)

image

7、升级过程中不询问就重新启动服务,选择Yes

image

8、接下来开始升级了(大概几分钟左右跑完)然后重启系统

image

9、重新登录系统,输入cat /etc/debian_version && uname --all 可以看到已经成功升级到Debian11

image

su - root切换root用户,环境变量(root登录的,可以跳过)

image

2、apt update && apt upgrade 更新下当前系统和软件包

3、nano /etc/apt/sources.list 修改bullseye仓库名

image

或者直接清空原配置,复制下面的粘贴进去(这里用的清华源)

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-freedeb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

4、修改完成 Ctrl O保存,Ctrl X退出

5、接下来就可以进行升级了,apt update && apt upgrade ,输入Y继续

image

6、弹出更新日志,输入q退出(当然你想看的话,可以慢慢看)

image

7、升级过程中不询问就重新启动服务,选择Yes

image

8、接下来开始升级了(大概几分钟左右跑完)然后重启系统

image

9、重新登录系统,输入cat /etc/debian_version && uname --all 可以看到已经成功升级到Debian11

image

动态域名解析ddns-ipv4/6

目前使用版本

需按提示拷贝config.json文件到指定目录

config.json样本

{
"$schema": "https://ddns.newfuture.cc/schema/v2.8.json",
"debug": false,
"dns": "alidns",
"id": "LTAI5tJZD",
"index4": "default",
"index6": "default",
"ipv4": [],
"ipv6": [
"nestpi.com",
"www.nestpi.com"
],
"proxy": null,
"token": "ZOGsWrjhw33",
"ttl": null
}
sudo python run.py
sudo bash systemd.sh install
sudo bash task.sh

未验证版本

for windows

Ipv6实现动态域名解析

import subprocess
import json


def generate_curl_command(conf, page):
    """
    Generate command to invoke "curl" for Cloudflare API communication.
    """
    
    pattern = """\
curl -X GET "https://api.cloudflare.com/client/v4/zones/%s/dns_records?page=%d" \
-H "X-Auth-Email:%s" -H "X-Auth-Key:%s" -H "Content-Type: application/json" \
"""
    command = pattern % (conf["zone_id"], page, conf["email"], conf["api_key"])
    
    return command


def load_user_config_file():
    """
    Load user configuration file in order to use Cloudflare API.
    """
    
    with open("config.json") as file:
        conf = json.load(file)
    
    if conf["proxied"]:
        conf["proxied"] = "true"
    else:
        conf["proxied"] = "false"
    
    return conf


def invoke_curl_command(command):
    """
    Invoke "curl" to use Cloudflare API to update DNS record.
    """
    
    curl_subp = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, _ = curl_subp.communicate()
    curl_subp.wait()
    curl_response = json.loads(stdout)
    
    return curl_response


def print_error_message(response):
    """
    Print human friendly error message.
    """
    
    print("Error occured when communicating to Cloudflare API.")
    print("The API returned the message below:")
    for error in response["errors"]:
        error_message = error["message"]
        print(error_message)
        
        
def find_record_id(page_num, conf):
    """
    Search through all pages to find desired record id.
    """
    
    dns_name = conf["name"]
    found = False
    record_id = None
    
    for i in range(page_num):
        curl_cmd = generate_curl_command(conf, i + 1)
        response = invoke_curl_command(curl_cmd)
        for entry in response["result"]:
            if entry["name"] == dns_name and entry["type"] == "AAAA":
                found = True
                record_id = entry["id"]
                break
        if found:
            break
        
    return record_id


def main():
    conf = load_user_config_file()

    dns_name = conf["name"]

    curl_cmd = generate_curl_command(conf, 1)
    response = invoke_curl_command(curl_cmd)

    if not response["success"]:
        print_error_message(response)
        exit(1)

    page_num = response["result_info"]["total_pages"]

    record_id = find_record_id(page_num, conf)

    if record_id is None:
        print("No DNS record of type AAAA is found given the name %s" % dns_name)
    else:
        print("Record id of name \"%s\" is: %s" % (dns_name, record_id))


if __name__ == "__main__":
    main()

下面的代码经过验证

#经验证代码
import time
import re
import requests
import pydnspod
import socket
import os

global old_ip

def get_local_ipv6():
    string = os.popen("ifconfig")
    ip = list(string)
    ip_str = str(ip)
    comp = re.compile("24[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*")
    ans = comp.findall(ip_str)
    return ans[0]
    
user_id = "189498"#更换成你的Token ID
user_token = "e0a8e5b1b2f1d0d88f7d3a9e9a7e07f4"#更换成你的Token 
domain = "carbin.press"#更换成你的域名
sub_domain = "@"#更换成你的记录
sub_domain_id = "683917156"#更换成你的记录ID
sub_domain1 = "www"
sub_domain_id1="688381119"
dp = pydnspod.connect(user_id,user_token)

old_ip=bytes(dp.record.info(domain,sub_domain_id)['value'],encoding='utf8')        


while(True):
    try: 
#        old_ip=str("b'"+dp.record.info(domain,sub_domain_id)['value']+"'")
        sock = socket.create_connection(('ns1.dnspod.net',6666),20)
        ipv4 = sock.recv(16)
        time.sleep(5)
        
        if old_ip != ipv4:
            print("当前记录:"+bytes.decode(old_ip))
            print("公网ip:"+bytes.decode(ipv4))
            time.sleep(2)
            return_ = dp.record.modify(domain,sub_domain_id,sub_domain,"A",ipv4)
            return_1= dp.record.modify(domain,sub_domain_id1,sub_domain1,"A",ipv4)
            old_ip=bytes(dp.record.info(domain,sub_domain_id)['value'],encoding='utf8')        
            print(return_)
            print(return_1)
            if (return_ == None or return_1 == None):
                print("未更新")
                time.sleep(2)
            else:
                print("已更新,等待300秒")
                time.sleep(300)
            
    except IndexError:
        print("网络未连接")
        time.sleep(2)
    except OSError:
        print("网络中断")
        time.sleep(2)

核大战毁灭全球可能是一个巨大的谎言

提起核战,可能让人毛骨悚然,毕竟二战期间美国在日本丢下的原子弹导致了全世界的恐惧。战后,大国间为了寻找不对称的平衡,争相将核武作为国家战略发展,几乎所有人都坚信只有拥有核武国家才能安全,甚至直至今日,伊朗、朝鲜对这样的理论还是顶礼膜拜。

但从人类历史上各种曾经的迷之自信的错误来看,核毁世界可能又是另一个无稽之谈,世界之大、地球的承受力之强、自然的平衡力之巨等等因素是很少有人考虑过的,而这些因素将是抵消核损毁的最强力量,可以说核大战在这些因素面前不值一提。相反,世界性的核战反而可能进一步改善地球环境,重新优化水、土、气资源,为地球的健康发展带来巨大的机会,也会下一个人类社会的发展提供史无前例的条件。

因此,俄乌冲突如果能发展成核战,对于人类和地球来说,塞翁失马焉知非福?

frp使用总结

1、光猫设置为拨号

2、路由器设置拨号用户名和密码,并设置DMZ为frps所在主机的ip

3、使用两个域名,域名的解析地址都是frps所在主机的ipv6地址

4、设置frps,启用80端口需要超级用户权限

5、设置frpc

6、作为系统启动

install homeassistant on raspberry

https://blog.csdn.net/weixin_43890033/article/details/124204909?spm=1001.2101.3001.6650.15&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-15-124204909-blog-123133450.pc_relevant_multi_platform_whitelistv4&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-15-124204909-blog-123133450.pc_relevant_multi_platform_whitelistv4&utm_relevant_index=18

光猫桥接模式设置指南(如何设置光猫为桥接模式)

https://www.luyouqi.com/shezhi/3012.html

光猫设置桥接模式,是家庭网络的一个基础设置,也是一个比较重要的设置。

设置了光猫桥接模式后,拨号上网由路由器来进行,可以方便进行其他网络相关操作,而且可以减少因为光猫问题造成的网络性能瓶颈,家庭网络故障等。

个人建议在办理宽带业务后,先将光猫设置为桥接模式之后,再进行其他的网络设备的连接和调试。

修改光猫为桥接,需要有一些网络知识,如果自行修改错误,造成无法上网。需要联系宽带师傅上门处理。光猫在默认的网关模式下,运营商是可以远程控制光猫的,进行配置下发等操作,光猫桥接后,一些光猫的问题,运营商无法远程处理,需要安排工程师上门,无形中增加了工程师的上门工作量,所以有时候宽带师傅不一定愿意给出光猫的超级管理员密码。所以好好对待宽带师傅哦,尽量自己可以搞光猫的问题。

因为光猫的品牌型号不同,操作页面会有所差异,请参考操作思路,不要全部照搬。

光猫桥接模式的具体步骤如下:

获取光猫的超级管理员账号密码

获取光猫的拨号账号名称和密码

修改光猫的桥接模式

关闭光猫的DHCP服务

配置路由器拨号

1、获取光猫的超级管理员账号密码

这个步骤是最关键的一步

我使用的是电信宽带,光猫型号为:中兴的ZXHN F650A

光猫照片

光猫背后的管理员账号,是一个普通的用户,登录光猫后台后,能配置的功能非常有限。

这个普通账号的用户名是:useradmin

普通账号登录后,是无法修改光猫的桥接模式的。

普通用户的后台,无法配置桥接设置

我们首先需要获取到光猫的超级管理员账号和密码

以电信光猫为例,可以直接百度搜索,关键字:电信光猫 超级管理员

电信光猫的超级管理员账号:telecomadmin

超级管理员密码:nE7jA%5m

登录地址:http://192.168.1.1

如果找到的密码无法登录管理后台,可以与光猫的安装师傅或者宽带客服电话联系,索取超级管理员密码。这是最简单快速的方法。不同的光猫品牌,不同型号,不同省市的

淘宝上也有很多光猫相关的服务,实在搞不定的时候,也可以去看看。

2、获取光猫的拨号账号和密码

因为光猫的默认状态是路由模式,由光猫进行PPPOE的拨号,拨号的用户名和密码直接配置在光猫中,我们并不知道,这个账号和密码,需要配置到我们自己的路由器上,所以需要先获取这个账号和密码。

这个账号和密码,需要与宽带运营商联系,运营商会核对办理宽带的信息,然后重置密码,告知我们拨号的账号和密码。找个地方,牢记账号和密码

3、修改光猫为桥接模式

使用超级管理员登录光猫的管理界面。

登录后看到的光猫管理界面,此时可以配置光猫的全部功能了。

超级管理员登录后的光猫后台

需要注意的是“业务信息”中的“上网”,此处的连接名称为:2_INTERNET_R_VID_41

点击上方的“网络” > “网络设置”>“网络连接”

光猫默认的路由模式

连接名称中选择:2_INTERNET_R_VID_41

看到默认的连接模式是:路由,将连接模式从路由,修改为桥接。修改为桥接后,可以看到用户名和密码的输入框消失了。

修改为桥接后,界面如下,然后点击保存。

修改为桥接模式

4、关闭光猫的DHCP服务

连接光猫后,需要手工将光猫的DHCP服务关闭,避免网络中存在多个DHCP,引起网络异常。

关闭光猫的DHCP服务后,网络中的DHCP服务由路由器来承担。

依次点击,网络 > 用户侧管理 > IPV4设置 > 取消DHCP Server的勾选。然后保存。

关闭光猫的DHCP

5、使用路由器进行拨号

将路由器的WAN口与光猫的LAN口连接。一定是非IPTV的网口,连接的时候一定要看清楚。

登录路由器的管理后台。以小米路由器为例

设置WAN口的上网方式,改为PPPOE。如果是光猫拨号,这里的上网方式是DHCP。

然后输入宽带的账号和密码。保存即可。路由器进行拨号。

配置路由器拨号

关闭光猫的DHCP服务后,如何访问光猫的管理后台?

关闭光猫的DHCP服务之后,光猫的默认管理IP为:192.168.1.1(请以实际的光猫IP为准)

通常不需要再登录光猫后台进行操作。

如果需要操作,需要将网线连接到光猫的LAN口和管理的电脑上。注意不要连接到光猫的IPTV接口,这个接口是无法进入光猫后台的。

在电脑上手工配置一个与光猫同网段的静态IP地址,比如:192.168.1.2,子网掩码:255.255.255.0

不需要配置网关和DNS。

然后在浏览器中输入光猫的管理IP,即可登录光猫的管理后台。

如果路由器支持双WAN口,可以将光猫的LAN口再连接到路由器的另外一个WAN口,WAN口配置一个与光猫同网段的IP即可。这样可以随时通过路由器的无线网络,访问光猫的后台。

也可以将路由器的上网方式,改为静态IP,配置一个与光猫同网段的IP,比如192.178.1.2,子网掩码:255.255.255.0,DNS和网关都是192.168.1.1,然后保存配置,这个时候通常路由器会重启,路由器重启后,可以通过路由器的无线网络,访问到光猫的后台。但是这个时候是不能上网的。

获取公网IP

如果可以获取到公网IP,那么对于网络使用来说,是非常有利的,可以方便地进行内网的服务管理,比如进行端口映射等操作。有了公网IP可以大大增强网络的功能。

获取公网IP,需要与宽带的服务商进行联系,反馈说需要公网IP,家里需要设置监控等。

获取到的公网IP,会在路由器的后台显示。如上图显示,我的路由器拨号后,获取的IP是124开头,这就是公网IP地址。

公网IP地址资源有限,家庭用户的公网IP,通常会过一段时间就会变更。建议搭配DDNS使用,可以通过域名来访问自己家庭的内网。

公网IP指的是,除了私有IP网段之外的IP,私有IP网段如下:这些IP都是在内部使用,不能在Internet上使用的IP。

A: 10.0.0.0~10.255.255.255 即10.0.0.0/8

B:172.16.0.0~172.31.255.255即172.16.0.0/12

C:192.168.0.0~192.168.255.255 即192.168.0.0/16

wordpress去除评论、文章发布时间及日期

有时候我们并不希望暴露我们的发布时间和作者,更多的时候我们非常反感垃圾评论污染我们的网站,幸好wordpress提供了丰富的插件扩展,安装以下插件解决问题:

安装两个插件:

1、WP Meta and Date Remover

2、Disable Comments – Remove Comments & Stop Spam [Multi-Site Support]

3、有些情况下还需要在wordprss的小工具中删除评论区