Clang-Format code
Download clang-format from http://llvm.org. Examples: clang-format -style=LLVM -i test.c clang-format -style=Google -dump-config > google.clang-format ...
使用AStyle格式化代码
从 astyle.sourceforge.net 下载安装 astyle。 AStyle.exe -A8 -s4 -k3 -W3 -S -p -xn -xc -xk -xV -xf -xh -H -Y -w -xW -n -c -z2 /path/to/code.c -A8 Linux style -s4 4个空格缩进 -k3 指针*靠近变量 -W3 引用&靠近变量 -S switch下的case添加缩进 -p 在操作符两边添加空格 -xn 花括号在namespace之后 -xc 花括号在class之后 -xk 花括号在extern “C"之后 -xV do-while语句中,while在关闭花括号之后 -xf 函数定义中,返回类型和函数名在同一行 -xh 函数声明中,返回类型和函数名在同一行 -H 在if,for,while…之后添加空格 -Y 缩进注释 -w 宏定义换行后缩进 -xW 嵌套预处理缩进 -n 不生成备份文件 -c tab转换为空格 -z2 linux(LF)换行 ...
Emacs 根据时间切换主题
根据时间,自动切换亮色和暗色主题。 (setq day-theme 'light-blue) (setq dark-theme 'misterioso) (defun synchronize-theme () (setq hour (string-to-number (substring (current-time-string) 11 13))) (if (member hour (number-sequence 6 18)) (setq now day-theme) (setq now dark-theme)) (load-theme now) ) (run-with-timer 0 3600 'synchronize-theme) 自动切换主题的包:circadian.el
Ubuntu安装Samba
apt-get install samba 修改 /etc/samba/smb.conf 文件: [share] path = / available = yes valid users = root read only = no browseable = yes public = yes writable = yes 修改Samba登陆的密码: smbpasswd -a root 这里也可以使用非root用户,必须是Linux系统中已存在的用户。 重启Samba服务: /etc/init.d/smbd restart
Shell - Here Documents
Here Documents 是 Shell 中的一种特殊的重定向方式,用来将输入重定向到一个交互式 Shell 脚本或程序。 它的基本的形式如下: command << delimiter document delimiter 它的作用是将两个 delimiter 之间的内容(document) 作为输入传递给 command。 注意: 结尾的delimiter 一定要顶格写,前面不能有任何字符,后面也不能有任何字符,包括空格和 tab 缩进。 开始的delimiter前后的空格会被忽略掉。 ...