王筝的博客
ruby学习

http://ruby-doc.org/core-2.1.2/File.html#method-c-dirname

(1)basename(file_name [, suffix] ) → base_name

Returns the last component of the filename given in file_name, which can be formed using bothFile::SEPARATOR and File::ALT_SEPARATOR as the separator when File::ALT_SEPARATOR is not nil. If suffix is given and present at the end of file_name, it is removed.

File.basename("/home/gumby/work/ruby.rb")          #=> "ruby.rb"
File.basename("/home/gumby/work/ruby.rb", ".rb")   #=> "ruby"

(2)dirname(file_name) → dir_name

Returns all components of the filename given in file_name except the last one. The filename can be formed using both File::SEPARATOR and File::ALT_SEPARATOR as the separator whenFile::ALT_SEPARATOR is not nil.

File.dirname("/home/gumby/work/ruby.rb")   #=> "/home/gumby/work"

vim /var/log/secure

 

找到文件的所有修改者

git blame [file_name]

(1) iostat

这个命令可以检测存储设备是否工作正常,显示存储系统的细节,可以看到每个磁盘的IO情况,也可以监控到CPU 的使用状态.

14:52 [root@aaa]$ iostat
Linux 2.6.18-308.el5 (aaa) 2014年08月22日

avg-cpu: %user %nice %system %iowait %steal %idle
4.65 0.00 0.78 0.02 0.00 94.55

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 1.55 0.16 96.24 5548422 3391975158
sda1 0.00 0.00 0.00 1748 118
sda2 0.71 0.13 27.18 4537378 957989784
sda3 0.00 0.00 0.00 1422 304
sda4 0.00 0.00 0.00 8 0
sda5 0.83 0.03 69.06 1007434 2433984952

(2)free查看内存使用情况的综述

14:56 [root@a ]$ free -m
total used free shared buffers cached
Mem: 32168 31714 453 0 1056 26763
-/+ buffers/cache: 3894 28273
Swap: 4094 0 4094

(3)meminfo查看详细信息

14:52 [root@aaa]$ cat /proc/meminfo
MemTotal: 32940052 kB
MemFree: 464180 kB
Buffers: 1081628 kB
Cached: 27405336 kB
SwapCached: 0 kB
Active: 6155648 kB
Inactive: 24833068 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 32940052 kB
LowFree: 464180 kB
SwapTotal: 4192956 kB
SwapFree: 4192804 kB
Dirty: 16 kB
Writeback: 0 kB
AnonPages: 2501732 kB
Mapped: 32108 kB
Slab: 1428392 kB
PageTables: 26956 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 20662980 kB
Committed_AS: 4767104 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 264924 kB
VmallocChunk: 34359473015 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB

(4)mpstat 显示CPU状态,

可以显示所有处理器的平均状况,也可以显示统计信息

12:38 [ ]$ mpstat -P ALL
Linux 2.6.18-308.el5 (a04.api.cms.3g.b28.youku) 2014年08月23日

12时38分01秒 CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
12时38分01秒 all 4.64 0.00 0.54 0.02 0.01 0.22 0.00 94.56 67.60
12时38分01秒 0 8.58 0.00 0.93 0.05 0.05 0.71 0.00 89.68 67.60
12时38分01秒 1 3.53 0.00 0.41 0.01 0.00 0.07 0.00 95.98 0.00
12时38分01秒 2 2.84 0.00 0.33 0.01 0.00 0.05 0.00 96.76 0.00
12时38分01秒 3 3.61 0.00 0.48 0.02 0.00 0.07 0.00 95.83 0.00

12:38 [root@a04.api.cms.3g.b28.youku]$ mpstat -P 0
Linux 2.6.18-308.el5 () 2014年08月23日

12时40分43秒 CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s
12时40分43秒 0 8.58 0.00 0.93 0.05 0.05 0.71 0.00 89.68 67.60

1 CPU:处理器编号,如果为all,则此行表示的是所有处理器的统计平均值
2 %usr:用户态的CPU利用率
3 %nice:具有调度优先级的用户态CPU利用率
4 %sys:内核态CPU利用率(此值不包括响应硬件中断和软件中断的时间)
5 %iowait:处理IO请求导致CPU处于IDLE状态的时间百分比
6 %irq:CPU响应硬件中断的时间比率
7 %soft:CPU响应软件中断的时间比率
8 %steal:当虚拟机监控器在服务于其他虚拟处理器时,虚拟CPU的被动等待时间比率
9 %guest:运行一个虚拟处理器所消耗的CPU时间比率

(5)netstat
-a : 显示所有socke信息
-r : 显示路由信息
-i : 显示网卡借口统计
-s : 显示网络协议统计

(6)pmap 显示进程占用的内存量,找到占用内存最多的进程.
nginx主进程内存占用情况分析

15:00 [ ]$ ps -ef | grep nginx
nobody 13609 19402 0 Aug06 ? 00:00:00 nginx: worker process
nobody 13610 19402 0 Aug06 ? 00:00:00 nginx: worker process
nobody 13611 19402 0 Aug06 ? 00:00:00 nginx: worker process
nobody 13612 19402 0 Aug06 ? 00:00:00 nginx: worker process
nobody 13613 19402 0 Aug06 ? 00:00:00 nginx: worker process
nobody 13614 19402 0 Aug06 ? 00:00:00 nginx: worker process
nobody 13615 19402 0 Aug06 ? 00:00:01 nginx: worker process
nobody 13616 19402 0 Aug06 ? 00:00:01 nginx: worker process
root 16487 16097 0 15:00 pts/1 00:00:00 grep nginx
root 19402 1 0 May05 ? 00:00:00 nginx: master process nginx

15:00 [ ]$ pmap 19402|head -n 10
19402: nginx: master process nginx
0000000000400000 1112K r-x– /opt/nginx/sbin/nginx
0000000000716000 68K rw— /opt/nginx/sbin/nginx
0000000000727000 60K rw— [ anon ]
0000000014fbc000 1080K rw— [ anon ]
0000003243200000 1204K r-x– /lib64/libcrypto.so.0.9.8e.#prelink#.6Zb7wz (deleted)
000000324332d000 2044K —– /lib64/libcrypto.so.0.9.8e.#prelink#.6Zb7wz (deleted)
000000324352c000 132K rw— /lib64/libcrypto.so.0.9.8e.#prelink#.6Zb7wz (deleted)
000000324354d000 16K rw— [ anon ]
0000003243600000 280K r-x– /lib64/libssl.so.0.9.8e

(1)如何自动清理老的release

capistrano 部署后自动清理老 release,默认只保留 5 个 releases

添加下面代码到 config/deploy.rb

# if you want to clean up old releases on each deploy uncomment this:
after "deploy:restart", "deploy:cleanup"

(2)如何人指定保留数量
如果想制定具体保留几个releases文件夹,设置保留数量,在 config/deploy.rb 中添加如下代码
set :keep_releases, 15
以上代码的含义是保留15次部署的releases

https://github.com/hakimel/reveal.js#installation

 

1.install Node.js

brew install nodejs

2. install Grunt

http://gruntjs.com/getting-started#installing-the-cli

npm install -g grunt-cli

npm install grunt –save-dev

3. Clone the reveal.js repository

$ git clone https://github.com/hakimel/reveal.js.git

4.Navigate to the reveal.js folder
$ cd reveal.js

5.Install dependencies
$ npm install

6.Serve the presentation and monitor source files for changes
$ grunt serve

7.Open http://localhost:8000 to view your presentation
  1. You can change the port by using grunt serve --port 8001.


django_for_pl.xml
<buffer-size>32768</buffer-size>