海运的博客

Percona和HandlerSocket

发布时间:July 19, 2014 // 分类:NoSQL // No Comments

rpm -ivh http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.i386.rpm
rpm -ivh http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
yum install Percona-Server-server-55

配置:

[mysqld]
plugin-load=handlersocket.so 
loose_handlersocket_port = 9998 
loose_handlersocket_port_wr = 9999
loose_handlersocket_threads = 16
loose_handlersocket_threads_wr = 1 
open_files_limit = 65535 

退弹代码

发布时间:July 7, 2014 // 分类: // No Comments

<script type="text/javascript">
var is_asked = false;

window.onbeforeunload = 
  function (ev) {
  var e = ev || window.event;
  window.focus();
  if (!is_asked){
    is_asked = true;
    var showstr = '*****\n\nW A I T ...\n\n****';
    if (e) {  //for ie and firefox
      e.returnValue = showstr; 
    }
    return showstr; //for safari and chrome
  }
};

window.onfocus =
  function (ev){
  if (is_asked){
    window.location.href =  'http://'+window.location.host;;
  }
}
</script>

添加缓存HEAD

发布时间:July 7, 2014 // 分类:PHP // No Comments

<?php
$cachetime = (60*60*24*30);
header('Cache-Control: public, max-age='.$cachetime);
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT' );
header('Expires: '.gmdate('D, d M Y H:i:s', time() + $cachetime). ' GMT');
?>

OpenVZ VPS添加HE IPV6 Tunnel

发布时间:July 3, 2014 // 分类:网络工具 // No Comments

VPS需开启TUN/TAP:

wget http://tb-tun.googlecode.com/files/tb-tun_r18.tar.gz
tar xvf tb-tun_r18.tar.gz
yum install gcc
tar xvf tb-tun_r18.tar.gz
gcc tb_userspace.c -l pthread -o tb_userspace
mv tb_userspace /usr/bin/
setsid tb_userspace he-ipv6 <server-ip> <local-ip> sit > /dev/null
ip link set he-ipv6 up
ip addr add 2001:470::2/64 dev he-ipv6
ip route add ::/0 dev he-ipv6

添加多个IP:

for ip in {1..100}; do ip addr add 2001:470:1f07:26a::$ip/64 dev he-ipv6; done

添加随机IP:

#!/bin/sh
MAXCOUNT=100
count=0
network_v6=2001:470:1f07:26a

rnd_ipv6_block () {
  #HEX="tr -dc "[:xdigit:]" < /dev/urandom | head -c 16 | sed 's/..../:&/g'"
  HEX="openssl rand -hex 8 | sed 's/..../:&/g'"
  ipv6=$network_v6$(eval $HEX);
}

echo "$MAXCOUNT 个IPv6:"
echo "-----------------"

while [ $count -lt $MAXCOUNT ]
do
  count=`expr $count + 1`
  rnd_ipv6_block
  echo $ipv6
  ip addr add $ipv6/64 dev he-ipv6
done

PHP生成随机IPV6:

<?php
$prefix = '2001:470:1f07:26a';
$str = substr(md5(rand()), 16);
$addr = $prefix . ':' . implode(':', str_split($str, 4));
echo $addr;
分类
最新文章
最近回复
  • opnfense: 谢谢博主!!!解决问题了!!!我之前一直以为内置的odhcp6就是唯一管理ipv6的方式
  • liyk: 这个方法获取的IPv6大概20分钟之后就会失效,默认路由先消失,然后Global IPV6再消失
  • 海运: 不好意思,没有。
  • zongboa: 您好,請問一下有immortalwrt設定guest Wi-Fi的GUI教學嗎?感謝您。
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...