共有 274 篇文章
Tag
2023-07-09 - 2024-09-18

编写

编写tag.htmltag_?.html放在layouts/shortcodes/文件夹中

1<!-- layouts/shortcodes/tag.html -->
2<strong style= "background: {{ .Get "colour" }};border: 1px solid {{ .Get "colour" }};border-radius: 5px;">{{ .Get "tag" }}</strong>
1<!-- layouts/shortcodes/tag_academic.html -->
2<strong style= "background: #33BBFF;border: 1px solid #33BBFF;border-radius: 5px;">学术</strong>

使用

 1{{< tag colour="green" tag="自定义" >}}
 2
 3{{< tag_academic >}}
 4{{< tag_read >}}
 5{{< tag_sport >}}
 6{{< tag_kegel >}}
 7{{< tag_relax >}}
 8{{< tag_bathe >}}
 9{{< tag_play >}}
10{{< tag_go_out >}}
11{{< tag_hentai >}}
自定义

学术

阅读

运动

提肛

放松

洗澡

游戏

外出

 色色 

修改字体
2023-07-08 - 2024-09-18

1. 下载字体

添加到static/fonts文件夹下,若使用了主题则可以放在主题的fonts文件夹下,如themes/archie/static/fonts

2. 添加字体

fonts.css中添加字体,如themes/archie/assets/css/fonts.css

Disable Windows Hibernate
2023-06-28 - 2024-09-18
Hiberfil.sys文件位于系统盘的根目录下,这是一个受保护的操作系统文件,它是 win10 休眠功能(Hibernation)中将内存数据与会话数据保存到电脑硬盘、以便于win10计算机断电重新启动后可以快速恢复会话所需的内存镜像文件。在离开计算机一段时间后,计算机将会进入休眠状态。计算机休眠文件就是hiberfil.sys,一般情况它会占用很大存储空间。
TTYD 开启SSL
2023-06-28 - 2024-09-18

修改/etc/config/ttyd

1config ttyd
2        option interface '@lan'
3        option command '/bin/login'
4        option ssl 'true'
5        option ssl_cert '/viry/cert/akvicor.com.crt'
6        option ssl_key '/viry/cert/akvicor.com.key'
OpenWrt管理后台使用Caddy代替uhttpd
2023-06-28 - 2024-09-18

暂停uhttpd服务

uhttpd服务占用了80端口,需要先暂停。使用ssh登录openwrt,执行下面命令暂停uhttpd服务:

1/etc/init.d/uhttpd stop
2/etc/init.d/uhttpd disable

下载caddy

额外功能模块选上aksdb/caddy-cgi/v2

Compile
2023-06-26 - 2024-09-18

平台

  • Ubuntu 20.04.6 LTS

编译环境

1sudo apt update -y
2sudo apt full-upgrade -y
3sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
4bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
5git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
6libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
7mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pyelftools \
8libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \
9vim wget xmlto xxd zlib1g-dev

编译OpenWrt

 1# 下载
 2git clone https://github.com/coolsnowwolf/lede && cd lede
 3
 4# 添加其他源
 5echo "src-git kenzo https://github.com/kenzok8/openwrt-packages" >> feeds.conf.default
 6echo "src-git small https://github.com/kenzok8/small" >> feeds.conf.default
 7
 8# 更新源
 9./scripts/feeds update -a
10./scripts/feeds install -a
11
12# 修改默认IP为 10.0.0.2
13sed -i 's/192.168.1.1/172.16.1.1/g' package/base-files/files/bin/config_generate
14
15# 修改默认主机名
16sed -i '/uci commit system/i\uci set system.@system[0].hostname='op'' package/lean/default-settings/files/zzz-default-settings
17
18# 加入编译者信息
19sed -i "s/OpenWrt /Akvicor build $(TZ=UTC-8 date "+%Y.%m.%d") @ OpenWrt /g" package/lean/default-settings/files/zzz-default-settings
20
21# 修改banner
22echo -e "-------------------------------------------\n %D %V, %C\n-------------------------------------------" > package/base-files/files/etc/banner
23
24# 修改IPSec VPN账户名
25sed -i "s/ 'lean'/ 'akvicor'/g" feeds/luci/applications/luci-app-ipsec-vpnd/root/etc/config/ipsec
26
27# 配置
28make menuconfig
29
30# 修改分区大小
31Target Images -> Kernel partition size -> 64
32Target Images -> Root filesystem partition size -> 4096
33
34# 添加编程语言支持
35Languages -> Go -> golang -> on
36
37# 关闭adbyby plus
38LuCI -> 3. Applications -> luci-app-adbyby-plus -> off
39
40# 添加AdguardHome
41LuCI -> 3. Applications -> luci-app-adguardhome -> on
42
43# 添加EQOS
44LuCI -> 3. Applications -> luci-app-eqos -> on
45
46# 添加Passwall代理
47LuCI -> 3. Applications -> luci-app-passwall -> on
48
49# 添加方糖气球 serverchan
50LuCI -> 3. Applications -> luci-app-serverchan -> on
51
52# 添加watchcat
53LuCI -> 3. Applications -> luci-app-watchcat -> on
54
55# 关闭迅雷快鸟
56LuCI -> 3. Applications -> luci-app-xlnetacc -> off
57
58# 关闭zerotier (一个开源VPN服务,但是需要通过第三方网站使用
59LuCI -> 3. Applications -> luci-app-zerotier -> off
60
61# 下载
62make download -j8
63
64# 编译
65screen -S build
66make V=s -j1

