Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
@qichunren
qichunren / c
Created December 15, 2011 07:56
qichunren@qichunren-desktop:~/github/cutycapt/CutyCapt$ ./CutyCapt
-----------------------------------------------------------------------------
Usage: CutyCapt --url=http://www.example.org/ --out=localfile.png
-----------------------------------------------------------------------------
--help Print this help page and exit
--url=<url> The URL to capture (http:...|file:...|...)
--out=<path> The target file (.png|pdf|ps|svg|jpeg|...)
--out-format=<f> Like extension in --out, overrides heuristic
--min-width=<int> Minimal width for the image (default: 800)
--min-height=<int> Minimal height for the image (default: 600)
@qichunren
qichunren / gist:1450038
Created December 9, 2011 03:38
MySQL server提示信息,不能远程连接数据库。
安装完MySQL后,远程连接数据库的时候,出现 ERROR 1130 (HY000): Host '192.168.0.32'is not allowed to connect to this MySQL server提示信息,不能远程连接数据库。
于是在网上搜了下
用下面的方法解决:
这个时候只要在MySQL服务器上登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"(或新增一条记录),正式环境建议指定为应用服务器的IP地址,比如'192.168.0.32'。
mysql -u root -pvmware
mysql>use mysql;
mysql>update user set host = '%' where user = 'root'; //这个命令执行错误时可略过
caojinhua:lifepark caojinhua$ rails s -p 3001
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3001
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-12-05 16:53:50] INFO WEBrick 1.3.1
[2011-12-05 16:53:50] INFO ruby 1.9.2 (2011-07-09) [x86_64-darwin11.2.0]
[2011-12-05 16:53:50] INFO WEBrick::HTTPServer#start: pid=48579 port=3001
[FATAL] failed to allocate memory
[2011-11-30 15:09:38] make
gcc -isysroot /Developer/SDKs/MacOSX10.7.sdk -arch i386 -fno-common -pipe -L. -Wl,-syslibroot /Developer/SDKs/MacOSX10.7.sdk -arch i386 -Wl,-u,_objc_msgSend main.o dmydln.o dmyencoding.o dmyversion.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o node.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time.o transcode.o util.o variable.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o dmyext.o -lpthread -ldl -lobjc -o miniruby
rbconfig.rb unchanged
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./enc/make_encmake.rb --builtin-encs="ascii.o us_ascii.o unicode.o utf_8.o" --builtin-transes="newline.o" enc.mk
./miniruby -I./lib -I.ext/c
@qichunren
qichunren / database_backup.sh
Created November 28, 2011 10:10
backup mysql data
#!/bin/bash
if [ ! -d /root/backup/sql ]; then
mkdir -p /root/backup/sql
fi
cd /root/backup/sql
database_yml=/www/ntdeck_secart/WEB-INF/config/database.yml
date_str=`date +%Y_%m_%d_%H_%M`
db_username=`grep user $database_yml | awk '{print $2}' | sed -n 3p`
@qichunren
qichunren / client.rb
Created November 18, 2011 02:29
ruby udp
require 'socket'
socket = UDPSocket.new
socket.send("I am ok.", 0, 'localhost', 1234)
text, sender = socket.recvfrom(16)
socket.close
@qichunren
qichunren / tmp.txt
Created October 25, 2011 04:08
temp text
*** 车厢1 ***
2011-10-25 12:07:32
温度000: 0c
温度001: 0c
湿度000: 0%RH
湿度001: 0%RH
@qichunren
qichunren / etc_init.d_tomcat
Created September 26, 2011 03:04
tomcat daemon script
#!/bin/sh
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the tomcat web server
# Description: starts tomcat using start-stop-daemon
@qichunren
qichunren / nginx.sh
Created September 20, 2011 07:49
file name: /etc/init.d/nginx use service nginx [start|stop|restart]
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# 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
@qichunren
qichunren / 脚本验证.html
Created September 16, 2011 13:12 — forked from hare1987/脚本验证.html
脚本验证
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
function checkregform(){
alert("验证开始了!");
if (document.yx.name.value==""){
alert("请填写宝宝的姓名!");