在盒子中

很多时候,我们都知道自己容易在一个盒子中,老是用盒子的眼光看待问题。无论是在哪方面,爱、生活、工作。

我们知道坏盒子,需要除掉,不要让这个盒子囚禁你。

我们希望,我们探求,我们还没行动。

甚至我们知道了突破的方法,正要准备改变、行动了。

在盒子中,我们知道,这必须要突破。

在盒子外了

我们做出了改变,我们行动了。

我们终于除去了这个坏盒子。

在盒子外了,这样的结果,当然很好,我们成功了,这值得赞赏。

最后还是在盒子中

可是某一天,我们发现,天呀这个坏盒子怎么还是在,在影子当中。

我说真的这可能真有些沮丧,会让你仿佛觉得怎么还是没改变,甚至觉得自己做什么都是无用功。

这好像很不值得。

我们知道,我们真的知道这样的情况。这很糟糕,非常击溃人的毅力。

最牛逼的,最难能可贵的,就是你还会再一次去突破这个坏盒子。我们千万不能放弃,放弃你就真的败了。

要找回自信,要找回勇气。

最后还是在盒子中,是的,也许会是这样的结果。

最后我们还是在盒子中,有些时候也许会是个常态。

感觉这样真的挺怕的!其实这个并不可怕。

可怕的是,破罐子破摔。

真的不要这样,你自己,和你息息相关的人都是不负责的行为。

真正的勇气、牛逼,是带着最糟糕的失败、沮丧,再一次、再一次的继续突破前行。

安装iRedMail

vi /etc/sysconfig/network
#加入 HOSTNAME=mail.iamle.com
vi /etc/hosts
#加入 127.0.0.1 mail.iamle.com
hostname mail.iamle.com
wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.8.4.tar.bz2
tar xvf iRedMail-0.8.4.tar.bz2 
cd iRedMail-0.8.4
sh iRedMail.sh

卸载uninstall iRedMail
#进到iRedMail安装文件如下目录

cd /root/iRedMail-0.8.4/tools
wget http://iredmail.googlecode.com/hg/extra/clear_iredmail.sh 
sh clear_iredmail.sh

iredmail spf dkim
#配置spf
http://www.openspf.org/SPF_Record_Syntax#all

#配置dkim

amavisd showkey
#显示以下信息
#; key#1, domain mail.iamle.com, /var/lib/dkim/mail.iamle.com.pem
#dkim._domainkey.mail.iamle.com.	3600 TXT (
#  "v=DKIM1; p="
#  "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0pyMfH1M2hP1jvakdnun15lXY"
#  "zOflQsIC7T3egyMhRMquwkeLdO6AY4F4Qyi8l9yoqbFlfwkKSXwWg3KWt7XJutWB"
#  "qHeDZqUnLyHvmxTF6IumUO9tJ0/77HI2ccjmkM0Y/nyPonX+cvMvHi2nyJ3BcGo8"
#  "1bturjgk1wd57AqFuQIDAQAB")
  
#dns txt解析
dkim._domainkey.mail.iamle.com    text ="v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0pyMfH1M2hP1jvakdnun15lXYzOflQsIC7T3egyMhRMquwkeLdO6AY4F4Qyi8l9yoqbFlfwkKSXwWg3KWt7XJutWBqHeDZqUnLyHvmxTF6IumUO9tJ0/77HI2ccjmkM0Y/nyPonX+cvMvHi2nyJ3BcGo81bturjgk1wd57AqFuQIDAQAB" 
 
amavisd testkeys
#TESTING#1: dkim._domainkey.mail.iamle.com  => pass
#显示pass为成功!

今天升级QQ2013 Beta4 (3741)后,发现我搜藏几年的所有qq表情都没了!!!!

打开qq 当前qq号信息保存目录。

我的文档转移到了d盘所以在D:\Documents\Tencent Files\121901634

如果我的文档里面没有Tencent Files文件夹,那么在qq的安装目录中找找,搜索自己的qq号。

找到customface.db qq自定义表情数据库文件。

