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