Skip to content

Instantly share code, notes, and snippets.

View liujingyu's full-sized avatar

jingyu liu liujingyu

View GitHub Profile
@liujingyu
liujingyu / Tools
Last active August 29, 2015 14:20
Tools 使用总结
[编辑器: vim]
插件
ShowTrailingWhitespace, ack.vim, calendar.vim, ctrlp.vim, delimitMate,
indentLine, nerdcommenter, nerdtree, rsynccreatefile, snipmate.vim,
syntastic, tabular, tagbar, thrift, vim-easymotion, vim-fugitive,
vim-matchit, vim-multiple-cursors, vim-pathogen, vim-php-cs-fixer,
vim-airline, vim-surround, vimwiki,xptemplate,YouCompleteMe,
ctrlsf, webapi-vim, html5, gist-vim, gitgutter, gundo,
[版本管理器]
@liujingyu
liujingyu / setting
Created May 5, 2015 08:41
php opcache 官方推荐配置
[opcache]
zend_extension=opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli= On
opcache.enable= On
@liujingyu
liujingyu / sql
Created May 5, 2015 11:48
mysql 位操作(权限使用)
位操作即开始学习计算机就接触的
按位与(&): 1&1=1 1&0=0 0&0=0
按位或(|):1|1=1 1|0=1 0|0=0
按位异或(^):1^1=0 0^0=0 1^0=1
这几个运算都支持交换律
MySQL中也支持这几个位运算,今儿遇到记录用户登录日期一功能需求,设计数据库用一位记录一天,第一位记录1号,第二位记录2号登录,这样可节省数据库存储开支。于是用户在一天内登录多次如何存储,于是想起按位或运算可解决此法,第一次登录更新后,按位或时此位不再更新,好用。
记录用户8号有登录。
insert into USER_LOGIN_12 set sinaid=1686497165,LOGIN=64,MON=2 on duplicate key update login=login|128 ;
@liujingyu
liujingyu / wiki
Created May 6, 2015 02:01
wiki 搭建过程
Apache
yum -y install httpd #根据提示,输入Y安装即可成功安装
service httpd start #启动Apache
备注:Apache启动之后会提示错误:
正在启动 httpd:httpd: Could not reliably determine the server's fully qualif domain name, using ::1 for ServerName
解决办法:
vi /etc/httpd/conf/httpd.conf #编辑
找到 #ServerName www.example.com:80
修改为 ServerName www.osyunwei.com:80 #这里设置为你自己的域名,如果没有域名,可以设置为localhost
@liujingyu
liujingyu / bubbleSort.class.php
Last active August 29, 2015 14:20
php 排序算法(直接插入排序, 希尔排序, 冒泡排序及改进版1-2, 快速排序, 归并排序, 选择排序, 堆排序)
<?php
/**
* 排序名称:冒泡排序.
*
* 说明:冒泡排序的原理非常简单,它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来.
*
* 步骤:
* 1 比较相邻的元素。如果第一个比第二个大,就交换他们两个。
* 2 对第0个到第n-1个数据做同样的工作。这时,最大的数就“浮”到了数组最后的位置上。
@liujingyu
liujingyu / abc
Created May 9, 2015 02:38
各种语言执行自身代码段或方法的方式
[python]
exec, eval, repr
[php]
eval, call_user_func
@liujingyu
liujingyu / abc
Created May 9, 2015 03:44
mongodb 从现有的片式集群中删除分片
Ensure the Balancer Process is Active
To successfully migrate data from a shard, the balancer process must be active. Check the balancer state using the sh.getBalancerState() helper in the mongo shell. For more information, see the section on balancer operations.
Determine the Name of the Shard to Remove
To determine the name of the shard, do one of the following:
From the admin database, run the listShards command.
Run either the sh.status() method or the sh.printShardingStatus() method.
The shards._id field lists the name of each shard.
@liujingyu
liujingyu / abc.sh
Created May 13, 2015 02:20
TCP连接状态详解及TIME_WAIT过多的解决方法
查看当前系统下所有连接状态的数:
[root@vps ~]#netstat -n|awk '/^tcp/{++S[$NF]}END{for (key in S) print key,S[key]}'
TIME_WAIT 286
FIN_WAIT1 5
FIN_WAIT2 6
ESTABLISHED 269
SYN_RECV 5
CLOSING 1
@liujingyu
liujingyu / array.class.php
Last active August 17, 2020 02:04
php 数组操作集合
一、数组操作的基本函数
数组的键名和值
array_values($arr); 获得数组的值
array_keys($arr); 获得数组的键名
array_flip($arr); 数组中的值与键名互换(如果有重复前面的会被后面的覆盖)
in_array("apple",$arr); 在数组中检索apple
array_search("apple",$arr); 在数组中检索apple ,如果存在返回键名
array_key_exists("apple",$arr); 检索给定的键名是否存在数组中
isset($arr[apple]): 检索给定的键名是否存在数组中
数组的内部指针
@liujingyu
liujingyu / install.sh
Created May 20, 2015 12:27
centos6.5 apache2.4.9+php5.5.25安装
[apache]
wget http://geekpeek.net/download/httpd-2.4.9-RPM-full.x86_64.tgz
tar -xvzf httpd-2.4.9-RPM-full.x86_64.tgz
cd httpd-2.4.9-RPM-full.x86_64
yum -y localinstall * --skip-broken
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>