检查customface.db文件大小为100多mb,有希望!文件都还在的,但是没能识别啊!

复制customface.db一份到其他位置,用qq的表情导入功能导入表情包。

搞定,表情都又回来了。泪目!

做个记录希望能帮到人。

该脚本实现了MikroTik RouterOS 分时段封禁 封闭 禁止特定网站访问,提供一个思路,如法炮制即可。

 

# jun/11/2013 17:27:05 by RouterOS 5.20
#  www.iamle.com wwek
#  qq 121901634
# time kill web

/ip firewall filter
add action=drop chain=forward comment="kill web" disabled=no packet-mark=\
    "Kill Web mark packet"

/ip firewall mangle
add action=mark-connection chain=forward comment="web taobao.com" content=\
    taobao.com disabled=no new-connection-mark="Kill Web Conn" passthrough=\
    yes
add action=mark-connection chain=forward comment="web a.tbcdn.cn" content=\
    tbcdn.cn disabled=no new-connection-mark="Kill Web Conn" passthrough=yes
add action=mark-connection chain=forward comment="web jd.com" content=jd.com \
    disabled=no new-connection-mark="Kill Web Conn" passthrough=yes
add action=mark-packet chain=forward comment="Kill Web mark packet" \
    connection-mark="Kill Web Conn" disabled=no new-packet-mark=\
    "Kill Web mark packet" passthrough=no

/system scheduler
add disabled=no interval=3m30s name="kill web" on-event=":global nowtime  [:pi\
    ck [/system clock get time] 0 2]\r\
    \n:if (\$nowtime >= 08 && \$nowtime <= 12) do={\r\
    \n:log info [/ip firewall filter enable [/ip firewall filter find comment=\
    \"kill web\"]]\r\
    \n:log info (\"\A1\BC\BD\FB\D6\B9\CD\F8\D5\BE\D6\D0 8:00 -- 12:00\A1\BD\A3\
    \AC\CF\D6\D4\DA\CA\B1\BC\E4\A3\BA\".\$nowtime.\"\B5\E3\")}\r\
    \n:if (\$nowtime >= 12 && \$nowtime < 13) do={\r\
    \n:log info [/ip firewall filter disable [/ip firewall filter find comment\
    =\"kill web\"]]\r\
    \n:log info (\"\A1\BC\CD\F8\D5\BE\B7\C5\D0\D0\D6\D0 12:00 -- 13:00\A1\BD\
    \A3\AC\CF\D6\D4\DA\CA\B1\BC\E4\A3\BA\".\$nowtime.\"\B5\E3\")}\r\
    \n:if (\$nowtime >= 13 && \$nowtime < 17) do={\r\
    \n:log info [/ip firewall filter enable [/ip firewall filter find comment=\
    \"kill web\"]]\r\
    \n:log info (\"\A1\BC\BD\FB\D6\B9\CD\F8\D5\BE\D6\D0 13:00 -- 17:00\A1\BD\
    \A3\AC\CF\D6\D4\DA\CA\B1\BC\E4\A3\BA\".\$nowtime.\"\B5\E3\")}\r\
    \n:if (\$nowtime >=17  || \$nowtime < 08) do={\r\
    \n:log info [/ip firewall filter disable [/ip firewall filter find comment\
    =\"kill web\"]]\r\
    \n:log info (\"\A1\BC\CD\F8\D5\BE\B7\C5\D0\D0\D6\D0 17:00 -- 08:00\A1\BD\
    \A3\AC\CF\D6\D4\DA\CA\B1\BC\E4\A3\BA\".\$nowtime.\"\B5\E3\")}\r\
    \n\r\
    \n:log info (\"\A1\BC\CD\F8\D5\BE\B7\C3\CE\CA\BF\D8\D6\C6\BD\C5\B1\BE\D6\
    \B4\D0\D0\CD\EA\B1\CF\A1\BD\A3\AC\CF\D6\D4\DA\CA\B1\BC\E4\A3\BA\".\$nowtim\
    e.\"\B5\E3\")\r\
    \n" policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
    start-date=jun/11/2013 start-time=08:46:55

