Skip to content

Instantly share code, notes, and snippets.

@rosickytong
rosickytong / Linux配置防火墙,开启80端口、3306端口
Created October 21, 2013 02:48
Linux配置防火墙,开启80端口、3306端口
传送门:http://www.myhack58.com/Article/48/66/2012/34999.htm
vi /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(允许80端口通过防火墙)
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT(允许3306端口通过防火墙)
特别提示:很多网友把这两条规则添加到防火墙配置的最后一行,导致防火墙启动失败,正确的应该是添加到默认的22端口这条规则的下面
添加好之后防火墙规则如下所示:
######################################
# Firewall configuration written by system-config-firewall
@rosickytong
rosickytong / nginx+tomcat负载均衡
Created September 22, 2013 09:49
nginx+tomcat负载均衡
参考http://ari.iteye.com/blog/833153
1.安装nginx
yum install nginx
2.启动nginx
service nginx start
@rosickytong
rosickytong / tomcat外部引用项目
Created September 22, 2013 08:52
tomcat外部应用项目
参考
http://zhidao.baidu.com/link?url=e7qpCPHIhMHeYonvH_qmjGDlR69mmzpjr2e5w_x5cileM1inVvuB3a_cvALG3QCPaWk_I67HHMsaoAWcMI_gE_
tomcat_home=/Users/rosicky_tong/tomcat-7.0.41
cd $tomcat_home
cd conf/Catalina/localhost
vim cocos2dx.xml
@rosickytong
rosickytong / svn 操作tips
Last active December 20, 2015 23:59
记录各种 svn 命令操作
1.重定向版本库
svn switch --relocate svn://oldurl svn://newurl
or
svn switch --relocate https://oldurl https://newurl
@rosickytong
rosickytong / python http server
Last active December 20, 2015 19:29
python -m SimpleHTTPServer
http://blog.sina.com.cn/s/blog_62e7fe670101c4v5.html
python -m SimpleHTTPServer 8000
使用上面的命令可以把当前目录发布到8000端口。
但是这条命令是当前运行的,不是后台运行的,也就是说如果Ctrl + C,则该端口就会关闭。
在上述命令的最后加一个 & ,则该命令产生的进程在后台运行,不会影响当前终端的使用(我们在只有一个bash的环境下)。
#同步系统时间
/usr/sbin/ntpdate 0.rhel.pool.ntp.org
#定时同步时间
#1 打开编辑器
crontab -e
#2 插入
00 07 * * * /usr/sbin/ntpdate 0.rhel.pool.ntp.org
#3 保存
wq!
@rosickytong
rosickytong / excel poi SaxParser
Created June 19, 2013 04:01
解决普通dom解析时造成的omm问题
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
adduser username
passwd username
1.
vim /etc/resolv.conf
#dns
nameserver 8.8.8.8
nameserver 8.8.4.4
2.
cd /etc/sysconfig/
add user:
mysql> use mysql;
mysql> GRANT ALL ON *.* TO account@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> flush privileges;
delete user:
mysql> drop user username
mysql> drop user username@host