Skip to content

Instantly share code, notes, and snippets.

Teddy sgsheg

Block or report user

Report or block sgsheg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sgsheg
sgsheg / nginx.conf
Created Nov 6, 2017 — forked from mreschke/nginx.conf
Nginx config for multiple laravel sites based on /api/v1 url paths
View nginx.conf
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@sgsheg
sgsheg / PhpStorm Keymap
Created Sep 21, 2017 — forked from vovoyager/PhpStorm Keymap
PhpStorm快捷键
View PhpStorm Keymap
### Editing ###
`Ctrl + Space` 基本代码完成(任意类的,方法的或者变量的名称)
`Ctrl + Shift + Enter` 补全当前语句
`Ctrl + P` Parameter info (within method call arguments)
`Ctrl + Q` 快速查找文档
`Ctrl + 鼠标滑过` 简明信息查看
`Ctrl + F1` 在插入符号处显示错误或者警告信息
`Alt + Insert` 生成代码...(Getters,Setters,Constructors)
`Ctrl + O` 重写方法
`Ctrl + I` 实现方法
@sgsheg
sgsheg / Liberal Regex Pattern for Web URLs
Created Oct 12, 2015 — forked from gruber/Liberal Regex Pattern for Web URLs
Liberal, Accurate Regex Pattern for Matching Web URLs
View Liberal Regex Pattern for Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
View .bash_profile
#############################################################################
# current prompt
#############################################################################
# \d – Current date
# \t – Current time
# \h – Host name
# \# – Command number
# \u – User name
# \W – Current working directory (ie: Desktop/)
# \w – Current working directory, full path (ie: /Users/Admin/Desktop)
View gist:e22af809e19bff474abe
命令 | 补全类型
--------------------------------------------------------------
<C -n> 普通关键字
<C -x> <C -n> 当前缓冲区关键字
<C -x> <C -i> 包含文件关键字
<C -x> <C -]> 标签文件关键字
<C -x> <C -k> 字典查找
<C -x> <C -l> 整行补全
<C -x> <C -f> 文件名补全
<C -x> <C -o> 全能补全
@sgsheg
sgsheg / gist:e3fe6e287b50be949623
Created Aug 30, 2014
理解php中的一些符号
View gist:e3fe6e287b50be949623
@sgsheg
sgsheg / gist:7972abcec7e6d625b408
Last active Aug 29, 2015
Update redis to the the lastest version
View gist:7972abcec7e6d625b408

Update redis to the lastest version


You can use the following PPA: https://launchpad.net/~rwky/+archive/redis.

You can install this repo running the command:

sudo add-apt-repository ppa:rwky/redis

sudo apt-get update
@sgsheg
sgsheg / gist:5de4f842420567b98832
Last active Aug 29, 2015
修改linux默认的sh
View gist:5de4f842420567b98832

Try linux command chsh.

The detailed commands is chsh -s /bin/bash. It will prompt you to enter your password. Your default login shell is /bin/bash now.

The following is quoted from man page:

The cash command changes the user login shell. This determines the name of the users initial login command. A normal user may only change the login shell for her own account, the superuser may change the login shell for any account.

This command will change the default login shell permanently.

View gist:c4b318c2fc726b44753c

Listen php-fpm stop and restart it again


#!/bin/bash
# author: Teddy

CheckURL="http://fueux.com"

STATUS_CODE=`curl -o /dev/null -m 10 --connect-timeout 10 -s -w %{http_code} $CheckURL`
#echo "$CheckURL Status Code:\t$STATUS_CODE"
View gist:3d7554b2ddaa67d4026e
#!/bin/sh
# CRON
## delete encrypted backups older than 5 days
#55 3 * * * find /path/to/backups-enc -mtime +5 -exec rm {} \;
## delete un-encrypted backups older than 1 days
#55 3 * * * find /path/to/backups -mtime +0 -exec rm {} \;
## database dump at 4am UTC = 8pm PST (9pm PDT)
#0 4 * * * /path/to/this/script
You can’t perform that action at this time.