convert mysql table engine myisam to innodb

#!/bin/bash if [ $# -ne 1 ]; then echo “usage: convert.sh database” exit 1 fi date db=$1 echo “Convert database $db” ; mysql -B -N -e “SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = ‘$db’ and engine=’myisam'” |awk ‘{print $1}’| while read table; \ do \ echo “+ Converting Table $table”; \ mysql . . . → Read More: convert mysql table engine myisam to innodb

kill mysql show processlist kill

#!/bin/bash date for id in `mysqladmin processlist | grep -i “your detect filter” |awk ‘{print $2}’` do mysqladmin kill ${id}; echo ${id}.’\n'; done

install capistrano in centos

yum install -y ruby ruby-devel rubygems gem update gem install capistrano gem install capistrano-ext

Linux下ps查找并用kill命令终止进程

ps -ef |grep “string matches”|grep -v “grep” |awk ‘{print $2}’|xargs kill -9

最轻巧的javascript模板函数

随着移动互联网的发展APP站点增加,ajax数据交互变得频繁起来,许多javascript 模板终于有了用武之地。

看过一些js模板引擎,引入很多语法,解析,使得模板字符串看上去更漂亮,更接近UI,去程序化是他们的目的。

两年前自己也写了一个js template函数在项目中使用,今天精简了一下语法,增加error report功能方便了模板解析出错时定位问题。

本着开源的精神,我把它放到了github上 https://github.com/fushanlang/js-template

以及 oschina开源库里

http://git.oschina.net/fushanlang/javascript-template

function js_template(t, v) { var a = “”; var echo = function (b) { a += b }; var z = window.AJ; window.AJ = z = !z ? [] : z; var s = “_{” + Math.random() + “}_”; var p = t.replace(/\n|\r|\t/g, . . . → Read More: 最轻巧的javascript模板函数