AutoMySQLBackup是轻量级的mysql备份工具,数据量不大,MyISAM用用很好。
 mkdir AutoMySQLBackup
cd AutoMySQLBackup/
wget -c "http://nchc.dl.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/automysqlbackup-v3.0_rc6.tar.gz"
tar zxvf automysqlbackup-v3.0_rc6.tar.gz
chmod +x install.sh
sh install.sh
#全部默认配置
cd /etc/automysqlbackup/
vi automysqlbackup.conf #修改里面的配置
crontab -e
#设定每日凌晨3:00执行
0 3 * * * /usr/local/bin/automysqlbackup
btw:这货实际上是使用的mysqldump,如果你是innodb,那么推荐用Xtrabackup,当然还非常推荐,无痛使用Percona mysql。

haproxy_install.sh
#!/bin/bash 
#install haproxy  
#20111207 by dongnan 

#variables 
dir=/usr/local 
ha_dir=${dir}/haproxy 
ha_cfg=${ha_dir}/haproxy.cfg 
kernel=`uname -r | grep '2.6'` 
pcre=$(rpm -qa | grep 'pcre' | wc -l) 
echo "$dir, $ha_dir, $ha_cfg, $kernel, $pcre" 

#check 
if [ ! "$kernel" -o "$pcre" -lt "2" ];then 
    echo -e "the script need linux 2.6 kernel and pcre pcre-devel \nyou can usage 'yum install pcre pcre-devel' or 'rpm -ivh pcre-devel-6.6-2.el5_1.7.x86_64.rpm'" 
    exit 1 
fi 

#function 

install_ha_cfg (){ 
#configure haproxy.cfg 
#default configure file for test,but need your change the frontend server and backend server ip address, 
#good luck! 

echo ' 
global 
    log 127.0.0.1   local0 
    maxconn 4096              #最大连接数 
    chroot /usr/local/haproxy #安装目录 
    uid 99                    #用户haproxy 
    gid 99                    #组haproxy 
    daemon                    #守护进程运行 
    nbproc 1                  #进程数量 
    pidfile /usr/local/haproxy/logs/haproxy.pid #haproxy pid 

defaults 
   log     global 
   mode    http               #7层 http;4层tcp  
   option  httplog            #http 日志格式 
   option  httpclose          #主动关闭http通道 
   option  redispatch         #serverId对应的服务器挂掉后,强制定向到其他健康的服务器 

   option  dontlognull 
   maxconn 2000               #最大连接数 
   contimeout      5000       #连接超时(毫秒) 
   clitimeout      50000      #客户端超时(毫秒) 
   srvtimeout      50000      #服务器超时(毫秒) 

frontend haproxy_test         #定义前端服务器(haproxy) 
        bind 10.0.1.251:80    #监听地址 
        default_backend server_pool  #指定后端服务器群 
        #errorfile 502 /usr/local/haproxy/html/maintain.html 
        #errorfile 503 /usr/local/haproxy/html/maintain.html 
        #errorfile 504 /usr/local/haproxy/html/maintain.html 

backend server_pool           #定义后端服务器群(web server/apache/nginx/iis..) 
        mode http 
        option  forwardfor    #后端服务器(apache/nginx/iis/*),从Http Header中获得客户端IP 
        #balance roundrobin    #负载均衡的方式,轮询方式 
        balance leastconn     #负载均衡的方式,最小连接 
        cookie SERVERID       #插入serverid到cookie中,serverid后面可以定义 
        option  httpchk HEAD /check.html #用来做健康检查html文档 
        server server1 10.0.1.252:80 cookie server1 check inter 2000 rise 3 fall 3 weight 3 
        server server2 10.0.1.253:80 cookie server2 check inter 2000 rise 3 fall 3 maxconn 120 weight 3 
        server server3 10.0.1.254:80 cookie server3 check maxconn 90 rise 2 fall 3 weight 3 
#服务器定义: 
#cookie server1表示serverid为server1; 
#check inter 2000 是检测心跳频率(check 默认 ); 
#rise 3 表示 3次正确认为服务器可用; 
#fall 3 表示 3次失败认为服务器不可用; 
#weight 表示权重。 

listen admin_stat                   #status 
    bind *:8080                     #监听端口 
    mode http                       #http的7层模式 
    stats refresh 30s               #统计页面自动刷新时间 
    stats uri /haproxy-stats        #统计页面URL 
    stats realm Haproxy\ Statistics #统计页面密码框上提示文本 
    stats auth admin:admin          #统计页面用户名和密码设置 
    stats hide-version              #隐藏统计页面上HAProxy的版本信息 
    stats admin if TRUE             #手工启用/禁用,后端服务器 
' > "$ha_cfg" && sed -i '1 d' "$ha_cfg" 
} 

