Skip to content

Instantly share code, notes, and snippets.

View liujingyu's full-sized avatar

jingyu liu liujingyu

View GitHub Profile
@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 / intro
Last active February 20, 2023 12:50
mysql explain解读
id selecttype table type possible_keys key key_len ref rows extra各列。
其中:
type=const表示通过索引一次就找到了;
key=primary的话,表示使用了主键;
type=all,表示为全表扫描;
key=null表示没用到索引。
type=ref,因为这时认为是多个匹配行,在联合查询中,一般为REF。
前者可以得出一个表的字段结构等等,后者主要是给出相关的一些索引信息,而今天要讲述的重点是后者。
举例
@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]): 检索给定的键名是否存在数组中
数组的内部指针
class Thrift < Formula
desc "Framework for scalable cross-language services development"
homepage "https://thrift.apache.org/"
url "https://www.apache.org/dyn/closer.cgi?path=/thrift/0.10.0/thrift-0.10.0.tar.gz"
sha256 "2289d02de6e8db04cbbabb921aeb62bfe3098c4c83f36eec6c31194301efa10b"
bottle do
cellar :any
sha256 "20b9fd54b8aaf036d5c9c85f53ab084819f1b6bbb392bd266e4f7c7e2dbbc48b" => :high_sierra
sha256 "a0d93b6f61524775ec194daa25a3a8da16f5e858823822847074711c718f1618" => :sierra
@liujingyu
liujingyu / gist:df2a9f957220557dc066e9e85c67f73f
Created October 29, 2018 07:21 — forked from siddharthg/gist:6923b2cbb402bd65255af7859a5d52a5
Install Thrift 0.10.0 with brew on macOS
brew unlink thrift
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/16ebe5f1843e6cb54856311ff0f676be53007329/Formula/thrift.rb
@liujingyu
liujingyu / v1.2.0.patch
Last active February 11, 2018 03:01
walle-web v1.2.0 a patch support docker deploy,use dir map way.
diff --git a/components/Folder.php b/components/Folder.php
index 2a84f32..1e757c4 100644
--- a/components/Folder.php
+++ b/components/Folder.php
@@ -267,9 +267,13 @@ class Folder extends Ansible {
$currentTmp = sprintf('%s/%s/current-%s.tmp', rtrim($this->getConfig()->release_library, '/'), $project, $project);
// 遇到回滚,则使用回滚的版本version
$linkFrom = Project::getReleaseVersionDir($version);
- $cmd[] = sprintf('ln -sfn %s %s', $linkFrom, $currentTmp);
- $cmd[] = sprintf('chown -h %s %s', $user, $currentTmp);
worker_processes 1; # we could enlarge this setting on a multi-core machine
error_log logs/error.log warn;
events {
worker_connections 2048;
}
http {
lua_package_path 'conf/?.lua;;';
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
@liujingyu
liujingyu / vimawesome.vim
Created September 3, 2017 03:44 — forked from junegunn/vimawesome.vim
Plugin completion using VimAwesome API
" ----------------------------------------------------------------------------
" vimawesome.com
" ----------------------------------------------------------------------------
function! VimAwesomeComplete() abort
let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$')
echohl WarningMsg
echo 'Downloading plugin list from VimAwesome'
echohl None
ruby << EOF
require 'json'
@liujingyu
liujingyu / emit.vue
Last active August 23, 2017 13:59
vue 小组件集合
this.$emit('change', { perpage: this.perpage, page: page })