...menustart
- MacOSX
...menuend
OPTION/Alt+COMMAND+S
rm -rf ~/Library/Saved Application State/org.openoffice.script.savedState
xxd <filename>
以16进制显示文件内容xxd -i <filename>
转成c数组
unsigned char note_txt[] = {
0x0a, 0x0a, 0x0a, 0x35, 0x30, 0x30, 0x30, 0x20, 0x2b, 0x20, 0x37, 0x35,
0x30, 0x20, 0x70, 0x68, 0x6f, 0x74, 0x6f, 0x0a, 0x31, 0x32, 0x30, 0x20,
0x20, 0xe5, 0x96, 0x9c, 0xe7, 0xb3, 0x96, 0xe9, 0xa2, 0x84, 0xe4, 0xbb,
0x98, 0x0a, 0x35, 0x30, 0x30, 0x30, 0x20, 0xe5, 0xb0, 0x8f, 0xe5, 0x8d,
0x97, 0xe5, 0x9b, 0xbd, 0x20, 0xe5, 0xae, 0x9a, 0xe9, 0x87, 0x91, 0x0a,
0x0a
};
unsigned int note_txt_len = 61;
The hexadecimal set:
00 nul 01 soh 02 stx 03 etx 04 eot 05 enq 06 ack 07 bel
08 bs 09 ht 0a nl 0b vt 0c np 0d cr 0e so 0f si
...
cal
当月cal -y
当年-j
参数, day 显示为 当年的第几天
find . -name '.DS_Store' -path '*/.*' | xargs rm
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
ls *.json | xargs -I {} sh -c "cat {} | tr -d '\r' > {}2 && mv {}2 {} "
or
ls *.json | xargs -I {} sh -c " tr -d '\r' < {} > {}2 && mv {}2 {} "
{}
: handle every file , and to prevent path with spacesh -c
: directly use{}
in redirection>
not works, put them in a shell command- you can not do that by sed , remember sed delimits on
\n
newlines - they are always removed on input and reinserted on output. you may need-z
mode
find . -type f -name '*.cpp' -o -name '*.h' -o -name '*.as' | xargs -I {} grep -m 1 ReturnToMap "{}" /dev/null
*.ext1
-o*.ext2
/dev/null
is to show the file path-m 1
stop when 1st matching
use mdfind ...
mdfind -onlyin . "kMDItemDisplayName == *.as || kMDItemDisplayName == *.cpp || kMDItemDisplayName == *.h" | xargs -I {} grep -m 1 ReturnToMap "{}" /dev/null
最高效的方式
grep -r --include \*.h --include \*.cpp --include \*.as ReturnToMap .
-
-m 1
will not works as expect in-r
mode -
or more clean
grep -r --include=*.{h,cpp,as} ReturnToMap .
- add
-w
if you want matching the whole word
#!/bin/sh
echo “1”
sleep 5&
echo “3”
echo “4”
wait #会等待wait所在bash上的所有子进程的执行结束,本例中就是sleep 5这句
echo”5”
- sed语句中如果要引用变量, 使用 双括号
" "
, 不要使用 单括号' '
- 查找/替换中 匹配 white space
- 使用
[[:space:]]
, 而不是\s
- 没有
+
的用法
- 使用
launchctl limit
sudo launchctl limit maxfiles 100000 500000
sysctl kern.maxfiles
sysctl -w kern.maxfiles=20480 (or whatever number you choose)
# will lost , for centos : /etc/security/limits.conf
ulimit -a
ulimit -n 8192
# cpu performance
python -c 'import test.pystone;print test.pystone.pystones()'
# memory speed
dd if=/dev/zero of=/dev/null bs=1m count=32768
1台机器上 开启 iperf3 server
iperf3 -s
另一台机器上 发包测试
iperf3 -c 192.168.1.8 -R
docker run -d --name speedtest -p 0.0.0.0:81:80 adolfintel/speedtest:latest
webpage
http://10.192.89.89:81/
About crond : "“The cron utility is launched by launchd(8) when it sees the existence of /etc/crontab or files in /usr/lib/cron/tabs. There should be no need to start it manually.”"
There are three main directories you can use with launchd:
- /Library/LaunchDaemons
- job needs to run even when no users are logged in.
- /Library/LaunchAgents
- if the job is only useful when users are logged in.
- I learned that this has the side-effect of your job being run as 'root' after a system reboot.)
- $HOME/Library/LaunchAgents
- your job will be run under your username.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.alvin.crontabtest</string>
<key>ProgramArguments</key>
<array>
<string>/Users/al/bin/crontab-test.sh</string>
</array>
<key>Nice</key>
<integer>1</integer>
<key>StartInterval</key>
<integer>60</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/AlTest1.err</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
</dict>
</plist>
launchctl load <path>/com.alvin.crontabtest.plist
To turned it off
launchctl unload <path>/com.alvin.crontabtest.plist
If you placed your Mac plist file in one of the two system directories (/Library/LaunchDaemons, /Library/LaunchAgents), your job will be running as the root user after a system reboot. This means a couple of things:
- First, output files created by your script will be owned by the root user.
- Second, you'll need to use sudo before any of your launchctl commands, as shown here: