This file contains hidden or 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
SELECT id, username, (total_point - spent_point) AS point | |
FROM users | |
ORDER BY point DESC | |
LIMIT 50 | |
INTO OUTFILE '/tmp/bbs_points_top50.csv' | |
FIELDS TERMINATED BY ',' | |
ENCLOSED BY '"' | |
LINES TERMINATED BY '\n' | |
; |
This file contains hidden or 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
mysql -N -hhostname -uusername -ppassword database_name -e "select id, DATE(updated_at) from topics where status < 10 limit 10" | sed 's/\t/,/g' |
This file contains hidden or 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
# Way 1 | |
killall ${process_name} | |
# Way 2 | |
for pid in $(ps aux | grep ${process_name} | awk '{print $2}') | |
do | |
kill ${pid} | |
done |
This file contains hidden or 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
su - | |
#dependcies | |
#centos 6.2 | http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm | |
rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm | |
yum -y groupinstall 'Development Tools' 'Additional Development' | |
yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis |
This file contains hidden or 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
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<fontconfig> | |
<match target="pattern"> | |
<test qual="any" name="family"> | |
<string>serif</string> | |
</test> | |
<edit name="family" mode="prepend" binding="strong"> | |
<string>DejaVu Serif</string> |
This file contains hidden or 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
Gem.loaded_specs['gem_name'].full_gem_path |
This file contains hidden or 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
# rails new . -d mysql --skip-test-unit | |
# rails new . --skip-active-record --skip-test-unit | |
# Edit Gemfile | |
if yes?('Replace gem source "https://rubygems.org/" with Taobao mirror "https://ruby.taobao.org/"?(y/n)') | |
gsub_file 'Gemfile', 'rubygems.org', 'ruby.taobao.org' | |
end | |
use_mongodb = yes?('Use MongoDB?(y/n)') | |
gem 'jquery-turbolinks' |
This file contains hidden or 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
# Usage: | |
# 1. Put this file in config/locales/grape/zh-CN.yml | |
# 2. Set load_path in config/application.rb as below: | |
# config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] | |
zh-CN: | |
grape: | |
errors: | |
format: ! '%{attributes} %{message}' | |
messages: |
This file contains hidden or 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
# Generate Private Key: | |
openssl genrsa -out server.key 1024 | |
# Generate a Certificate Signing Request (CSR) | |
openssl req -new -key server.key -out server.csr | |
# Generate a Self-Signed SSL Certificate | |
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt |
This file contains hidden or 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
# Usage: | |
# 1. Put this file in config/locales/kaminari/zh-CN.yml | |
# 2. Set load_path in config/application.rb as below: | |
# config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] | |
zh-CN: | |
views: | |
pagination: | |
first: "« 首页" | |
last: "末页 »" |