24a's blog
0x24a's personal blog website.
首页
友情链接
关于
文章分类
按月归档
常用标签
友情链接
您正在查看:标签 技术 下的文章

问题的发现

一次试图启动 WatchDiscord,显示“无法找到使用此主机名的主机”,吓嘻了。
以为我域名给运营商 DNS 污染了,回家一看,使用 1.1.1.1,8.8.8.8 还有一堆 DoH,DoT 解析器都只返回 NXDOMAIN。


第一时间以为是 cf 的问题,可经过一番搜索,好像除了我没有第二个人出过这个问题。于是跑到注册商腾讯云看一眼。
不出所料,开幕雷击,ServerHold!

Domain Status: serverDeleteProhibited https://www.icann.org/epp#serverDeleteProhibited
Domain Status: serverHold https://www.icann.org/epp#serverHold
Domain Status: serverTransferProhibited https://www.icann.org/epp#serverTransferProhibited

试图解决

Google 搜了一下,发现 serverHold 只有两种可能,一种是 whois 联系人信息是虚假的,还有就是域名有滥用行为。
众所周知,腾讯云会对 whois 联系人进行严格的认证,所以不可能是第一种。
那就是第二种了??我一向遵纪守法,怎么会干出 abuse 的事。
向腾讯云发了工单,光速回答是误封,说注册局需要 1 - 3 个工作日才能回答。
等了五天,还没有回答,给我气急了,又发了一次工单,这次就火速Domain Status: ok了。

吐槽

icann 你收这么多钱还瞎几把封域名,什么 b 东西啊

尝试使用 extern

  尽管我没学过 C ++, 但我知道有 extern 这个关键字,可以让编译器从其他文件找到变量的内容。
一开始试图采用import {} from {}的语法,即为将其他的 SBLang 文件编译为头文件后,在 g ++ 编译最终文件时链接起来。
经过测试,无论怎么修改,结果只有两种:访问的是无效变量或报错。
由于 extern 太复杂,我尝试通过将其他 SBLang 转换为 C ++ 头文件后,在主程序内 include。
实现代码如下:

def fromimport(runtime,line):
    runtime.externs.add(line[1])

然后在编译器 (sblang2c.py) 中:

print('-| Resolving externs')
links=[]
mapping={}
if len(runtime.externs) == 0:
    print("-| No externs")
else:
    runtime.externs=list(runtime.externs)
    print(f"-| Compiling {len(runtime.externs)} head(s)")
    for count in range(1,len(runtime.externs)+1):
        print(f"- -|{count}/{len(runtime.externs)}: {runtime.externs[count-1]}")
        filename=f"_sblang_header_{secrets.token_hex(16)}.h"
        temps.append(filename)
        with open(runtime.externs[count-1],"r",encoding="utf-8") as f:
            modcode=f.read()
        with open(filename,"w+") as f:
            rt=converter.Runtime()
            try:
                for i in modcode.splitlines():
                    rt.translate(i)
            except BaseException as e:
                print(f"\n! Error when converting: {e}")
                from traceback import print_exc
                print_exc()
                exit(1)
            rt.heads=[]
            f.write(rt.export_final())
            if rt.externs != []:
                print("WARN: Multi-layer extern is not supported yet, ignoring.")
        mapping.update({runtime.externs[count-1]:filename})
        print(f"- -|{count}/{len(runtime.externs)}: {runtime.externs[count-1]}: Success")
new=[]
for i in runtime.externs:
    data=mapping.get(i,i)
    if data != i:
        data=os.getcwd()+"/"+data
    runtime.heads.add(data)

注:这里os.getcwd()+"/"+data是因为经过测试,只有使用绝对路径 G ++ 才能正确的同时编译头文件。

开始跑测试。
import.sbl

main
    import import_head.sbl
    output "1+1="
    output plusOne(1)
end

import_head.sbl

define plusOne num
    return (1+num)