在esxi测试

 1# 上传vmdk文件
 2# ssh连接esxi
 3cd /vmfs/volumes/hhd/op
 4ls *.vmdk
 5vmkfstools -i openwrt-x86-64-generic-squashfs-combined-efi.vmdk opd.vmdk
 6vmkfstools -X 5120M opd.vmdk # 需大于源文件大小
 7# 更换op虚拟机的硬盘文件
 8
 9# 配置测试网络
10vim /etc/config/network
11# 修改lan的ip地址
12# 重启网络,通过浏览器访问
13/etc/init.d/network restart
AdGuard Home
2023-06-26 - 2024-09-18

配置

  • 端口:11004
  • 5553重定向:使用53端口替换dnsmasq
  • 执行文件路径:/viry/serv/AdGuardHome/exec/AdGuardHome
  • 配置文件路径:/viry/serv/AdGuardHome/data/AdGuardHome.yaml
  • 工作目录:/viry/serv/AdGuardHome
  • 运行日志路径:/viry/serv/AdGuardHome/data/AdGuardHome.log

无法更新内核

问题出在默认执行文件路径不对,将执行文件路径修改为 /usr/bin/AdGuardHome/AdGuardHome

窗口置顶
2023-06-11 - 2024-09-18

将窗口标题中带有指定字符串的窗口置顶,使其显示在所有窗口之上

 1package main
 2
 3import (
 4	"golang.org/x/sys/windows"
 5	"strings"
 6	"syscall"
 7	"unsafe"
 8)
 9
10func AlwaysOnTop() {
11	SetWindowAlwaysOnTop(GetWindowHandleByWindowName("Title"))
12}
13
14const SWP_NOSIZE = uintptr(0x0001)
15const SWP_NOMOVE = uintptr(0x0002)
16
17// This is dumb but Go doesn't like the inline conversion (see above image).
18func IntToUintptr(value int) uintptr {
19	return uintptr(value)
20}
21
22func SetWindowAlwaysOnTop(hwnd uintptr) {
23	user32dll := windows.MustLoadDLL("user32.dll")
24	setwindowpos := user32dll.MustFindProc("SetWindowPos")
25	setwindowpos.Call(hwnd, IntToUintptr(-1), 0, 0, 100, 100, SWP_NOSIZE|SWP_NOMOVE)
26}
27
28func GetWindowHandleByWindowName(window_name string) uintptr {
29	user32dll := windows.MustLoadDLL("user32.dll")
30	enumwindows := user32dll.MustFindProc("EnumWindows")
31
32	var the_handle uintptr
33	window_byte_name := []byte(window_name)
34
35	// Windows will loop over this function for each window.
36	wndenumproc_function := syscall.NewCallback(func(hwnd uintptr, lparam uintptr) uintptr {
37		// Allocate 100 characters so that it has something to write to.
38		var filename_data [100]uint16
39		max_chars := uintptr(100)
40
41		getwindowtextw := user32dll.MustFindProc("GetWindowTextW")
42		getwindowtextw.Call(hwnd, uintptr(unsafe.Pointer(&filename_data)), max_chars)
43
44		// If there's a match, save the value and return 0 to stop the iteration.
45		if strings.Contains(string(windows.UTF16ToString([]uint16(filename_data[:]))), string(window_byte_name)) {
46			the_handle = hwnd
47			return 0
48		}
49
50		return 1
51	})
52
53	// Call the above looping function.
54	enumwindows.Call(wndenumproc_function, uintptr(0))
55
56	return the_handle
57}
运行时隐藏控制台
2023-06-11 - 2024-09-18

常用于go编写的gui项目

1go build -ldflags "-H windowsgui"
go编译文件带上图标
2023-06-11 - 2024-09-18

默认的go build -o xxx.exe这样是没有图标的,不怎么好看。

首先下载文件:

1git clone  https://github.com/akavel/rsrc.git

进入目录,把上面的代码编译一下

1go build rsrc.go # 然后有个rsrc.exe文件

就在rsrc的目录下创建个ico.manifest,内容如下:

rsync 文件夹同步
2023-05-29 - 2024-09-18

描述

cp和scp是ubuntu中文件拷贝常用的两个命令,一般在同一台服务器上我们是用cp命令,跨服务时使用过scp命令,但是如果做文件同步的话,rsync要比上述两个命令更好用一些,跨不跨服务器都是如此。