Skip to content

Instantly share code, notes, and snippets.

View zhouyl's full-sized avatar

ZhouYL zhouyl

  • China.ShengZheng
View GitHub Profile
@zhouyl
zhouyl / mysql-auth.cnf
Created June 29, 2024 06:37
mysql dump & recovery shell script
[client]
host=localhost
port=3306
user=root
password=root
@zhouyl
zhouyl / ssh-dump-mysql-to-local.sh
Created May 25, 2024 10:29
ssh-dump-mysql-to-local.sh
# 使用 ssh 下载远程服务器上的 mysql 数据库
SSH_HOST=remote_ssh_host
SSH_USER=root
SSH_BIN="ssh $SSH_USER@$SSH_HOST"
REMOTE_DATABASE=remote_db_name
REMOTE_HOST=remote_host_ip
REMOTE_PORT=3306
REMOTE_USER=root
@zhouyl
zhouyl / redis-cluster
Last active April 2, 2021 03:38
REDIS-CLUSTER Manager
#!/usr/bin/env bash
REDIS_CLUSTER_HOME=/usr/local/redis-cluster
cd $REDIS_CLUSTER_HOME
CLUSTERS=(7000 7001 7002 7003 7004 7005)
start() {
@zhouyl
zhouyl / pcntl_worker.php
Last active September 2, 2019 11:05
pcntl multi process
<?php
if (!function_exists('pcntl_fork')) {
exit('请重新安装编译 PHP,开启 --enable-pcntl 扩展!');
}
if (!class_exists('Redis')) {
exit('请安装扩展: pecl install redis');
}
@zhouyl
zhouyl / consul.conf
Created October 22, 2018 10:31
consul configration in local
{
"datacenter": "oms-java",
"data_dir": "/data/consul/data/",
"pid_file": "/data/consul/consul.pid",
"log_file": "/data/consul/logs/",
"log_rotate_bytes": 500000000,
"log_level": "INFO",
"node_name": "node1",
"server": true,
"bootstrap": true,
@zhouyl
zhouyl / pre-commit
Created September 7, 2018 03:58
phpline for git hooks
#!/bin/bash
# Author: Remigijus Jarmalavičius <remigijus@jarmalavicius.lt>
# Author: Vytautas Povilaitis <php-checker@vytux.lt>
#
# XDebug check added by William Clemens <http://github.com/wesclemens>
# Handle spaces in filenames Dave Barnwell <https://github.com/freshsauce>
ROOT_DIR="$(pwd)/"
LIST=$(git diff-index --cached --name-only --diff-filter=ACMR HEAD)
ERRORS_BUFFER=""
@zhouyl
zhouyl / best.php_cs.dist
Last active September 4, 2018 06:13
php-cs-fixer configuration
<?php
$fixers = [
'@PSR1' => true,
'@PSR2' => true,
'@Symfony' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
@zhouyl
zhouyl / force-kill-processes
Last active January 15, 2018 11:12
/usr/local/bin/fkill
#!/usr/bin/env bash
PATTERN=$1
if [ -z $PATTERN ] ; then
echo "Usage: fkill <GREP PATTERN>"
exit -1
fi
CMD=$(/bin/ps -ef | grep -v grep | grep -v fkill | grep "$PATTERN")
@zhouyl
zhouyl / daemon-service.sh
Last active August 29, 2017 10:29
php daemon service
#!/usr/bin/env bash
if [ -f /usr/local/bin/php7 ]; then
php=/usr/local/bin/php7
else
php=`which php`
fi
check=$($php -r "echo version_compare(PHP_VERSION, '5.6.0') >= 0 ? 'yes' : 'no';")
if [ $check != "yes" ]; then
@zhouyl
zhouyl / .sync.ini
Last active August 3, 2017 06:15
rsync tool
[exclude]
ignores=*.log,*.pyc
[hosts]
sms=myhost.com::prepare_home/sms