define end
python3 sblang2c.py --gcc-binary=/opt/homebrew/bin/g++-13 --debug import.sbl
SBLang2C Compiler and converter v0.0.2-dev-2
-| Reading File 0.13995 ms
-| Converting to C++
- -| Creating Runtime 0.0031 ms
- -| Converting
DEBUG:root:Running Dynamic Command: main
DEBUG:root:Running Dynamic Command: import
DEBUG:root:Running Dynamic Command: output
DEBUG:root:Running Dynamic Command: output

 0.09823 ms
-| Resolving externs
-| Compiling 1 head(s)
- -|1/1: import_head.sbl
DEBUG:root:Running Dynamic Command: define
DEBUG:root:Function Info:
DEBUG:root:Running Checker:return (1+num)
DEBUG:root:{'DEFINEING': True, 'DEFINE_DATA': {'name': 'plusOne', 'args': ['auto num'], 'lines': []}}
DEBUG:root:Running Dynamic Command: return
DEBUG:root:Added: {'name': 'plusOne', 'args': ['auto num'], 'lines': ['return (1+num);']}
DEBUG:root:Stopped by Global-Checker
DEBUG:root:Running Checker:define end
DEBUG:root:Generated Program:auto plusOne(auto num){
return (1+num);}
DEBUG:root:Stopped by Global-Checker
DEBUG:root:Exporting....
DEBUG:root:Headers: []
- -|1/1: import_head.sbl: Success
- -| Writing to temp file
DEBUG:root:Exporting....
DEBUG:root:Headers: {'/Users/0x24a/Desktop/Projects/SBLang2C/tests/_sblang_header_720038921a2546135b37567b58b5aae4.h', 'bits/stdc++.h'}

 0.09298 ms
-| Compiling with g++
- -| Awaiting G++ execute 1371.68694 ms
-| Removeing Tempfile
-| Exiting Compile.
➜  tests git:(main) ✗ ./import
1+1=2

这里虽然仅仅输出了“1+1=2”, 但这个 "2" 是从其他文件获得的,这是 SBLang2C 的一个大进步!

前言

说实话,安装这个博客是因为看yu22c 现因部分原因已换为其他博客系统 又换回来了 已换为 xlog.app)的博客非常眼馋,毕竟 Typecho 能用 markdown 进行编辑,对于我这个重度 Hack.chat 用户极度友好。心血来潮,我直接在 wwwroot 内输入了rm -rf ./blog/.

开始安装

创建文件夹

真的有人不会这一步吗?
mkdir blog

下载 typecho

wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip
unzip ./typecho.zip

配置基本参数

前往 http(s):// 域名 /ip: 端口 (如果有)/install.php
随着指导来就行
对了,确保配置好了 nginx 服务此目录且安装了 php.

美化

把前面的步骤都做完了,你的站点按理来说应该可以正常访问了。但是 typecho 的这个默认主题,属实有点智障。
在此推荐 EAimTY 的 materiality-typecho-theme。
下载地址为 https://github.com/EAimTY/materiality-typecho-theme/releases/download/4.8.10/v4.8.10.zip
经过前面的那几步,你应该知道怎么安装。cd 到 /< 你的 typecho 安装绝对路径 >/usr/themes/
然后 wget 下来,unzip 就安装完成了。
登入账号后,在 http(s):// 你的站点 /admin/themes.php 启用主题。
别忘了在 /admin/options-general.php , /admin/profile.php 和 /admin/options-theme.php 来进行进一步配置。

核能警告!下方非教学,仅为个人踩的坑!
如果你是出于学习目的来到这篇文章,继续看下去。如果你是为了安装自己的博客而来到这篇文章,下面的内容你不需要实施!

踩坑

我一开始选择的是 ZigZagK 的 MDUI2333 主题,安装之后整个页面都无法访问。
经过询问聊天室内的 4n0n4me 大佬后,发现是一个 PHP7.4 以后的语法变化。我将 PHP 降级到 7.4 以下后,页面的大致轮廓已经渲染出来了,但是文字全都是 PHP 的报错信息。
我试图将代码丢给 万能的 GPT 进行修复,但是我唯一能访问的免费 GPT 提供商 Poe, 会自动爬取内容中所有 HTTP 地址的内容,这无疑直接把 GPT 上下文撑爆了。
直接摆烂,换其他主题后,恢复正常了。