This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
先说下假设的两个网络环境: | |
dhcp 网段:192.168.10.0/24 | |
固定ip 网段:192.168.20.0/24 网关:192.168.20.254 DNS:192.168.20.254和202.100.64.68 指定ip:192.168.20.2 | |
在修改 /etc 下conf前先来用命令 ficonfig route ping 来配置临时的网络参数做测试 | |
假设配置这样的两网卡 eth0 dhcp / eth1 指定固定ip上网 | |
#ifconfig eth0 up | |
#dhcpcd eth0 | |
#ifconfig eth0 //查看eth0运行情况 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
import socket | |
import string | |
# windows only | |
import msvcrt | |
if len(sys.argv) != 3: | |
print "usage: %s target_ip target_port" %(os.path.split(sys.argv[0])[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Lunar { | |
var $MIN_YEAR = 1891; | |
var $MAX_YEAR = 2100; | |
var $lunarInfo = array( | |
array(0,2,9,21936),array(6,1,30,9656),array(0,2,17,9584),array(0,2,6,21168),array(5,1,26,43344),array(0,2,13,59728), | |
array(0,2,2,27296),array(3,1,22,44368),array(0,2,10,43856),array(8,1,30,19304),array(0,2,19,19168),array(0,2,8,42352), | |
array(5,1,29,21096),array(0,2,16,53856),array(0,2,4,55632),array(4,1,25,27304),array(0,2,13,22176),array(0,2,2,39632), | |
array(2,1,22,19176),array(0,2,10,19168),array(6,1,30,42200),array(0,2,18,42192),array(0,2,6,53840),array(5,1,26,54568), | |
array(0,2,14,46400),array(0,2,3,54944),array(2,1,23,38608),array(0,2,11,38320),array(7,2,1,18872),array(0,2,20,18800), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (C) 2009-2010 Yichuan, Fuchun All rights reserved. | |
* 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 | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//<INPUT TYPE="file" NAME="file" onchange="getFileSizeAndType(this)"/> | |
function getFileSizeAndType(obj){ | |
var maxSize= 1024 * 1024 *2; | |
var objValue = obj.value; | |
if (objValue=="") return false; | |
var pos = objValue.lastIndexOf("."); | |
var lastname = objValue.substring(pos,objValue.length); | |
if (lastname.toLowerCase()!=".jpg" && lastname.toLowerCase()!=".gif" && lastname.toLowerCase()!=".png" && lastname.toLowerCase()!=".jpeg") | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var json = $.parseJSON(data); //jquery直接支持 | |
var json = JSON.parse(data); //jquery直接支持 | |
var json = eval ("(" + data + ")"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("input").keypress(function (e) { | |
var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode; | |
if (keyCode == 13){ | |
var i; | |
for (i = 0; i < this.form.elements.length; i++) | |
if (this == this.form.elements[i]) | |
break; | |
i = (i + 1) % this.form.elements.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Form</h2> | |
<form action="" method="post"> | |
First Name:<input type="text" name="Fname" maxlength="12" size="12"/> <br/> | |
Last Name:<input type="text" name="Lname" maxlength="36" size="12"/> <br/> | |
Gender:<br/> | |
Male:<input type="radio" name="gender" value="Male"/><br/> | |
Female:<input type="radio" name="gender" value="Female"/><br/> | |
Favorite Food:<br/> | |
Steak:<input type="checkbox" name="food[]" value="Steak"/><br/> | |
Pizza:<input type="checkbox" name="food[]" value="Pizza"/><br/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*目前加载一个png格式的图片,做一些绘图工作,发现ImageIO.write存储png性能较差,转为存储jpg格式图片,性能可以提高6,7倍。 | |
*/ | |
package test; | |
import java.awt.Color; | |
import java.awt.Font; | |
import java.awt.Graphics2D; | |
import java.awt.RenderingHints; |
OlderNewer