minio作为图床的 bucket 及 token 策略配置
bucket 策略配置 以下例子存储桶名称为pic,将 pic 设置为只读。 { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "*" ] }, "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::pic/**" ] } ] } access token 策略设置 access token 拥有读写权限。 { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::pic" ] }, { "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject" ], "Resource": [ "arn:aws:s3:::pic/*" ] } ] }
Archlinux Build Bochs Debugger Gui
背景 archlinux 默认安装的 bochs 不带 debug gui,调试程序时候需要在 bochs 手动打印寄存器及其他信息,通过 bochs 的 debug gui 可以方便查看程序相关信息。 创建 PKGBUILD 文件 mkdir bochs-enhanced-debugger touch PKGBUILD 参考AUR (en) - bochs-gdb-stub (archlinux.org) pkgname=bochs-enhanced-debugger pkgver=2.7 pkgrel=1 pkgdesc="A portable x86 PC emulation software package with enhanced debugger" arch=('x86_64') url="http://bochs.sourceforge.net/" license=('LGPL') depends=('gcc-libs' 'libxrandr' 'libxpm' 'gtk2') replaces=("bochs-enhanced-debugger") conflicts=("bochs-enhanced-debugger") source=("http://downloads.sourceforge.net/sourceforge/bochs/bochs-$pkgver.tar.gz") sha256sums=('a010ab1bfdc72ac5a08d2e2412cd471c0febd66af1d9349bc0d796879de5b17a') prepare() { cd "$srcdir/bochs-$pkgver" # 4.X kernel is basically 3.20 sed -i 's/2\.6\*|3\.\*)/2.6*|3.*|4.*)/' configure* } build() { cd "$srcdir/bochs-$pkgver" ./configure \ --prefix=/usr \ --without-wx \ --with-x11 \ --with-x \ --with-term \ --disable-docbook \ --enable-cpu-level=6 \ --enable-fpu \ --enable-3dnow \ --enable-disasm \ --enable-long-phy-address \ --enable-disasm \ --enable-pcidev \ --enable-usb \ --enable-iodebug \ --enable-smp \ --enable-x86-64 \ --enable-avx \ --enable-evex \ --enable-debugger \ --enable-x86-debugger \ --enable-debugger-gui #--with-sdl #--enable-all-optimizations #--enable-plugins sed -i 's/^LIBS = /LIBS = -lpthread/g' Makefile make -j $(nproc) } package() { cd "$srcdir/bochs-$pkgver" make DESTDIR="$pkgdir" install install -Dm644 .bochsrc "$pkgdir/etc/bochsrc-sample.txt" cd "$pkgdir/usr/bin/" mv bochs bochs-enhanced-debugger rm bximage cd "$pkgdir/usr/" rm -rfv share cd "$pkgdir" rm -rfv etc } 打包安装 bochs debugger gui makepkg sudo pacman -U bochs-enhanced-debugger*.pkg.tar.zst bochs 配置文件 配置文件末尾添加 display_library: x, options="gui_debug" ...
Ubuntu 下 Bind 配置 Dns 域名服务
背景 服务器上 systemd-resolved 经常挂掉,导致无法解析域名,排查问题无果遂决定使用 bind 替代 systemd-resolved 。 安装 bind sudo apt update sudo apt install bind9 编辑配置文件 编辑 bind 配置文件 /etc/bind/named.conf.options , 配置上游 dns 服务器 forwarders { 8.8.8.8;}; 及监听地址 listen-on { any; }; ,最终配置文件如下: options { directory "/var/cache/bind"; // If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113 // If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders. // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. forwarders { 8.8.8.8; }; //======================================================================== // If BIND logs error messages about the root key being expired, // you will need to update your keys. See https://www.isc.org/bind-keys //======================================================================== dnssec-validation auto; auth-nxdomain no; # conform to RFC1035 listen-on { any; }; listen-on-v6 { any; }; }; 启用 bind 服务 # 禁用 systemd-resolved sudo systemctl disable systemd-resolved.service # 启用 bind sudo systemctl enable bind9 --now
hugo 安装及配置
hugo 安装 github 创建仓库 git clone 仓库至本地 创建hugo项目 cd <仓库根目录> hugo new site . --force -f yml --force表示在已存在文件夹下创建网站 -f yml表示 hugo 的 config 使用 YAML 格式 导入主题模板,此处使用 PaperMod 主题 git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod git submodule update --init --recursive # 后续更新 papermod git submodule update --remote --merge 编辑目录下的 config.yaml 文件 baseURL: "https://k997.github.io" title: kong pagination.pagerSize: 7 theme: PaperMod enableInlineShortcodes: true enableRobotsTXT: true buildDrafts: false buildFuture: false buildExpired: false enableEmoji: true pygmentsUseClasses: true # googleAnalytics: UA-123-45 minify: disableXML: true minifyOutput: true menu: main: - identifier: archives name: 归档 url: archives/ weight: 5 - identifier: search name: 搜索 url: search/ weight: 20 - identifier: categories name: 分类 url: categories/ weight: 10 - identifier: tags name: 标签 url: tags/ weight: 10 outputs: home: - HTML - RSS - JSON params: env: production # to enable google analytics, opengraph, twitter-cards and schema. description: "kong's blog - k997.github.io" author: kong # author: ["Me", "You"] # multiple authors defaultTheme: auto # disableThemeToggle: true ShowShareButtons: true ShowReadingTime: true ShowPostNavLinks: true ShowBreadCrumbs: true ShowCodeCopyButtons: true ShowToc: true disableSpecial1stPost: false disableScrollToTop: false displayFullLangName: true # comments: false hidemeta: false hideSummary: false images: ["papermod-cover.png"] profileMode: enabled: false title: "kong's blog" imageUrl: "#" # imageTitle: my image # imageWidth: 120 # imageHeight: 120 buttons: - name: Archives url: archives - name: Tags url: tags homeInfoParams: Title: "kong's blog" Content: > 一个喜欢折腾的人的简单博客 # - 短横线后的内容跟上一行的内容在网页上被识别为一行 socialIcons: - name: github url: "https://github.com/k997" # - name: KoFi # url: "https://ko-fi.com/adityatelange" - name: RsS url: "index.xml" # jump github to make suggestions editPost: URL: "https://github.com/k997/k997.github.io/tree/main/content" Text: "你对文章的建议" # edit text appendFilePath: true # to append file path to Edit link twikoo: # 版本需和twikoo的版本号要对得上 version: "1.6.7" envId: "https://twikoo.kongwg.top" # label: # text: "Home" # icon: icon.png # iconHeight: 35 # analytics: # google: # SiteVerificationTag: "XYZabc" # assets: # favicon: "<link / abs url>" # favicon16x16: "<link / abs url>" # favicon32x32: "<link / abs url>" # apple_touch_icon: "<link / abs url>" # safari_pinned_tab: "<link / abs url>" # cover: # hidden: true # hide everywhere but not in structured data 是否在下面两种情况下显示 # hiddenInList: true # hide on list pages and home 是否在列表视图中显示 # hiddenInSingle: true # hide on single page 是否在单页视图中显示 # fuseOpts: # isCaseSensitive: false # shouldSort: true # location: 0 # distance: 1000 # threshold: 0.4 # minMatchCharLength: 0 # keys: ["title", "permalink", "summary", "content"] taxonomies: category: categories tag: tags series: series markup: goldmark: renderer: unsafe: true # highlight: # # anchorLineNos: true # codeFences: true # guessSyntax: true # lineNos: true # # noClasses: false # style: monokai privacy: vimeo: disabled: false simple: true x: disabled: false enableDNT: true simple: true instagram: disabled: false simple: true youtube: disabled: false privacyEnhanced: true services: instagram: disableInlineCSS: true x: disableInlineCSS: true 汉化 分类 ...