Skip to content

Instantly share code, notes, and snippets.

View lymanlai's full-sized avatar
👀

Lyman Lai lymanlai

👀
  • On The Moon Now ;) Way to the Mars!!
View GitHub Profile
@lymanlai
lymanlai / jQuery plugin pattern+1
Created November 14, 2012 13:56
jQuery plugin pattern+1
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
/*!
@lymanlai
lymanlai / jQuery plugin pattern
Created November 14, 2012 13:46
jQuery plugin pattern
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script>
/*!
* jQuery extend-based plugin boilerplate
@lymanlai
lymanlai / vim-tips.sh
Created September 14, 2012 12:32
vim-tips.sh
#vim中删除技巧
:%s/[Ctrl-v][Enter]//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%!sort -u 删除重复行
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf
:%s/// 删除多行注释
:g/^$/d 删除所有空行
:g!/^dd/d 删除不含字符串'dd'的行
:v/^dd/d 删除不含字符串'dd'的行
@lymanlai
lymanlai / ubuntu ssd setup.sh
Created September 13, 2012 23:51
ubuntu ssd setup
http://plumgo.cc/blog/2012/01/05/ssd-optimization-on-ubuntu-note/
1. /etc/fstab
1). / 目录参数: discard,noatime,nodiratime,errors=remount-ro 0 1
2). 其他
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
@lymanlai
lymanlai / httdp-addon.conf
Created September 5, 2012 17:28
httdp-addon.conf
#在httpd.conf的最底部添加此代码
#在106行去掉#号,变成:LoadModule rewrite_module modules/mod_rewrite.so
####
## http://lamp.linux.gov.cn/Apache/ApacheMenu/vhosts/mass.html#simple.rewrite
####
# 从"Host:"头获取主机名
UseCanonicalName Off
# 可分拣的日志
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
@lymanlai
lymanlai / wampmanager.ini
Created September 5, 2012 17:22
wampmanager.ini
;[Menu.Left]项的最后面添加以下代码
Type: item; Caption: "www directory"; Action: shellexecute; FileName: "F:/"; Glyph: 2
Type: item; Caption: "httpd.conf"; Glyph: 6; Action: run; FileName: "scite"; parameters:"F:/wamp/apache2/conf/httpd.conf"
Type: item; Caption: "php.ini"; Glyph: 6; Action: run; FileName: "scite"; parameters: "F:/wamp/apache2/bin/php.ini"
Type: item; Caption: "my.ini"; Glyph: 6; Action: run; FileName: "scite"; parameters: "F:/wamp/mysql/my.ini"
Type: item; Caption: "host"; Glyph: 6; Action: run; FileName: "scite"; parameters: "C:\WINDOWS\system32\drivers\etc\hosts"
Type: item; Caption: "Exit"; Action: multi; Actions: myexit;
@lymanlai
lymanlai / wp theme dev list.md
Created August 31, 2012 02:54
wp theme dev list

1.lang translate

@lymanlai
lymanlai / wpgetter.php
Created August 23, 2012 17:01
get wp, and unpack
<?php
file_put_contents('wp.tar.gz',file_get_contents('http://wordpress.org/latest.tar.gz'));
exec('tar -xf wp.tar.gz');
@lymanlai
lymanlai / ubuntu.sh
Created June 29, 2012 08:20
ubuntu 总结
http://wiki.ubuntu.org.cn/UbuntuSkills
* 通过ssh传输文件
scp -rp /path/filename username@remoteIP:/path #将本地文件拷贝到服务器上
scp -rp username@remoteIP:/path/filename /path #将远程文件从服务器下载到本地
tar cvzf - /path/ | ssh username@remoteip "cd /some/path/; cat -> path.tar.gz" #压缩传输
tar cvzf - /path/ | ssh username@remoteip "cd /some/path/; tar xvzf -" #压缩传输一个目录并解压
rsync -avh /path/to/file/or/dir user@host:/path/to/dir/or/file
rsync -avh user@host:/path/to/file/or/dir /path/to/file/or/dir
@lymanlai
lymanlai / sftp-ubuntu.md
Created June 28, 2012 02:01 — forked from joshellington/sftp-ubuntu.md
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h