add random quote

This commit is contained in:
dongdigua 2022-10-29 13:26:19 +08:00
parent 87bb9dfe21
commit 36cd19bd3a
3 changed files with 22 additions and 8 deletions

View File

@ -25,19 +25,21 @@
<div class="home p-contact contact h-card vcard">
<pre>
(let ((name "dongdigua")
(blog "<a href=posts>posts/</a>")
(feed "<a href=feed.xml>feed.xml</a>")
(blog "<a href=https://dongdigua.github.io/posts>posts/</a>")
(feed "<a href=https://dongdigua.github.io/feed.xml>feed.xml</a>")
(github "<a href=https://github.com/dongdigua>@dongdigua</a>")
(payment "<a href=xmr.txt>monero</a>")
(pgp "<a href=pgpkey.txt>0x56CEE157C9F5334F</a>")
(payment "<a href=https://dongdigua.github.io/xmr.txt>monero</a>")
(pgp "<a href=https://dongdigua.github.io/pgpkey.txt>0x56CEE157C9F5334F</a>")
(interests
'("computer science"
"cyber security"
"GeoGebra"
"Minecraft redstone survival"
"anime"
(Lost (In (Superfluous (Parentheses))))))))
(Lost (In (Superfluous (Parentheses)))))))
(random-quote
"<span id="quote"></span>"))
</pre>
</div>
</body>
<script src="./js/random-quote.js"></script>

12
js/random-quote.js Normal file
View File

@ -0,0 +1,12 @@
var data = [
"富强民主闻名和谐, 自由平等公正法治, 爱国敬业诚信友善",
"解放思想, 实事求是, 与时俱进",
"You are not alone",
"The internet is FULL, go away!",
"May the --force be with you",
"Software that sucks less",
];
var index = Math.floor((Math.random() * data.length));
window.document.getElementById("quote").innerHTML = data[index];

View File

@ -17,7 +17,7 @@
- rsa 非对称加密
- UDP 打洞<br>
整个思路来源都是从这两个视频来的:<br>
[使用 Netcat 的原理讲解](https://www.youtube.com/watch?v=s_-UCmuiYW8) &
[使用 Netcat 的原理讲解](https://www.youtube.com/watch?v=s_-UCmuiYW8) &
[使用 Python 实现 p2p 通信](https://www.youtube.com/watch?v=IbzGL_tjmv4)<br>
我的理解就是通过发送 UDP 包打开一个端口,<br>
然后将两个需要发消息的客户端相互告诉对方各自的公网 IP 以及映射到的端口,就能实现 p2p 通信。<br>
@ -279,7 +279,7 @@ defmodule Server do
case find_peer(user_data) do
nil -> add_peer(user_data)
{{peer0, msg0}, {peer1, msg1}} ->
{ {peer0, msg0}, {peer1, msg1} } ->
:gen_udp.send(socket, peer0, msg0)
:gen_udp.send(socket, peer1, msg1)
end