This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 备份数据库并压缩 | |
mysqldump -h -u -p database | gzip > backupfile.sql.gz | |
2. 解压并还原数据库 | |
gunzip < backupfile.sql.gz | mysql -uroot -ppassw database | |
真实例子(带参数) | |
mysqldump --complete-insert --no-create-info --skip-triggers --ignore-table=cellar.schema_migrations --ignore-table=cellar.regions -uroot -p cellar | gzip > backupfile.sql.gz | |
gunzip < backupfile.sql.gz | mysql -ucellar -p cellar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#content').select() | |
document.execCommand('copy') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
电信号码 | |
1[3578][01379]\d{8} | |
联通号码 | |
1[34578][01256]\d{8} | |
移动号码 | |
134[012345678]\d{7}或1[34578][012356789]\d{8} | |
全部号码 | |
1[34578][012356789]\d{8}|134[012345678]\d{7} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. create config | |
vi ~/.ssh/config | |
2. add content | |
Host dpy | |
User dpy | |
HostName xxx.xxx.xx.xxx | |
3. install ssh-copy-id(in mac ox) | |
brew install ssh-copy-id | |
4. add id to remote server | |
ssh-copy-id -i ~/.ssh/id_rsa.pub dpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# payment_orders join orders | |
PaymentOrder.joins(:orders) | |
# payment_orders join orders, payment_orders join gift_packs | |
PaymentOrder.joins(:orders).joins(:gift_pack) | |
# payment_orders join orders, orders join products | |
PaymentOrder.joins(orders: :products) | |
# payment_orders join orders, orders join products, products join product_items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 对Date的扩展,将 Date 转化为指定格式的String | |
* 月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) 可以用 1-2 个占位符 | |
* 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) | |
* eg: | |
* (new Date()).pattern("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 | |
* (new Date()).pattern("yyyy-MM-dd E HH:mm:ss") ==> 2009-03-10 二 20:09:04 | |
* (new Date()).pattern("yyyy-MM-dd EE hh:mm:ss") ==> 2009-03-10 周二 08:09:04 | |
* (new Date()).pattern("yyyy-MM-dd EEE hh:mm:ss") ==> 2009-03-10 星期二 08:09:04 | |
* (new Date()).pattern("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add the remote, call it "upstream": | |
git remote add upstream https://github.com/whoever/whatever.git | |
# Fetch all the branches of that remote into remote-tracking branches, | |
# such as upstream/master: | |
git fetch upstream | |
# Make sure that you're on your master branch: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enable (git) plugin. | |
g git | |
gst git status | |
gl git pull | |
gup git fetch && git rebase | |
gp git push | |
gc git commit -v | |
gca git commit -v -a | |
gco git checkout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. value-is-date | |
update ad_bids set bid_end_time = to_date('2016/10/31 16:00:00', 'yyyy/mm/dd hh24:mi:ss') where id = 10200; | |
# 2. string-include-& | |
# update url = http://a.10086.cn/pams2/linkUrl.jsp?j=d&p=72&c=9536&r=28785646&src=5210297653 | |
update default_ad_cate set url='http://a.10086.cn/pams2/linkUrl.jsp?j=d&'||'p=72&'||'c=9536&'||'r=28785646&'||'src=5210297653' where ad_schedule_id=10482; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reference: https://www.digitalocean.com/community/tutorials/how-to-install-hadoop-on-ubuntu-13-10 | |
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz | |
tar xfz hadoop-2.7.3.tar.gz | |
mv hadoop-2.7.3 /usr/local/hadoop | |
# Editing ~/.bashrc |
OlderNewer