mirror of
https://github.com/dongdigua/dongdigua.github.io
synced 2024-11-24 04:03:11 +08:00
postamble color to gentoo purple, rm bbs iconv code
This commit is contained in:
parent
0a3c108324
commit
fd4b63b771
@ -320,7 +320,7 @@ https://github.com/rgb-24bit/org-html-theme-list org-joshua
|
|||||||
padding: .3em;
|
padding: .3em;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
background-color: #d7dfed; /* same as pre */
|
background-color: #dddaec; /* Gentoo Purple */
|
||||||
}
|
}
|
||||||
|
|
||||||
#show_source {
|
#show_source {
|
||||||
|
@ -37,8 +37,10 @@ var data = [
|
|||||||
"你说得对,但是《长安汽车》是由艺画开天自主研发的一款全新开放世界冒险游戏。",
|
"你说得对,但是《长安汽车》是由艺画开天自主研发的一款全新开放世界冒险游戏。",
|
||||||
"Emacs has Evil, but Vim doesn't have Magit",
|
"Emacs has Evil, but Vim doesn't have Magit",
|
||||||
"免费服务的代价就是你自己",
|
"免费服务的代价就是你自己",
|
||||||
"<a id=quote href=https://www.openbsd.org/lyrics.html#62> The only change that was required was a three-line diff</a>",
|
"<a id=quote href=https://www.openbsd.org/lyrics.html#62>The only change that was required was a three-line diff</a>",
|
||||||
"<a id=quote href=https://www.gnu.org/music/free-software-song.en.html>GNU SLASH MUZIC</a>",
|
"<a id=quote href=https://www.gnu.org/music/free-software-song.en.html>GNU SLASH MUZIC</a>",
|
||||||
|
"<a id=quote href=https://book.bsdcn.org/di-19-zhang-wen-xue-gu-shi/di-19.3-jie-linux-yu-ku-nan-zhe-xue.html>FreeBSD 拼写有四样写法,你知道么?”,“不能写罢?……我教给你,记着!\n‘FreeBSD’、‘freeBSD’、‘Freebsd’、‘freebsd’这些字应该记着。\n以后做 FreeBSD 管理员的时候,写文档要用。</a>",
|
||||||
|
"不要说我们一无所有, 我们要把世界格式化",
|
||||||
];
|
];
|
||||||
|
|
||||||
var index = Math.floor((Math.random() * data.length));
|
var index = Math.floor((Math.random() * data.length));
|
||||||
|
@ -15,6 +15,9 @@ BIOS: ami
|
|||||||
但是这种 IO 密集型任务南桥会很烫烫烫, 所以还是开着
|
但是这种 IO 密集型任务南桥会很烫烫烫, 所以还是开着
|
||||||
|
|
||||||
* Alpine? no
|
* Alpine? no
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: alpine
|
||||||
|
:END:
|
||||||
Alpine 是一个很好的发行版, 使用 "suck less" 的 musl 和 OpenRC
|
Alpine 是一个很好的发行版, 使用 "suck less" 的 musl 和 OpenRC
|
||||||
ps 看进程不到一页
|
ps 看进程不到一页
|
||||||
*但 是*
|
*但 是*
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
#+TITLE: 支线任务: 中文 BBS GBK 转 UTF8
|
|
||||||
#+DESCRIPTION: 造轮子好玩
|
|
||||||
#+DATE: <2023-01-27 五>
|
|
||||||
|
|
||||||
我过年这两天在服务器运维群看到了 水木清华BBS 这个东西,
|
|
||||||
于是就 telnet 试了下, 发现字符集是 GBK!
|
|
||||||
emmm, 设置环境变量启动终端不行, 就得在 gnome-terminal 设置里面弄.
|
|
||||||
|
|
||||||
进去看了, 发现好多神奇的东西, 但整体还是没落, 现在还是虎年的欢迎页面...
|
|
||||||
结合我之前在 sdf.org, 新黑客词典, youtube 等地方看到的关于 BBS 的记忆片段,
|
|
||||||
使我开始考古这个从曾经那个时代来的我从没接触过的东西.
|
|
||||||
|
|
||||||
先解决客户端问题:
|
|
||||||
我在 Back To BBS 节目里面看到了 [[https://syncterm.bbsdev.net][Syncterm]] 和 [[http://www.mysticbbs.com/downloads.html][Netrunner]],
|
|
||||||
一个不支持中文, 一个根本无法启动 (cannot open display).
|
|
||||||
然后我找到了 qterm, 先是在水木 FreeBSD 版块看见的, 后来搜索 BBS 客户端时想起来了.
|
|
||||||
下下来试一下, 不错. 但是我不想为了这一个东西而装一个额外软件, 还得编译.
|
|
||||||
|
|
||||||
然后就想, 如果不能终端解码, 那为啥不先转换成 UTF8 再显示呢?
|
|
||||||
那就 iconv? 结果人家是全输入完 EOF 了才显示...
|
|
||||||
有没有方式能不缓冲而是 on-the-fly 呢? 搜索引擎没搜到.
|
|
||||||
|
|
||||||
那就自己写!
|
|
||||||
iconv 是基于 libiconv 库, 看看文档就能写了, 虽然我基本没写过 C 代码.
|
|
||||||
为什么不用 Rust? 因为我弄这个主要还是想弄到 OpenBSD 上, Rust 要一些依赖, 而 C 直接就能用.
|
|
||||||
#+BEGIN_SRC C
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <iconv.h>
|
|
||||||
|
|
||||||
#define UTF8_SIZE 4
|
|
||||||
|
|
||||||
int
|
|
||||||
convert_one(iconv_t cd)
|
|
||||||
{
|
|
||||||
char inbuf[2] = {0};
|
|
||||||
char outbuf[UTF8_SIZE] = {0};
|
|
||||||
size_t insize = 1;
|
|
||||||
size_t outsize = UTF8_SIZE;
|
|
||||||
|
|
||||||
char c = getchar();
|
|
||||||
if (c == EOF)
|
|
||||||
return 1;
|
|
||||||
inbuf[0] = c;
|
|
||||||
|
|
||||||
char * pIn = inbuf;
|
|
||||||
char * pOut = (char*) outbuf;
|
|
||||||
|
|
||||||
size_t iconv_result = iconv(cd, &pIn, &insize, &pOut, &outsize);
|
|
||||||
if (iconv_result == (size_t) -1) {
|
|
||||||
inbuf[1] = getchar();
|
|
||||||
insize = 2;
|
|
||||||
iconv(cd, &pIn, &insize, &pOut, &outsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < UTF8_SIZE; i++) {
|
|
||||||
if (outbuf[i] != 0)
|
|
||||||
putchar(outbuf[i]);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(void)
|
|
||||||
{
|
|
||||||
iconv_t cd = iconv_open("UTF8", "GBK");
|
|
||||||
while (1)
|
|
||||||
if (convert_one(cd) == 1) break;
|
|
||||||
|
|
||||||
iconv_close(cd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
好使, 但是, 我写这篇文章的时候又过去看了眼那个帖子的回复, 发现有这个:
|
|
||||||
#+BEGIN_EXAMPLE
|
|
||||||
luit -encoding gbk <command>
|
|
||||||
#+END_EXAMPLE
|
|
||||||
嗯, 好使...
|
|
||||||
另一个帖子说 GNU screen 也可以,
|
|
||||||
然后搜索 screen 转码的时候看到了这个 [[https://wadarochi.github.io/2011/05/24/GNU-screen-encoding的替代品,自制BBS转码脚本/][GNU screen encoding的替代品,自制BBS转码脚本]]
|
|
||||||
|
|
||||||
*但自己造轮子还是很开心哈哈*
|
|
@ -12,6 +12,7 @@ gcc (it's GNU emacs, so...) 参数来源:
|
|||||||
- https://snoopitek.com/make.conf
|
- https://snoopitek.com/make.conf
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
./configure CFLAGS="-march=native -O3 -pipe -fno-math-errno -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -fno-strict-aliasing -fno-common -fipa-pta -fno-plt" \
|
./configure CFLAGS="-march=native -O3 -pipe -fno-math-errno -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -fno-strict-aliasing -fno-common -fipa-pta -fno-plt" \
|
||||||
|
LDFLAGS="-Wl,-no-as-needed -ljemalloc -Wl,-as-needed" \
|
||||||
--with-x=no \
|
--with-x=no \
|
||||||
--with-gpm=no \
|
--with-gpm=no \
|
||||||
--with-pgtk \
|
--with-pgtk \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#+TAGS: elixir(e) rust(r) c(c) lisp(l) python(p) nim(n)
|
#+TAGS: elixir(e) rust(r) c(c) lisp(l) python(p) nim(n)
|
||||||
#+TAGS: lowlevel(w) frontend(f) backend(b) algorithm(a) math(t)
|
#+TAGS: lowlevel(w) frontend(f) backend(b) algorithm(a) math(t)
|
||||||
#+TAGS: hack(h) fun(u) wow(O)
|
#+TAGS: hack(h) fun(u) wow(O)
|
||||||
#+TAGS: emacs(m) linux(x) iot(i) plan9(9) BSD(B)
|
#+TAGS: emacs(m) linux(x) iot(i) plan9(9) BSD(B) PGP(P)
|
||||||
#+TAGS: smth mailinglist
|
#+TAGS: smth mailinglist
|
||||||
#+OPTIONS: toc:1 ^:{}
|
#+OPTIONS: toc:1 ^:{}
|
||||||
|
|
||||||
@ -16,8 +16,8 @@
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_QUOTE
|
#+BEGIN_QUOTE
|
||||||
这才是互联网好玩的地方, 你总能在某个奇怪的角落发现神奇的东西
|
You can always find something magical on the Internet.
|
||||||
-- 我
|
-- says an anonymous AI
|
||||||
#+END_QUOTE
|
#+END_QUOTE
|
||||||
|
|
||||||
* (Personal) Blogs
|
* (Personal) Blogs
|
||||||
@ -171,13 +171,14 @@ funny byte
|
|||||||
**** [[https://lantian.pub/article/modify-website/how-to-kill-the-dn42-network.lantian/][如何引爆 DN42 网络]]
|
**** [[https://lantian.pub/article/modify-website/how-to-kill-the-dn42-network.lantian/][如何引爆 DN42 网络]]
|
||||||
** [[https://ulyc.github.io/][UlyC]] :python:
|
** [[https://ulyc.github.io/][UlyC]] :python:
|
||||||
*** [[https://ulyc.github.io/2022/08/10/sourcehut-the-hackers-forge/][sourcehut, 一个反叛而又正统的代码托管平台]]
|
*** [[https://ulyc.github.io/2022/08/10/sourcehut-the-hackers-forge/][sourcehut, 一个反叛而又正统的代码托管平台]]
|
||||||
*** [[https://ulyc.github.io/2021/01/13/2021年-用更现代的方法使用PGP-上/][2021年, 用更现代的方法使用PGP]]
|
*** [[https://ulyc.github.io/2021/01/13/2021年-用更现代的方法使用PGP-上/][2021年, 用更现代的方法使用PGP]] :PGP:
|
||||||
#+BEGIN_QUOTE
|
#+BEGIN_QUOTE
|
||||||
同样是非对称算法, 为什么PGP的私钥就长这么多呢?
|
同样是非对称算法, 为什么PGP的私钥就长这么多呢?
|
||||||
因为他们用的算法不同, 比特币默认使用的是ECDSA的 secp256k1算法, 该算法只是用来签名和认证, 并不用来加密
|
因为他们用的算法不同, 比特币默认使用的是ECDSA的 secp256k1算法, 该算法只是用来签名和认证, 并不用来加密
|
||||||
(signify 只用于签名认证, age 只用于加密, 所以密钥也比较短)
|
(signify 只用于签名认证, age 只用于加密, 所以密钥也比较短)
|
||||||
#+END_QUOTE
|
#+END_QUOTE
|
||||||
**** [[https://spwo.notion.site/GitHub-6b1e1d57f52c4664bff61cadb3f9cb8d][震惊! 竟然有人在 GitHub 上冒充我的身份!]]
|
**** [[https://spwo.notion.site/GitHub-6b1e1d57f52c4664bff61cadb3f9cb8d][震惊! 竟然有人在 GitHub 上冒充我的身份!]]
|
||||||
|
**** [[https://chenhe.me/post/yubikey-starting-gpg/][YubiKey 入手记 - GPG]]
|
||||||
*** [[https://ulyc.github.io/2019/08/01/初窥CORB/][Cross-Origin Read Blocking]]
|
*** [[https://ulyc.github.io/2019/08/01/初窥CORB/][Cross-Origin Read Blocking]]
|
||||||
** [[https://kernal.eu][kernal]]
|
** [[https://kernal.eu][kernal]]
|
||||||
Welcome to the darkest dungeon of kernal
|
Welcome to the darkest dungeon of kernal
|
||||||
@ -260,6 +261,10 @@ very beautiful page
|
|||||||
** [[https://awesomekling.github.io][Andreas Kling (SerenityOS)]]
|
** [[https://awesomekling.github.io][Andreas Kling (SerenityOS)]]
|
||||||
** [[https://blog.codingnow.com][云风的 BLOG]]
|
** [[https://blog.codingnow.com][云风的 BLOG]]
|
||||||
*** [[https://blog.codingnow.com/2012/07/c_coroutine.html][C 的 coroutine 库]]
|
*** [[https://blog.codingnow.com/2012/07/c_coroutine.html][C 的 coroutine 库]]
|
||||||
|
** [[https://feng.si][feng.si]]
|
||||||
|
*** [[https://dejavu.moe/posts/vanity-pgp/][某科学的 PGP 算号指南]] :PGP:
|
||||||
|
*** [[https://feng.si/posts/2019/07/centos-the-last-linux-distro-you-should-ever-consider][CentOS: 永远有多远就离它多远]]
|
||||||
|
|
||||||
|
|
||||||
** B/HWS/fri3nds
|
** B/HWS/fri3nds
|
||||||
*** [[https://shakaianee.top/][社会易姐]]
|
*** [[https://shakaianee.top/][社会易姐]]
|
||||||
@ -385,6 +390,7 @@ inspiration: Veritasium
|
|||||||
*** [[https://youtu.be/MnJh1xJ7rDY][lisp on arduino (Tuesday Streams)]]
|
*** [[https://youtu.be/MnJh1xJ7rDY][lisp on arduino (Tuesday Streams)]]
|
||||||
*** [[https://youtu.be/QaLvtNpoc5o][RubyKaigi 2015: JIT]]
|
*** [[https://youtu.be/QaLvtNpoc5o][RubyKaigi 2015: JIT]]
|
||||||
*** [[https://youtu.be/1EIpek60rs0][DT: Linux Has Become Complicated And Limiting]]
|
*** [[https://youtu.be/1EIpek60rs0][DT: Linux Has Become Complicated And Limiting]]
|
||||||
|
*** [[https://youtu.be/saq3JGOsB3M][How to Predict a DVD Logo Hitting the Corner!]]
|
||||||
|
|
||||||
** [[https://www.youtube.com/@Computerphile][<C>]]
|
** [[https://www.youtube.com/@Computerphile][<C>]]
|
||||||
*** [[https://youtu.be/BAo5C2qbLq8][Network Time Protocol (NTP)]]
|
*** [[https://youtu.be/BAo5C2qbLq8][Network Time Protocol (NTP)]]
|
||||||
@ -490,6 +496,7 @@ Huwawei NB!
|
|||||||
** [[https://lore.kernel.org/lkml/63efd7ab.170a0220.3442b.6609@mx.google.com/][Linus: If you cannot explain a merge, then JUST DON'T DO IT]]
|
** [[https://lore.kernel.org/lkml/63efd7ab.170a0220.3442b.6609@mx.google.com/][Linus: If you cannot explain a merge, then JUST DON'T DO IT]]
|
||||||
** [[https://lists.gnu.org/archive/html/emacs-devel/2023-01/msg00425.html][Re: Consideration for Rust contributions in Emacs]]
|
** [[https://lists.gnu.org/archive/html/emacs-devel/2023-01/msg00425.html][Re: Consideration for Rust contributions in Emacs]]
|
||||||
from emacs-china, about multi-thread
|
from emacs-china, about multi-thread
|
||||||
|
** [[https://lore.kernel.org/all/20230314103316.313e5f61@kernel.org/][We don't feel comfortable accepting patches from or relating to hardware produced by your organization]]
|
||||||
|
|
||||||
* Other
|
* Other
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
Loading…
Reference in New Issue
Block a user