Skip to content

Instantly share code, notes, and snippets.

@ratazzi
ratazzi / tornado_gae
Created August 7, 2010 05:32
tornado_gae
#!/usr/bin/env python
# encoding=utf-8
import tornado.web
import tornado.wsgi
import wsgiref.handlers
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("It's running.")
bash 颜色
\e[01;37mstring\e[00m
\e 高级选项输出到窗口 (PHP,Python 中用 \033 代替)
[ 非打印字符开始
] 非打印字符结束
string 待打印的字符串
样式代码
01;37m
#!/bin/bash
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
#!/bin/sh
### BEGIN INIT INFO
# Provides: php-fpm php5-fpm
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: starts php-fpm
### END INIT INFO
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@ratazzi
ratazzi / gist:957164
Created May 5, 2011 14:45
post-receive
#!/bin/bash
#
echo -n '-----> Deploying ...'
cd ..
env -i git reset --hard -q
echo -e ' \033[01;32mDone.\033[00m'
exit 0
#!/usr/bin/env php
<?php
if (!empty($argv[1])) {
$t = strtotime($argv[1]);
}
$fp = fopen('php://stdin', 'r');
while(!feof($fp)) {
$line = fgets($fp, 255);
if (empty($line)) continue;
#!/bin/bash
# 查询域名记录生效情况
# ratazzi <ratazzi.potts@gmail.com>
if [ -z "$1" ]; then
echo -e "Usage: $0 example.com\n"
exit 0
fi
DIG=`which dig`
DOMAIN=$1
perl -pi -e 's/print/echo/g' SomeFile.txt
# sed -i -e 's/print/echo/g' SomeFile.txt
# avg
cat count.txt | awk '{sum+=$1} END {print "Average = ", sum/NR}'
# 分割压缩文件
tar cvjf - package | split -b 10m - package.tar.bz2.
cat package.tar.bz2.* | tar xjv
@ratazzi
ratazzi / .ctags
Created July 24, 2011 04:50
ctags 自定义语言
--langdef=gitdiff
--langmap=gitdiff:.gitdiff
--regex-gitdiff=/^commit ([a-f0-9]+)/\1/d,definition/
--gitdiff-kinds=+d