Linux:du指令檢查檔案與目錄大小

指令:du

參數:
-a      Display an entry for each file in a file hierarchy.

-c      Display a grand total.

-d depth
             Display an entry for all files and directories depth directories deep.

-H      Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed.

-h      "Human-readable" output.  Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte.

-I mask
             Ignore files and directories matching the specified mask.

-g      Display block counts in 1073741824-byte (1-Gbyte) blocks.

-k      Display block counts in 1024-byte (1-Kbyte) blocks.

-L      Symbolic links on the command line and in file hierarchies are followed.

-m      Display block counts in 1048576-byte (1-Mbyte) blocks.
-P      No symbolic links are followed.  This is the default.

-r      Generate messages about directories that cannot be read, files that cannot be opened, and so on.  This is the default case.
             This option exists solely for conformance with X/Open Portability Guide Issue 4 (``XPG4'').

-s      Display an entry for each specified file.  (Equivalent to -d 0)

-x      File system mount points are not traversed.

網頁,禁止滑鼠的各種事件

相關code可以自行參考。

一、加入css



二、加入js




參考文章:
禁止複製+鎖右鍵+禁止全選-IE﹑Firefox﹑Chrome﹑Safari﹑Opera

用javascript插入css

其實這是很簡單的東西,所以就不多做解釋。下面是在Mobile端與Desktop分別用javascript插入想要的css code

<script>
var isMobile = (function(a){if(/(android|bbd+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0,4))) return true;})(navigator.userAgent||navigator.vendor||window.opera);

var css = document.createElement("style");
css.type = "text/css";
if(isMobile){
css.innerHTML = ".classname{} ";
}else{
css.innerHTML = ".classname{}";
}
document.body.appendChild(css);
</script>

Amazon ec2:將ec2 t1.micro 換成t2.micro

Amazon之前發布了t2.micro,關於t2.micro的說明可以參考這裡

記得之前東京t1.micro是0.022/小時,現在t2.micro是0.02/小時,而且performance比t1.micro好。

換機器過程沒有太大的問題,只是Availibility zone要選1c….,第一次開機器沒選好,開成1a,結果機器要重開不給重開,網路上也有人遇到類似問題,參考此文,其它大致上沒多大問題….

wordpress:在文章底部增加author

在wordpress的文章中,有時後可能會想新增作者在文章底部,你可以使用現成的plugin,例如以下:

9 Top Free WordPress Author Bio Box Plugins

但是抓了幾套來玩後,發現位置一直沒有可以弄到我想要的位置,只能指定文章的top或bottom,所以只好自己寫。

<!-- about author -->
<div id="entry-author-info" style="">

<h4 style="border-bottom: 1px solid #eee;">About Author</h4>

<div id="entry-author-info-avatar" style="float: left;">
<?php echo get_avatar( get_the_author_meta( 'ID' ), 100 ); ?>
</div>

<div>
<p><span style="color:#343434;font-size:18px;"><?php the_author(); ?></span></p>
<p><?php echo get_the_author_meta('description'); ?> </p>
</div>
<!-- end of about author -->

把上面的code加入single.php裡面你想要的位置即可。記得自己寫insline-style css,改成你要的樣式。

參考文章:
1.Function Reference/the author
2.Function Reference/get the author meta

在Ubuntu(12.04)上安裝PHP APC

PHP APC是php 加速器,關於它的說明可以參考php官方說明

以下是安裝步驟:

一、安裝PEAR

sudo apt-get install php-pear

二、安裝相依套件

sudo apt-get install php5-dev apache2-prefork-dev build-essential

三、安裝APC

sudo pecl install apc

四、新增apc.ini

vim /etc/php5/conf.d/apc.ini

加入以下三行:

extension=apc.so
apc.enabled=1
apc.shm_size=30

接著restart apache,之後看phpinfo應該已經可以找到apc的資訊,已經成功安裝了。

Facebook也有使用apc,相關影片可以參考:PHP Tek 2008 : APC @ Facebook

參考文章:
1.apc-php5-apache2-debian-etch