Skip to content

Instantly share code, notes, and snippets.

View mdjhny's full-sized avatar

Fanxin Yang mdjhny

View GitHub Profile
@mdjhny
mdjhny / sublime_xdebug调试
Created April 27, 2013 05:06
利用sublime,xdebug,chrome调试php
sudo -i
apt-get install php5-xdebug
vim /etc/php5/conf.d/xdebug.ini
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
:wq
apachectl restart
exit
@mdjhny
mdjhny / php.sublime-build
Created April 17, 2013 05:44
在sublime中添加php build功能
{
"cmd": ["php", "-f", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.php"
}
@mdjhny
mdjhny / windows右键命令行
Last active December 16, 2015 04:29
windows系统右键命令行
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\folder\shell\cmd]
@="CMD快速通道"
[HKEY_CLASSES_ROOT\folder\shell\cmd\command]
@="cmd.exe /k cd %1"
@mdjhny
mdjhny / factorize.py
Last active December 14, 2015 06:48
Python分解因数
def factorize(n):
'''Adapted from http://www.math.utah.edu/~carlson/notes/python.pdf'''
if n < 2:
return '本函数仅适用于不小于2的正整数'
d = 2
factors = []
while not n % d:
factors.append(d)
n /= d
d = 3
@mdjhny
mdjhny / .vimrc
Created February 23, 2013 14:12
vim的python配置 即使配置如此 ,Python的缩进也并不是很理想。比较好的选择是再使用一个插件 hynek/vim-python-pep8-indent。
"自动缩进
set autoindent
"类似C语言风格的缩进
set cindent
"智能缩进:每一行都和前一行有相同的缩进量,
"同时这种缩进形式能正确的识别出花括号,当遇到右花括号(}),
"则取消缩进形式。此外还增加了识别C语言关键字的功能。
"如果一行是以#开头的(比如宏),那么这种格式将会被特殊对待而不采用缩进格式
set smartindent
"For Python Programmers
@mdjhny
mdjhny / tail.py
Last active December 14, 2015 02:19
用python实现的类似tail的程序
from mmap import mmap
def tail(fn, count=10):
with open(fn,'r+') as f:
data = mmap(f.fileno(), 0)
pos = len(data)
for _ in range(count):
pos = data.rfind('\n', 0, pos)
if pos == -1:
pos = 0
break
@mdjhny
mdjhny / README.md
Created January 3, 2013 11:45 — forked from wong2/README.md

人人的登录改版后,采用RSA加密后传输密码,该项目用于解决这种情况下人人的模拟登录

使用前先 pip install requests

@mdjhny
mdjhny / bash-invocation.md
Created January 6, 2012 12:35 — forked from yegle/bash-invocation.md
Bash Shell启动方式与RC脚本

Bash Shell启动方式与rc脚本

Shell的不同分类

根据启动Bash Shell的方式不同,对Shell有两种分类方式

登录Shell与非登录Shell

根据Shell的启动方式不同,可以将Shell分为