#install 
if [ ! -e "$ha_dir" ];then 
   tar zxf haproxy*.tar.gz 
   cd haproxy*/ 
   make TARGET=linux26 USE_STATIC_PCRE=1 PREFIX=/usr/local/haproxy && make install PREFIX=/usr/local/haproxy && mkdir /usr/local/haproxy/{html,logs} 
   cd ../ 
# 
   if [ ! -e "$ha_dir" ];then 
       echo "error! can't install haproxy  please check ! Will now out of the script !" 
       exit 1 
   else 
       ! grep 'haproxy' /etc/syslog.conf && echo 'local1.*            /var/log/haproxy.log' >> /etc/syslog.conf 
       sed -ir 's/SYSLOGD_OPTIONS="-m 0"/SYSLOGD_OPTIONS="-r -m 0"/g' /etc/sysconfig/syslog && /etc/init.d/syslog restart 
       install_ha_cfg 
       rm -rf haproxy*/ 
   fi 
else 
   echo "haproxy is already exists!" 
fi 

haproxy.sh

# cat /usr/local/sbin/haproxy.sh  
#!/bin/bash 
#haproxy command  
#ver:0.1bate 
#20111129 by dongnan 

#/usr/local/haproxy/sbin/haproxy  
#HA-Proxy version 1.4.18 2011/09/16 
#Copyright 2000-2011 Willy Tarreau <w@1wt.eu> 
# 
#Usage : haproxy [-f <cfgfile>]* [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ] 
#        [ -p <pidfile> ] [ -m <max megs> ] 
#        -v displays version ; -vv shows known build options. 
#        -d enters debug mode ; -db only disables background mode. 
#        -V enters verbose mode (disables quiet mode) 
#        -D goes daemon 
#        -q quiet mode : don't display messages 
#        -c check mode : only check config files and exit 
#        -n sets the maximum total # of connections (2000) 
#        -m limits the usable amount of memory (in MB) 
#        -N sets the default, per-proxy maximum # of connections (2000) 
#        -p writes pids of all children to this file 
#        -de disables epoll() usage even when available 
#        -ds disables speculative epoll() usage even when available 
#        -dp disables poll() usage even when available 
#        -sf/-st [pid ]* finishes/terminates old pids. Must be last arguments. 

#variables 
haproxy_dir=/usr/local/haproxy/ 
haproxy_conf=${haproxy_dir}haproxy.cfg 
haproxy_pid=${haproxy_dir}logs/haproxy.pid 
haproxy_cmd=${haproxy_dir}sbin/haproxy 
#test variables 
#file $haproxy_dir; file $haproxy_conf; file $haproxy_cmd; file $haproxy_pid 

if [ "$#" -eq "0" ];then 
    echo "usage: $0 {start|stop|restart}" 
    exit 1 
fi 

if [ "$1" = "start" ];then 
#echo $1 
    $haproxy_cmd -f $haproxy_conf 
elif [ "$1" = "stop" ];then 
#echo $1 
    kill `cat $haproxy_pid` 
elif [ "$1" = "restart" ];then 
#echo $1 
    $haproxy_cmd -f $haproxy_conf -st `cat $haproxy_pid` 

else 
   echo "usage: $0 arguments only start and stop or restart !" 
fi