Skip to content

Instantly share code, notes, and snippets.

View zhouyl's full-sized avatar

ZhouYL zhouyl

  • China.ShengZheng
View GitHub Profile
@zhouyl
zhouyl / README.md
Created March 22, 2017 01:50
/etc/systemd/system/rc-local.service
sudo systemctl daemon-reload
sudo systemctl enable rc.local
@zhouyl
zhouyl / README.md
Last active March 22, 2017 02:02
自己编写 systemd 下的 fpm.service

编辑完成 /etc/systemd/system/php7.1-fpm.service 运行

sudo systemctl daemon-reload
@zhouyl
zhouyl / .bash_profile
Last active March 6, 2018 01:08
HOME 目录的 bash profile 设置
if [ -z $RCLOAD ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
function git-branch-name {
git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3
}
function git-branch-prompt {
@zhouyl
zhouyl / uwsgi.sh
Created April 7, 2017 10:41
Flask uWSGI manage
#!/bin/bash
name="Flask uWSGI"
UWSGI_HOME=$(cd "$(dirname "$0")"; cd ..; pwd)
UWSGI_BIN=$UWSGI_HOME/venv/bin/uwsgi
UWSGI_CONFIG=$UWSGI_HOME/config/uwsgi.yaml
UWSGI_LOG_FILE=$UWSGI_HOME/logs/uwsgi/$(date +'%Y%m%d').log
UWSGI_PID_FILE=/var/run/dapi-uwsgi.pid
@zhouyl
zhouyl / parse-protos-service.php
Created July 13, 2017 07:18
Resolve the service code for the protobuf protocols
#!/usr/bin/env php
<?php
$src_dir = __DIR__ . '/php-src';
$protos_dir = __DIR__ . '/protos';
foreach (new DirectoryIterator($protos_dir) as $file) {
if ($file->isFile() && $file->getExtension() === 'proto') {
generate_service_code($file->getPathname());
}
@zhouyl
zhouyl / .sync.ini
Last active August 3, 2017 06:15
rsync tool
[exclude]
ignores=*.log,*.pyc
[hosts]
sms=myhost.com::prepare_home/sms
@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 / 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 / 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 / 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=""