paste
差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录前一修订版后一修订版 | 前一修订版 | ||
| paste [2023/10/10 08:11] – 175.172.30.251 | paste [2026/01/16 17:22] (当前版本) – root | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== Copy and Paste ====== | ====== Copy and Paste ====== | ||
| - | |||
| - | * shebang | ||
| - | * linux path(bash path) | ||
| - | * bash脚本入门 | ||
| - | * chmod bash | ||
| - | * linux环境变量 | ||
| This page is used for copy and paste sharing. | This page is used for copy and paste sharing. | ||
| - | < | + | < |
| - | #define MAXOP 20 | + | slmgr /skms s1.kms.cx |
| - | #define NUMBER ' | + | slmgr /ipk FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4 |
| - | #define TOOBIG ' | + | slmgr /ato |
| - | #define EOF 0 | + | slmgr /xpr |
| + | pause | ||
| + | </ | ||
| - | main() | + | ===== Guacamole部署 ===== |
| - | { | + | |
| - | int type; | + | |
| - | char s[MAXOP]; | + | |
| - | double op2, atof(), pop(), push(); | + | |
| - | + | ||
| - | while ((type | + | |
| - | switch (type){ | + | |
| - | case NUMBER: | + | |
| - | push(atof(s)); | + | |
| - | break; | + | |
| - | case ' | + | |
| - | push(pop() + pop()); | + | |
| - | break; | + | |
| - | case ' | + | |
| - | push(pop() * pop()); | + | |
| - | break; | + | |
| - | case ' | + | |
| - | op2 = pop(); | + | |
| - | if (op2 != 0.0) | + | |
| - | push(pop() - op2); | + | |
| - | break; | + | |
| - | case '/': | + | |
| - | op2 = pop(); | + | |
| - | if (op2 != 0.0) | + | |
| - | push(pop() / op2); | + | |
| - | else | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case '=': | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | case ' | + | |
| - | clear(); | + | |
| - | case TOOBIG: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | default: | + | |
| - | printf(" | + | |
| - | break; | + | |
| - | } | + | |
| - | } | + | |
| - | #define MAXVAL 100 | + | 转到guacamole |
| - | int sp = 0; | + | <code bash> |
| - | double val[MAXVAL]; | + | # |
| + | docker run -p 6080:80 -p 5900:5900 -e VNC_PASSWORD=111222333 -v / | ||
| + | docker run -p 8080:8080 --rm flcontainers/ | ||
| + | </ | ||
| - | double push(f) | ||
| - | double f; | ||
| - | { | ||
| - | if(sp < MAXVAL) | ||
| - | return(val[sp++] = f); | ||
| - | else { | ||
| - | printf(" | ||
| - | clear(); | ||
| - | return(0); | ||
| - | } | ||
| - | } | ||
| - | double pop() | + | guacamole部署 |
| + | <code bash> | ||
| + | docker run --name mysql --rm -e MYSQL_ROOT_PASSWORD=123456 \ | ||
| + | -p 3306:3306 -v $HOME/ | ||
| + | #-e MYSQL_ALLOW_EMPTY_PASSWORD=yes | ||
| + | docker run --rm guacamole/ | ||
| + | |||
| + | mysql -h localhost -u root --protocol tcp | ||
| + | > CREATE DATABASE guacamole_db; | ||
| + | > quit | ||
| + | |||
| + | cat initdb.sql | mysql -h localhost -u root --protocol tcp guacamole_db | ||
| + | |||
| + | docker run --rm --name guacamole | ||
| + | -e GUACD_HOSTNAME=192.168.3.125 \ | ||
| + | -e GUACD_PORT=4822 | ||
| + | -e MYSQL_HOSTNAME=192.168.3.125 \ | ||
| + | -e MYSQL_DATABASE=guacamole_db | ||
| + | -e MYSQL_USER=root | ||
| + | -e MYSQL_PASSWORD=123456 | ||
| + | -p 8080:8080 guacamole/ | ||
| + | </ | ||
| + | |||
| + | Guacamole debug | ||
| + | |||
| + | <code bash> | ||
| + | ./ | ||
| + | </ | ||
| + | ===== IPv6 Multicast ===== | ||
| + | |||
| + | 组播与单播的区别(从应用层角度看): | ||
| + | * 发送方发送的目的地址不是接收方的IP地址,而是**从**某link,**向**link上某组播地址的一个组,发送数据。 | ||
| + | * 接收方Bind的不是**接口的地址**+端口概念,而是Bind**接口**+端口,并从这个接口加入某组播地址的group。接收方在接收组播消息的接口上的本地地址,在应用层看来是无关紧要的。 | ||
| + | |||
| + | 综上,组播调用时有以下不同: | ||
| + | * 发送socket,发送前需要额外指定**发送组播消息的端口**,之后将组播地址与端口正常填入sockaddr_in6 | ||
| + | * 接收socket,接收前常规bind,但只有加入ipv6_mreq指定的组后才会收到该组播地址的消息。ipv6_mreq中指定了一个组播地址与其所在的interface。 | ||
| + | |||
| + | 但,自己发送组播消息,自己接收时需要额外两步支持Loop: | ||
| + | * IPV6_MULTICAST_HOPS, | ||
| + | * IPV6_MULTICAST_LOOP, | ||
| + | |||
| + | Tips,使用''' | ||
| + | |||
| + | 样例代码 | ||
| + | <code cpp> | ||
| + | //send | ||
| + | m_udpSocketSend.UseIpv6Mode(1); | ||
| + | m_udpSocketSend.Create(); | ||
| + | m_udpSocketSend.SetBlocking(0); | ||
| + | |||
| + | // | ||
| + | m_udpSocketSend.SetDestIpAndPort(m_Settings.GetSendRemoteMaddrV6Str(), | ||
| + | |||
| + | // | ||
| + | int ifindex = m_Settings.GetIfIndex(); | ||
| + | if (setsockopt(m_udpSocketSend.m_sock_fd, | ||
| + | & | ||
| { | { | ||
| - | | + | return |
| - | | + | |
| - | else{ | + | |
| - | printf(" | + | |
| - | clear(); | + | |
| - | return(0); | + | |
| - | } | + | |
| } | } | ||
| - | clear() | + | #if SVW_MULTICAST_SUPPORT_LOOP |
| + | int hops = 255; | ||
| + | if(setsockopt(m_udpSocketSend.m_sock_fd, | ||
| { | { | ||
| - | | + | |
| + | perror(" | ||
| } | } | ||
| - | + | if(setsockopt(m_udpSocketSend.m_sock_fd, IPPROTO_IPV6, | |
| - | char mygetchar(); | + | |
| - | getop(s, lim) | + | |
| - | char s[]; | + | |
| - | int lim; | + | |
| { | { | ||
| - | | + | |
| - | + | | |
| - | while ((c = getch()) == ' ' || c == ' | + | |
| - | ; | + | |
| - | if(c != '.' && (c < ' | + | |
| - | return(c); | + | |
| - | | + | |
| - | for (i = 1; getCharAndInRange(& | + | |
| - | if(i < lim) | + | |
| - | s[i] = c; | + | |
| - | if (c == ' | + | |
| - | if (i < lim) | + | |
| - | s[i] = c; | + | |
| - | for(i++; (c = getchar()) >= ' | + | |
| - | if (i < lim) | + | |
| - | s[i] = c; | + | |
| - | } | + | |
| - | if (i < lim) { | + | |
| - | ungetch(c); | + | |
| - | s[i] = ' | + | |
| - | return(NUMBER); | + | |
| - | } else { | + | |
| - | while (c != ' | + | |
| - | c = getchar(); | + | |
| - | s[lim -1] = ' | + | |
| - | return(TOOBIG); | + | |
| - | } | + | |
| } | } | ||
| + | #endif | ||
| - | #define BUFSIZE 100 | + | //发送!! |
| - | + | m_udpSocketSend.SendMsg(& | |
| - | char buf[BUFSIZE]; | + | </ |
| - | int bufp = 0; | + | |
| - | getch() | + | <code cpp> |
| + | //receive | ||
| + | m_udpSocketReceive.UseIpv6Mode(1); | ||
| + | m_udpSocketReceive.Create(); | ||
| + | m_udpSocketReceive.SetBlocking(0); | ||
| + | if(!m_udpSocketReceive.Bind(m_Settings.GetReceivePortV6())) | ||
| { | { | ||
| - | return((bufp> | + | return |
| } | } | ||
| - | ungetch(c) | + | //join multicast group |
| - | int c; | + | struct ipv6_mreq mGroupAddr; |
| + | crt_memset(& | ||
| + | if(!crt_inet_addr_v6(m_Settings.GetReceiveMaddrV6Str(),& | ||
| { | { | ||
| - | | + | |
| - | printf("ungetch: too many characters\n" | + | |
| - | | + | |
| - | buf[bufp++] = c; | + | |
| } | } | ||
| - | + | if(m_Settings.GetIfIndex() != 0) | |
| - | char mygetchar() | + | |
| { | { | ||
| - | | + | |
| } | } | ||
| - | + | if (setsockopt(m_udpSocketReceive.m_sock_fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, | |
| - | getCharAndInRange(pchar, getCharFunc, start, end) | + | & |
| - | char *pchar; | + | { |
| - | int (*getCharFunc)(), start, end; { | + | |
| - | | + | |
| } | } | ||
| </ | </ | ||
| + | ===== rsync ===== | ||
| + | <code bash> | ||
| + | # | ||
| + | rsync -avIPhz | ||
| + | --exclude=' | ||
| + | --backup-dir=update-backups/ | ||
| + | ~/ | ||
| + | cat > | ||
| + | 同步文件夹时,不要省略文件夹的斜杠!虽然远端的代表文件夹的斜杠可以省略。 | ||
| + | --backup-dir参数让任何被删除或覆盖的文件都移入指定文件夹,这个目录是远端同步目录的相对路径 | ||
| + | 在本例中是: | ||
| + | 如果没有删除或覆盖的文件,则不创建该目录 | ||
| + | --exclude保证本机指定目录不会同步到远端。这个目录是本机同步目录的相对路径 | ||
| + | 在本例中是: | ||
| + | 注意,不要添加--delete!就不会删除远端任何文件,覆盖的除外。 | ||
| - | + | -a: 类似cp中的-a, | |
| - | + | | |
| + | | ||
| + | 如果,目标rsync非root, | ||
| + | 在不指定-p保持权限时,覆盖文件会保持远端文件原权限不变,新建文件会遵从本机源文件 | ||
| + | -v: verbose | ||
| + | -I: --ignore-times | ||
| + | 忽略时间与大小,一定进行哈希对比 | ||
| + | -P: same as --partial --progress | ||
| + | 断点续传大文件 | ||
| + | -h: --human-readable | ||
| + | -z: --compress | ||
| + | 先压缩再传输 | ||
| + | EOF | ||
| + | </ | ||
| ==== Ignore me ==== | ==== Ignore me ==== | ||
| - | https:// | + | * https:// |
| - | https:// | + | |
| + | * www.lixianla.com | ||
| + | * https:// | ||
| + | * [[http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * 调试九法 | ||
| - | filebase.cpp | ||
| - | mem.cpp | ||
| - | memfile.cpp | ||
| - | file.cpp | ||
| - | minibson.cpp | ||
| - | closure.cpp | ||
| - | taskmgr.cpp | ||
| - | taskrunner.cpp | ||
| - | weak_pointer.cpp 弱指针 | ||
paste.1696925502.txt.gz · 最后更改: 由 175.172.30.251
