04 2020 档案

摘要:1、示例:对不同的操作系统调用不同的代码。 use libc; #[cfg(target_os="linux")] fn my_print(){ unsafe{ libc::printf("hello".as_ptr() as *const libc::c_char); } } #[cfg(targ 阅读全文
posted @ 2020-04-24 15:06 gelare 阅读(3258) 评论(0) 推荐(2)
摘要:0、nmcli device wifi 1、nmcli device wifi connect ssid password wifi_passwd ( nmcli connection add type wifi con-name wifi_name ifname interface ssid ss 阅读全文
posted @ 2020-04-17 10:04 gelare 阅读(3106) 评论(0) 推荐(0)
摘要:特化需要在命名空间里做,不能在类中直接特化一个类模板,但可以放到类外来做。也可在类之内用偏特化,然后传入一个dummy template argument。 来源:https://stackoverflow.com/questions/3052579/explicit-specialization- 阅读全文
posted @ 2020-04-16 18:48 gelare 阅读(2082) 评论(0) 推荐(0)
摘要:cargo-edit这个工具扩展了 Cargo,允许通过从文件中修改 Cargo.toml 文件来添加。删除和升级依赖项。 安装: $cargo install cargo-edit (安装时报link失败,原因是用的是MSVC版本的rust ,虽然VS的link.exe所在路径在前,但是总是用mi 阅读全文
posted @ 2020-04-16 10:59 gelare 阅读(1150) 评论(0) 推荐(0)
摘要:1、vscode安装插件 C/C++ (ms-vscode.cpptools),安装后运行Run->Start Debugging会出现C++(GDB/LLDB)与C++(Windows) 2、根据rust用的版本,如果用的是x86_64-pc-windows-msvc,调试时选择C++(Windo 阅读全文
posted @ 2020-04-15 13:00 gelare 阅读(6584) 评论(0) 推荐(1)
摘要:1、关连类型与范型trait 泛型trait 有参数时,可以每次用不同的参数类型,多次实现这个 trait。而关联类型的trait,不能多次实现。 阅读全文
posted @ 2020-04-14 16:04 gelare 阅读(298) 评论(0) 推荐(0)
摘要:use std::net::TcpStream; use ssh2::Session; use std::io::prelude::*; use std::path::Path; fn main() { let tcp = TcpStream::connect("121.37.18.151:22") 阅读全文
posted @ 2020-04-14 10:31 gelare 阅读(2318) 评论(0) 推荐(0)
摘要:当多个动态库中包含相同名字的全局对象时,会在exit的钩子多次注册,当程序退出时对象会析构多次,造成崩溃。 简单的例子: aaa.cpp : #include <string> std::string msg("fdsafasfsa"); ccc.cpp: int main(int argc,cha 阅读全文
posted @ 2020-04-08 11:13 gelare 阅读(307) 评论(0) 推荐(0)
摘要:​ R1与R2间EBGP,R4与R5间EBGP,R2与R4间IBGP,但由于R3学不到相关的路由,造成路由黑洞。处理的方法主要以下几个: 以下是路由器配置: R1: interface Loopback0 ip address 1.1.1.1 255.255.255.255!interface Fa 阅读全文
posted @ 2020-04-07 11:42 gelare 阅读(1567) 评论(0) 推荐(0)
摘要:from socket import * from ssh2.session import Session from ssh2.sftp import LIBSSH2_FXF_READ, LIBSSH2_SFTP_S_IRUSR sock = socket(AF_INET,SOCK_STREAM,0 阅读全文
posted @ 2020-04-07 11:08 gelare 阅读(1583) 评论(0) 推荐(0)
摘要:一、找到一个内存占用块:$pmap 26915 | sort -k 3 -n -r 二、找到起止地址: $cat /proc/26915/smaps | grep 7f33e2656000 三、dump内存: $gdb -pid 26915 dump memory memory.dump 0x7f3 阅读全文
posted @ 2020-04-07 10:59 gelare 阅读(618) 评论(0) 推荐(0)
摘要:1、C++ template<class T,class E> class Result{ public: T t; E e; void fun(); }; template<class T> using FmtResult=Result<T,int>; int main(int argc,char 阅读全文
posted @ 2020-04-07 10:22 gelare 阅读(373) 评论(0) 推荐(0)
摘要:1、创建新绑定 fn main(){ let (a,b)=(1,1); let (a,b)=(b,a+b); } (使用限制,每次都是新绑定) 2、修改绑定内容-临时变量 fn main(){ let (mut a,mut b)=(1,1); let tmp=a+b; a=b; b=tmp; } 3 阅读全文
posted @ 2020-04-07 10:18 gelare 阅读(1641) 评论(0) 推荐(0)
摘要:一、L3 VPN配置 ​ 1、配置: CE1: interface Loopback0 ip address 1.1.1.1 255.255.255.255!interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.252!router 阅读全文
posted @ 2020-04-07 10:08 gelare 阅读(5) 评论(0) 推荐(0)
摘要:1、SSH隧道 ssh -L localport:remoteip:remoteport username@ip 将本地端口localport收到的报文,通过中间节点ip,转发给远端节点remoteip的端口remoteport. ssh -R remoteport:localip:localpor 阅读全文
posted @ 2020-04-07 10:02 gelare 阅读(1206) 评论(0) 推荐(0)
摘要:systemd-logind 服务引入了一个新特性,该新特性是:当一个user 完全退出os之后,remove掉所有的IPC objects。该特性由/etc/systemd/logind.conf参数文件中RemoveIPC选项来控制。可以增加RemoveIPC=no避免删除。 阅读全文
posted @ 2020-04-07 09:58 gelare 阅读(1820) 评论(0) 推荐(0)
摘要:1、视图-其它窗口-属性管理器 2、添加属性表,如名字为SFUChat.props, 增加后,会出现SFUChat在项目中。 3、双击,找到用户宏,添加: 阅读全文
posted @ 2020-04-07 09:49 gelare 阅读(802) 评论(0) 推荐(0)
摘要:1、axel多线程下载,代替curl,wget(todo ..) 阅读全文
posted @ 2020-04-07 09:46 gelare 阅读(168) 评论(0) 推荐(0)
摘要:一、sed的Pattern Space与Hold Space Pattern Space相当于车间,sed把流内容在这里进行处理,Hold Space相当于仓库,加工的半成品在这里进行临时存储。g: 将hold space中的内容拷贝到pattern space中,原来pattern space里的 阅读全文
posted @ 2020-04-07 09:44 gelare 阅读(413) 评论(0) 推荐(0)
摘要:1、输出eth0的IP地址ip -4 addr show "eth0" | grep -oP '(?<=inet\s)\d+(\.\d+){3}' 2、说明-o 显示被模式匹配到的字符串。-P 支持正则表达式 (https://deerchao.cn/tutorials/regex/regex.ht 阅读全文
posted @ 2020-04-07 09:19 gelare 阅读(11940) 评论(1) 推荐(3)
摘要:rsync -P -e ssh user@ip:~/myfile.tbz2 ./ 阅读全文
posted @ 2020-04-07 09:17 gelare