Skip to content

Instantly share code, notes, and snippets.

@wushifu32
wushifu32 / e.md
Last active April 14, 2020 14:36

:smill: 👍 🐶 :Doge:

:smill:

@wushifu32
wushifu32 / make_tags.sh
Created March 19, 2020 10:25
generate tags
#!/bin/sh
cat tag.files | xargs -i find $PWD/{} -name "*.[chS]" > cscope.files
ctags `cat cscope.files`
cscope -bkq
const int ci = i, &cr = ci;
auto b = ci; // b is an int
auto c = cr; // c is an int
auto d = &i; // d is an int*
auto e = &ci; // e is an const int*
const auto f = ci; // f is an const int
auto sz = 0, pi = 3.14; // ERROR: inconsistent types for sz and pi
typedef char *pstring;
// 此处表示指针为 constant
const pstring cstr = 0;
/************对比#define******/
#define pstring char*
// 展开后即为 const char* cstr;意为一个指向 const char 的指针
const pstring cstr;

这样,重启系统后,用户“user_name”就会加入dialout组了,之后我们就能自由自在地访问ttyS设备了

sudo usermod -a -G dialout user_name
@wushifu32
wushifu32 / format.md
Last active January 23, 2018 06:57
%*s format in c

For printf, the * allows you to specify minimum field width through an extra parameter
i.e. printf("%*d", 4, 100); specifies a field width of 4.

For scanf, the * indicates that the field is to be read but ignored
i.e. scanf("%*d %d", &i); for the input "12 34" will ignore 12 and read 34 into the integer i.

@wushifu32
wushifu32 / jetson-tx2.sh
Created January 23, 2018 02:49
jetson TX2 常用命令
# 拷贝 flash
sudo ./flash.sh -r -k APP -G xxx.img jetson-tx2 mmcblk0p1
# 烧写 flash
cp xxx.img Linux_for_Tegra_tx2/bootloader/system.img
sudo ./flash.sh -r jetson-tx2 mmcblk0p1
@wushifu32
wushifu32 / shell_script.sh
Last active May 31, 2018 10:21
shell script
#!/bin/bash
# for 循环
for i in {1..100}
do
echo $i
done
# IF 条件判断
if [ $a == $b ]
@wushifu32
wushifu32 / ssh 反向连接.md
Last active December 27, 2017 14:22
ssh 反向连接

通过云服务器A(123.123.123.123)连接设备B

  1. 将B的公钥传送到A上:
ssh-copy-id user@123.123.123.123
ssh user@host 'mkdir -p .ssh && cat >> .ssh/authorized_keys' < ~/.ssh/id_rsa.pub

此时通过SSH链接A就不需要输入密码了,如果不行,检查A的/etc/ssh/sshd_config这个文件,检查下面几行前面"#"注释是否取掉: