Skip to content

Instantly share code, notes, and snippets.

View zhouyl's full-sized avatar

ZhouYL zhouyl

  • China.ShengZheng
View GitHub Profile
@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 / 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 / .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 / 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 / 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 May 28, 2018 08:23
PHP 版本切换脚本

PHP 版本切换脚本

需要将 PHP 各版本安装到 /usr/local/php$VER/ 目录下

保存 php-switch 到 /usr/local/bin目录下

执行以下命令

 chmod +x /usr/local/bin/php-switch
@zhouyl
zhouyl / cli.function.php
Created August 19, 2014 03:06
CLI 命令行函数
<?php
/**
* CLI 命令行函数
*/
/**
* 生成具有颜色的文本
*
* @param string $text
@zhouyl
zhouyl / message.php
Last active August 29, 2015 14:05
phalcon view helper
<?php
namespace Base\View\Helper;
/**
* 视图助手 - 输出响应信息
*
* 示例:
*
* $helper = new \Base\View\Helper\Message;
@zhouyl
zhouyl / Default (Windows).sublime-keymap.json
Last active March 23, 2017 07:00
Sublime Text Settings
[
{ "keys": ["ctrl+shift+c"], "command": "convert_to_utf8" },
{ "keys": ["ctrl+t"], "command": "side_bar_new_file2" },
{ "keys": ["f2"], "command": "side_bar_rename" },
{ "keys": ["ctrl+alt+b"], "command": "upper_case" },
{ "keys": ["ctrl+alt+l"], "command": "lower_case" },
{ "keys": ["ctrl+f"], "command": "show_panel", "args": {"panel": "find", "reverse": false} },
{ "keys": ["ctrl+1"], "command": "fold_by_level", "args": {"level": 1} },
{ "keys": ["ctrl+2"], "command": "fold_by_level", "args": {"level": 2} },
{ "keys": ["ctrl+3"], "command": "fold_by_level", "args": {"level": 3} },
@zhouyl
zhouyl / ZhouYL.tmTheme
Created July 26, 2014 13:22
Sublimt Text 2 Color Schema
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Blackboard</string>
<key>author</key>
<string>Domenico Carbotta</string>
<key>settings</key>
<array>