偶尔在google上看了一下自己站点的收录信息:简直一塌糊涂啊.标签页,page页,图像页等等全都给收录进去了,以前还觉得收录越多越好,都是年轻的时候犯的大错,居然要长大的自己来承担,所以今天给tag做了小小的优化,为A链接添加nofollow属性.
Continue reading 关于给wordpress的tag加上nofollow属性
CentOS6搭建OpenStack[icehouse]网络节点
OpenStack是IaaS(基礎設施即服務)軟件,讓任何人都可以自行建立和提供雲端運算服務。此外,OpenStack也用作建立防火牆內的「私有雲」(Private Cloud),提供機構或企業內各部門共享資源。 -Wiki 这篇文章主要记录一下openstack计算节点的安装过程
基本配置
1.配置hosts文件使多节点间能相互通讯
/etc/hosts
#控制节点
192.168.1.100 CloudController
#计算节点
192.168.1.101 CloudNova
#网络节点
192.168.1.102 CloudNeutron
2.配置yum源
yum install https://repos.fedorapeople.org/repos/openstack/EOL/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm
yum install http://dl.fedoraproject.org/pub/epel/6/x86\_64/epel-release-6-8.noarch.rpm
#安装好openstack的源后要修改源文件里面的baseurl
vim /etc/yum.repo.d/rdorelease.repo
https://repos.fedorapeople.org/repos/openstack/EOL/openstack-icehouse/epel-6/
3.安装openstack基本工具 安装openstack基本配置工具和openstackselinux管理工具,更新系统并重启
yum install openstack-utils
yum install openstack-selinux
yum update
reboot
4.配置网络节点内核参数
vim /etc/sysctl.conf
#关闭IP过滤开启转发等
net.ipv4.ip\_forward=1
net.ipv4.conf.all.rp\_filter=0
net.ipv4.conf.default.rp\_filter=0
net.bridge.bridge-nf-call-arptables=1
net.bridge.bridge-nf-call-iptables=1
modprobe bridge
sysctl -p
Neutron节点配置过程 安装neutron组件并为neutron配置keystone认证
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch
openstack-config --set /etc/neutron/neutron.conf DEFAULT auth\_strategy keystone
openstack-config --set /etc/neutron/neutron.conf keystone\_authtoken auth\_uri http://CloudController:5000
openstack-config --set /etc/neutron/neutron.conf keystone\_authtoken auth\_host CloudController
openstack-config --set /etc/neutron/neutron.conf keystone\_authtoken auth\_protocol http
openstack-config --set /etc/neutron/neutron.conf keystone\_authtoken auth\_port 35357
openstack-config --set /etc/neutron/neutron.conf keystone\_authtoken admin\_tenant\_name service
openstack-config --set /etc/neutron/neutron.conf keystone\_authtoken admin\_user neutron
openstack-config --set /etc/neutron/neutron.conf keystone\_authtoken admin\_password 123
为neutron配置qpid消息服务器
openstack-config --set /etc/neutron/neutron.conf DEFAULT rpc\_backend neutron.openstack.common.rpc.impl\_qpid
openstack-config --set /etc/neutron/neutron.conf DEFAULT qpid\_hostname CloudController
配置neutron使用ml2网络模式
openstack-config --set /etc/neutron/neutron.conf DEFAULT core\_plugin ml2
openstack-config --set /etc/neutron/neutron.conf DEFAULT service\_plugins router
为实例提供L3虚拟网络
openstack-config --set /etc/neutron/l3\_agent.ini DEFAULT interface\_driver neutron.agent.linux.interface.OVSInterfaceDriver
openstack-config --set /etc/neutron/l3\_agent.ini DEFAULT use\_namespaces True
为实例提供dhcp服务
openstack-config --set /etc/neutron/dhcp\_agent.ini DEFAULT interface\_driver neutron.agent.linux.interface.OVSInterfaceDriver
openstack-config --set /etc/neutron/dhcp\_agent.ini DEFAULT dhcp\_driver neutron.agent.linux.dhcp.Dnsmasq
openstack-config --set /etc/neutron/dhcp\_agent.ini DEFAULT use\_namespaces True
openstack-config --set /etc/neutron/dhcp\_agent.ini DEFAULT dnsmasq\_config\_file /etc/neutron/dnsmasq-neutron.conf
vim /etc/neutron/dnsmasq-neutron.conf
#修改mtu
dhcp-option-force=26,1454
#关闭所有DNSMASQ进程
killall dnsmasq
为neutron配置metadata server
openstack-config --set /etc/neutron/metadata\_agent.ini DEFAULT auth\_url http://controller:5000/v2.0
openstack-config --set /etc/neutron/metadata\_agent.ini DEFAULT auth\_region regionOne
openstack-config --set /etc/neutron/metadata\_agent.ini DEFAULT admin\_tenant\_name service
openstack-config --set /etc/neutron/metadata\_agent.ini DEFAULT admin\_user neutron
openstack-config --set /etc/neutron/metadata\_agent.ini DEFAULT admin\_password 123
openstack-config --set /etc/neutron/metadata\_agent.ini DEFAULT nova\_metadata\_ip controller
openstack-config --set /etc/neutron/metadata\_agent.ini DEFAULT metadata\_proxy\_shared\_secret matadata
service openstack-nova-api restart
配置实例网络为gre桥接模式
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini ml2 type\_drivers gre
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini ml2 tenant\_network\_types gre
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini ml2 mechanism\_drivers openvswitch
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini ml2\_type\_gre tunnel\_id\_ranges 1:1000
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini ovs local\_ip 192.168.1.102
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini ovs tunnel\_type gre
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini ovs enable\_tunneling True
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini securitygroup firewall\_driver neutron.agent.linux.iptables\_firewall.OVSHybridIptablesFirewallDriver
openstack-config --set /etc/neutron/plugins/ml2/ml2\_conf.ini securitygroup enable\_security\_group True
service openvswitch start
chkconfig openvswitch on
配置二层虚拟网络服务
#建立内部虚拟网桥
ovs-vsctl add-br br-int
#建立外部虚拟网桥
ovs-vsctl add-br br-ex
#将外部虚拟网桥桥接到物理接口上
ovs-vsctl add-port br-ex eth0
#建立ML2软连接
ln -s plugins/ml2/ml2\_conf.ini /etc/neutron/plugin.ini
#建立服务进程
cp /etc/init.d/neutron-openvswitch-agent /etc/init.d/neutronopenvswitch-agent.orig
sed -i 's,plugins/openvswitch/ovs\_neutron\_plugin.ini,plugin.ini,g' /etc/init.d/neutron-openvswitch-agent
重启各项服务并加入开机启动
service neutron-openvswitch-agent start
chkconfig neutron-openvswitch-agent on
service neutron-l3-agent start
chkconfig neutron-l3-agent on
service neutron-dhcp-agent start
chkconfig neutron-dhcp-agent on
service neutron-metadata-agent start
chkconfig neutron-metadata-agent on
用Python来查快递
本项目利用python与快递100接口进行快递查询,如违反了相关规定请在文章下方留言,立即删除
# -*- coding:utf-8 -*-
__auther__ = 'slll.info'
__date__ = '2016-7'
#module import
import requests,json
#function
def spider(type,id):
url = 'https://www.kuaidi100.com/query?type=%s&postid=%s' %(type,id)
data = requests.get(url)
json = data.json()
if json['status'] == "200":
data_json = json['data']
print("//////////////快递详细信息//////////////")
for x in data_json:
print("%s : %s" %(x['time'],x['context']))
else:
print("错误的快递单号!")
def express_type_get():
express_type = ('shunfeng','yunda','shentong','yuantong','zhongtong','ems','tiantian','huitongkuaidi','quanfengkuaidi','youzhengguonei')
print('////////////////快递公司////////////////\n1.顺丰 2.韵达 3.申通 4.圆通 5.中通\n6.EMS 7.天天 8.汇通 9.全峰 10.邮政\n////////////////////////////////////////')
while True:
express = int(input('请选择快递公司(数字):'))
if express:
if express <= 10 and express >= 1:
break
else:
print("错误的选择!")
else:
print("不能为空!")
return express_type[express-1]
def express_id_get():
while True:
express_id = input('请输入快递单号:')
if express_id:
break
else:
print("快递单号不能为空!")
return express_id
#Mainprogram
kd = express_type_get()
kd_id = express_id_get()
spider(kd,kd_id)
</pre>
CentOS6搭建OpenStack[icehouse]计算节点
OpenStack是IaaS(基礎設施即服務)軟件,讓任何人都可以自行建立和提供雲端運算服務。此外,OpenStack也用作建立防火牆內的「私有雲」(Private Cloud),提供機構或企業內各部門共享資源。
-Wiki
这篇文章主要记录一下openstack计算节点的安装过程 Continue reading CentOS6搭建OpenStack[icehouse]计算节点
CentOS6搭建Openstack[Icehouse]控制节点
OpenStack是IaaS(基礎設施即服務)軟件,讓任何人都可以自行建立和提供雲端運算服務。此外,OpenStack也用作建立防火牆內的「私有雲」(Private Cloud),提供機構或企業內各部門共享資源。
-Wiki
好久没有更新博客了,最近事情太多了,最近按照官方文档搭建了一下openstack环境,搭成功了。
Continue reading CentOS6搭建Openstack[Icehouse]控制节点
Windows网卡叠加
以前经常在网上找网卡叠加的小软件,找过很多个,有的用不来有的没效果,偶尔找到一个能用的批处理,于是根据这个脚本自己用python写了一个修改路由表的方案,这样一来下次就不用在网上找来找去了,简单实用(水平有限,还请在座各位多多指教)。 废话不多说直接贴代码,送给需要的人
#coding:utf-8
#调用库
import sys,os,re
#函数
def pro_continue():
input("按Enter键退出")
def nic_count(x):
if x<2:
print("网络叠加需要两块或两块以上网卡")
exit()
elif x>4:
print("该程序最多支持叠加四块网卡")
exit()
def add_routetables2(i,g):
net_1=[1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223]
net_2=[2,4,6,8,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,174,176,178,180,182,184,186,188,190,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222]
print("开始负载均衡")
os.system("route delete 0.0.0.0")
os.system("route add 0.0.0.0 mask 0.0.0.0 " + str(g[0]) + " metric 30 if " + str(i[0]))
a=0
for x in net_1:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[0]) +" metric 25 if " + str(i[0]))
for x in net_2:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[1]) +" metric 25 if " + str(i[1]))
print("双网卡叠加成功")
def add_routetables3(i,g):
net_1=[1,4,7,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,130,133,136,139,142,145,148,151,154,157,160,163,166,175,178,181,184,187,190,193,196,199,202,205,208,211,214,217,220,223]
net_2=[2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,98,101,104,107,110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,176,179,182,185,188,191,194,197,200,203,206,209,212,215,218,221]
net_3=[3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,195,198,201,204,207,210,213,216,219,222]
print("开始负载均衡")
os.system("route delete 0.0.0.0")
os.system("route add 0.0.0.0 mask 0.0.0.0 " + str(g[0]) + " metric 30 if " + str(i[0]))
a=0
for x in net_1:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[0]) +" metric 25 if " + str(i[0]))
for x in net_2:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[1]) +" metric 25 if " + str(i[1]))
for x in net_3:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[2]) +" metric 25 if " + str(i[2]))
print("三网卡叠加成功")
def add_routetables4(i,g):
net_1=[1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,173,177,181,185,189,193,197,201,205,209,213,217,221]
net_2=[2,6,14,18,22,26,30,34,38,42,46,50,54,58,62,66,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,190,194,198,202,206,210,214,218,222]
net_3=[3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223]
net_4=[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,176,180,184,188,196,200,204,208,212,216,220]
print("开始负载均衡")
os.system("route delete 0.0.0.0")
os.system("route add 0.0.0.0 mask 0.0.0.0 " + str(g[0]) + " metric 30 if " + str(i[0]))
a=0
for x in net_1:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[0]) +" metric 25 if " + str(i[0]))
for x in net_2:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[1]) +" metric 25 if " + str(i[1]))
for x in net_3:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[2]) +" metric 25 if " + str(i[2]))
for x in net_4:
os.system ("route add " + str(x) + ".0.0.0 mask 255.0.0.0 "+ str(g[3]) +" metric 25 if " + str(i[3]))
print("四网卡叠加成功")
def check_ip(ip_str):
pattern = r"\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
if re.match(pattern, ip_str):
return True
else:
return False
#主程序
os.system("title 网卡叠加-www.slll.info&&color 18")
net_count=int(input("请输入网卡数量(MAX:4,Min:2): "))
nic_count(net_count)
arr_1=[]
arr_2=[]
for x in range(1,net_count+1):
temp=input("请输入第"+str(x)+"块需要叠加的网卡索引号 (cmd下面利用该命令查看:route print | find \"...\"[第一列即索引号]): ")
arr_1.append(temp)
temp=input("请输入网卡(" +str(x)+") 的网关: ")
while True:
if check_ip(temp):
arr_2.append(temp)
break
else:
temp=input("输入错误,请重新输入网卡(" +str(x)+") 的网关: ")
if net_count==2:
add_routetables2(arr_1,arr_2)
elif net_count==3:
add_routetables3(arr_1,arr_2)
elif net_count==4:
add_routetables4(arr_1,arr_2)
pro_continue()
CentOS6搭建VPN服务器
[转载]被洗脑的人常说的十句话
NO.1【你不能改变别人,只能改变自己】
适用人群:这句话对有一种人是管用的,那就是一天到晚只会嫌别人做的不好,似乎全天下都欠了他从来不反思自己是不是有问题的人。特别是那种试图让全世界都按照他们的方式运转的人。只可惜,越是这种人,喊“改变自己”喊得越响,他们是在要求别人改变来适应他们的固执。 Continue reading [转载]被洗脑的人常说的十句话
X5260超频跑象棋
X5260在华硕P43上用了好一段时间,却从来都没有作过死,昨天手痒小超了一把,发现这个U非常有潜力。
Continue reading X5260超频跑象棋
记录一次渗透过程
昨天某位大神在群里发了个链接让大家测试,记一下大概的过程
Continue reading 记录一次渗透过程
PHP防注入方法
(1)mysql_real_escape_string — 转义 SQL 语句中使用的字符串中的特殊字符,并考虑到连接的当前字符集
使用方法如下:
$sql = "select count(*) as ctr from users where username ='".mysql_real_escape_string($username)."' and password='". mysql_real_escape_string($pw)."' limit 1";
使用mysql_real_escape_string()作为用户输入的包装器,就可以避免用户输入中的任何恶意 SQL 注入。
(2) 打开magic_quotes_gpc来防止SQL注入
php.ini中有一个设置:magic_quotes_gpc = Off这个默认是关闭的,如果它打开后将自动把用户提交对sql的查询进行转换,比如把 ‘ 转为 \’等,对于防止sql注射有重大作用。如果magic_quotes_gpc=Off,则使用addslashes()函数
C#代码调用Resource.resx
网上找半天,怕脑子记不住写下来好了.
System.Resources.ResourceManager rs = new System.Resources.ResourceManager(typeof(Properties.Resources)); //建立资源对象 pictureBox1.Image = (System.Drawing.Image)rs.GetObject("img1");//获取资源图片
单臂路由配置实验
检测低版本浏览器提示用户升级浏览器.
已经有好几个月没有更新博客了,这几个月碰到的事情太多了,最近一个月接了一个PHP单子,等到客户用360浏览器测试的时候发现网站大部分javascript在IE浏览器下面都没法执行,导致首页的海报和产品展示页面的多级菜单都没法正常使用,真是苦恼。要是让这个站兼容老版本IE我都不知道还要写多少代码,计算机网络都发展多少年了,IE浏览器在国内占据着36%的市场,开发者在这个问题上绝对不能妥协,这里贴上我从其他网站上抄来的代码,供有需要的人作参考。
Continue reading 检测低版本浏览器提示用户升级浏览器.
超出DIV长度显示省略号
关键CSS代码:
white-space:nowrap; text-overflow:ellipsis; overflow: hidden;