Skip to content

Instantly share code, notes, and snippets.

@temberature
Last active August 29, 2015 14:15
Show Gist options
  • Save temberature/af69f5602277e6fcabf1 to your computer and use it in GitHub Desktop.
Save temberature/af69f5602277e6fcabf1 to your computer and use it in GitHub Desktop.
ifconfig | grep "inet " | grep -v 127.0.0.1
awk '$10 == 200 {print $8}' weixin_access_log.20150206 | grep 'cf2015/cf.*\.php$' | sort | uniq -c
awk -F '[,]' //指定分隔符
54.65.110.84
/bin - Common binaries
/sbin - Binaries used for system administration.
/boot - Static files of the boot loader. Usually it contain the Linux kernel, Grub boot loader files and so on.
/dev - Device
/home - User HOME directories are found here. In unices like FreeBSD, the HOME directories are found in /usr/home. And in Solaris it is in /export. So quite a big difference here.
/lib - Essential shared libraries and kernel modules.
/mnt - Temporary mount point useful for when you insert your USB stick and it gets mounted under /mnt. Though in Ubuntu and the likes, it is usually mounted under /media.
/var - Variable data, such as logs, news, mail spool files and so on which is constantly being modified by various programs running on your system.
/tmp - Temporary files are placed here by default.
/usr - The secondary hierarchy which contain its own bin and sbin sub-directories.
/etc - Usually contain the configuration files for all the programs that run on your Linux/Unix system.
/opt - Third party application packages.
/srv - Contains data for services provided by the system.
And of course there is the /proc directory which does not actually reside on the disk.
ubuntu install curl
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
斑羚在线 张仝openid=ooP3yjpH1JL7wjXG1z2KSjQCd-KQ
两个文件的交集
grep -F -f a.txt b.txt
在b中,不在a中
grep -F -v -f a.txt b.txt
curl -sS https://getcomposer.org/installer | php
查看磁盘类型
df -T -h
修改/etc/ssh/sshd_config
找到 PasswordAuthentication no,把no改成yes
ssh -i aws-ec2.pem ubuntu@54.65.110.84 'mkdir -p .ssh && cat >> .ssh/authorized_keys' < ~/.ssh/id_rsa.pub
usermod -a -G apache cnzhx
http://www.redbeanphp.com/downloads/RedBeanPHP4_1_4.tar.gz
alter table table_name AUTO_INCREMENT=n
cat ytvpn.txt | awk 'NR > 1 {print $2}'| while read x ; do echo `ping -c 3 $x | awk -F '[ /]' 'NR==1 {ip=$2} $1=="round-trip" {print ip,$8}'` & done | sort -n -k2
{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": { "single_line": false }
curl -H "Content-Type: application/json" -X POST -d '{"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "20150414sd"}}}' https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
$content = simplexml_load_string('<content><![CDATA[Hello, world!]]></content>', null, LIBXML_NOCDATA);
表1.常用的元字符
代码 说明
. 匹配除换行符以外的任意字符
\w 匹配字母或数字或下划线或汉字
\s 匹配任意的空白符
\d 匹配数字
\b 匹配单词的开始或结束
^ 匹配字符串的开始
$ 匹配字符串的结束
表2.常用的限定符
代码/语法 说明
* 重复零次或更多次
+ 重复一次或更多次
? 重复零次或一次
{n} 重复n次
{n,} 重复n次或更多次
{n,m} 重复n到m次
表3.常用的反义代码
代码/语法 说明
\W 匹配任意不是字母,数字,下划线,汉字的字符
\S 匹配任意不是空白符的字符
\D 匹配任意非数字的字符
\B 匹配不是单词开头或结束的位置
[^x] 匹配除了x以外的任意字符
[^aeiou] 匹配除了aeiou这几个字母以外的任意字符
PHPExcel
$inputFileName = './accounts.xls';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
echo '<hr />';
$objPHPExcel->setActiveSheetIndex(1);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A'.$row, $account_name)
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$objPHPExcel_output->createSheet(1);
去除重复行不排序 remove duplicated lines without sort
cat filename | awk '!x[$1]++{print $1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment