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
/* setting the font-size to 16px. (or better, by using the browser’s default font-size). */ | |
input[type='text'], | |
input[type='number'], | |
textarea { | |
font-size: 16px; | |
} |
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
public String getPermutation(int n, int k) { | |
if (n <= 0 || k <= 0) | |
return ""; | |
// can't use array because we need remove item each time | |
// create the number array | |
int mod = 1; | |
ArrayList<Integer> nl = new ArrayList<Integer>(); | |
for (int i = 1; i <= n; i++) { | |
nl.add(i); | |
mod *= i; // calculate n! |
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
public int canCompleteCircuit(int[] gas, int[] cost) { | |
int[] remain = new int[gas.length]; | |
for (int i = 0; i < remain.length; i++) { | |
int j = i; | |
boolean canComp = true; | |
int capt = 0; | |
do { | |
capt += gas[j] - cost[j]; |
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. htpasswd -c /usr/local/apache/passwd/passwords <username1> | |
htpasswd /usr/local/apache/passwd/passwords <username12> | |
2. httpd.conf, add the following inside <Directory ....> section | |
AuthType Basic | |
AuthName "<Authentication Realm>" | |
# (Following line optional) | |
AuthBasicProvider file | |
AuthUserFile /usr/local/apache/passwd/passwords | |
#Require user <username> |
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
p:first-child:first-letter { float: left; color: #903; font-size: 75px; line-height: 60px; padding-top: 4px; padding-right: 8px; padding-left: 3px; font-family: Georgia; } |
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
cat *.txt |grep "YOUR_FILTER"|grep -vi "EXCLUDE_FILTER"|cut -d\" -f2|awk '{print$2}'|sort|uniq -c|sort -nr > report.log | |
Example: | |
cat report.log | grep -vi ".css\|.js\|.woff\|.eot\|.ttf\|.jpg\|.gif\|.png\|.ico" |grep -vi "wp-login.php\|wp-cron.php\|wp-admin\|robots.txt" | cut -d\" -f2|awk '{print$2}'|sort|uniq -c|sort -nr |
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
rsync -rav --progress "ssh -i KEY-PAIR.ppk" /mnt/temp/ root@another-instance-ip-addr:/mnt/temp/ |
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
if you open browser development tool's console and find some javascript errors like "switchEditors is undefined" or "jquery is undefined", It appears that the new version of WordPress has some new performance optimisation features that concatenate all JavaScript resources into a single request. | |
Solution: put the following two lines of codes in wp-config.php: | |
define('CONCATENATE_SCRIPTS', false); | |
define('SCRIPT_DEBUG', true); |
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
SELECT table_schema "Data Base Name", SUM( data_length + index_length) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema; |
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
font-family: … "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; | |
/* 中文字体之前的「…」代表西文字体 */ |