Blog

  • x200按开机键整整十分钟才开始正式开机

    过年的时候就出现这个问题了,当时没用具体计算是多长时间,应该是windows系统升级后电脑的安全芯片保护的问题。

    方法一:冬天的时候,从网上没有细搜,说是拆机拨bios电池可解决

    于是每次出问题都是拨电池放电,装电池,设置时间

    233

    说话间到了4月份,又出现了这个问题,这次算准了是正好十分钟,所以在谷歌里搜关键字:x200  十分钟。

    网上查到了方法2和方法3:

    方法2:降级bios,我个人觉得没有必要而且没找到网友说的2.06的bios,这里是给出的下载地址http://support.lenovo.com/en_US/detail.page?LegacyDocID=MIGR-70347

    方法3:设置bios后,两天来没出现过这个毛病,操作如下

    进入 Security
    将 Security Chip 设置为 Active
    将 Intel(R) TXT Feature 设置为 Enabled

    :)EOT

  • grep, sed 结合查找替换某目录下所有文件

    查找:

    grep “要找的字符串” -rl 目录,例如

    grep -rl "hello.world"  .

    替换:sed -i “s/要查找的字符串/替换字符串/g” `grep “要查找的字符串” -rl 目录`,例如

    sed -i "s/friends/girls/g" `grep -rl "hello.world"  .`

    注意:

    替换中的 grep 命令要被 TAB 键上边的那个引号(反引号)包起来

    例二:

    清理配置文件中的注释,即 # 开头的
    查看注释开头有注释的行

    grep -rn '^\s*#' nginx.conf

    显示有注释开头的文件

    grep -rl '^\s*#' .

    删除包含有注释开头的行

    sed -i "/^\s*#/d" `grep -rl '^\s*#' .`
  • windows下新建.htaccess文件

    创建.htaccess文件时,提示必须键入文件名

    .htaccess应该是linux下面的写法

    方法一:

     1、新建一个a.htaccess文件
     2、复制下面的内容
     @ren "%~f1" .*
     保存为b.bat文件
     把a.htaccess拖到b.bat文件图标上可以去掉文件名而只保留后缀
     a.htaccess就变成了.htaccess

    方法二:

     开始
     运行
     cmd
     type nul>.htaccess
  • 默认主题Twenty Eleven 1.3的blockquote,pre标签

    修改wordpress主题的style.css文件

    找到blockquote { ** } 并注释掉

    /*注释掉
    blockquote {
     font-family: Georgia, "Bitstream Charter", serif;
     font-style: italic;
     font-weight: normal;
     margin: 0 3em;
    }
    */

    替换为

    blockquote { 
     font-family: 微软雅黑,Georgia, "Bitstream Charter", serif;
     font-weight: normal;
     border-left: 4px solid #ccc;
     margin: 0 1em;
    }

    同理pre替换为

    pre {
     background: #f4f4f4;
     font: 13px "Courier 10 Pitch", Courier, monospace;
     line-height: 1.5;
     margin-bottom: 1.625em;
     overflow: auto;
     padding: 0.75em 1.625em;
    }

    2012年10月添加code样式

    code {
        background: none repeat scroll 0 0 #FFFFFF;
        border: 1px solid #DDDDDD;
        border-radius: 0.4em 0.4em 0.4em 0.4em;
        color: #555555;
        display: inline-block;
        font-size: 0.8em;
        line-height: 1.5em;
        margin: -1px 0;
        padding: 0 0.3em;
    }

     

  • 代理服务器与 NAT 主机的差异

    以下内容来自鸟哥的linux私房菜

    或许您已经发现了一件事,那就是:在内部局域网络使用私有 IP 的 Client 端不论透过 Proxy 或者 NAT 均可以直接取得 WWW 这个 Internet 的服务,那么 NAT 与 Proxy 有没有什么不同的地方啊?他们不都是可以让内部的 Client 连接出去吗?其实这两个玩意儿差异性是『相当大』的:

    * NAT 是一个利用 TCP/IP 的 packet filter ( 封包过滤机制 )来进行封包处理的一个机制,所以他是『直接分析 TCP/IP 』,所以在设定防火墙的时候,他的弹性比较高,只要能过 NAT 这一关,那么大部分的网络服务都可以使用,因为 TCP/IP 是比较底层的协议啊!要知道的是,TCP/IP 上头还有 port 、还有 IP 等等的信息,单是 port 就可以让我们使用很多的不同的协议了!例如 port 20, 21 是 FTP 啊, 80 是 WWW 啊等等的!所以 NAT 能做的事情事很多的!

    * 至于 Proxy 就不一样了, Proxy 主要透过类似 Squid 这一类的软件来达成的一个服务,基本上,一般来说他是透过 port 3128 来进行数据的监听与传输,单是看到这个 port 3128 就应该要晓得他仅是一个 daemon 而已。Proxy 已经是应用层这个阶段的网络项目了,所以他并没有去分析 TCP 的封包,只要 Client 来源合乎他的需求 (例如 IP 是被支持的 ) ,那么他将透过 daemon 的功能帮使用者达成使用者所想要的任务!所以说,能不能做某些事情,与 Proxy 服务器上面负责的那个 daemon 是有关的!万一 daemon 无法进行 FTP 数据的取得,那么您再怎么努力的尝试上网也是枉然的啊!
    这样说有没有比较有点概念了呢?NAT 是由较底层的网络去进行分析的工作,至于通过 NAT 的封包是干嘛用的, NAT 不去管他!至于 proxy 则主要是由一个 daemon 的功能达成的,所以必需要符合该 daemon 的需求,才能达到某些功能!

    谈完了这些基本的原理之后,我们可得来玩一玩 Proxy 了吧?!事实上,目前有很多的 Proxy 软件,例如 apache 也有提供 proxy 模块的功能喔!但是,最好不要用 Apache 当作您的 Proxy server ,因为…..效能真的太差了~会让您的网络停顿的更厉害~目前 Proxy 的服务器软件当中,以 squid 这个咚咚最出名,会出名的原因是因为他的效能高!真的很不错的一套软件,所以底下我们就针对 squid 来做说明吧!

    通过学习Linux iptables Pocket Reference这本书,对NAT有更进一步了解。

    NAT也就是当包通过本机时,包的地址和/或端口的修改。这个修改可以是包的来源或目的地,也可以是介于之间。

    NAT需要connection tracking,而这又需要包是全可见的。如果防火墙包含着多个电脑,注意不要破坏connection tracking.

    NAT可用于基于地址和端口的操作的一系列功能,同时可以以组来操作

     

  • 不把svn认证保存在本机

    Caching passwords on disk?That’s terrible!You should never do that!”Subversion

    开发者认识到这种担心的合理性,所以 Subversion 使用操作系统和环境提供的机制来减少泄露这些信息的风险。

    下面是在大多数平台上的做法:

    windows平台:

    On Windows,the Subversion client stores passwords in the %APPDATA%/Subversion/auth/ directory.

    On Windows 2000 and later,the standard Windows cryptography services are used toencrypt the password on disk.Because the encryption key is managed by Windows and is tied tothe user’s own login credentials,only the user can decrypt the cached password.(Note that if the user’s Windows account password is reset by an administrator,all of the cached passwords becomeundecipherable.The Subversion client will behave as though they don’t exist,prompting forpasswords when required.)

    Mac OS平台:

    Similarly,on Mac OS X,the Subversion client stores all repository passwords in the login keyring(managed by the Keychain service),which is protected by the user’s account password.Userpreference settings can impose additional policies,such as requiring that the user’s account passwordbe entered each time the Subversion password is used.

    类unix平台:

    For other Unix-like operating systems,no standard “keychain”services exist.However,the Subversionclient knows how to store password securely using the “GNOME Keyring”and “KDE Wallet”services.Also,before storing unencrypted passwords in the ~/.subversion/auth/caching area,theSubversion client will ask the user for permission to do so.Note that the auth/caching area is stillpermission-protected so that only the user (owner)can read data from it,not the world at large.The operating system’s own file permissions protect the passwords from other non-administrativeusers on the same system,provided they have no direct physical access to the storage media of thehome directory,or backups thereof.Of course,for the truly paranoid,none of these mechanisms meets the test of perfection.So forthose folks willing to sacrifice convenience for the ultimate in security,Subversion provides variousways of disabling its credentials caching system altogether.

    你可以关闭凭证缓存,只需要一个简单的命令,使用参数–no-auth-cache:

    $svn commit -F log_msg.txt –no-auth-cacheAuthentication realm:<svn://host.example.com:3690>example realmUsername:joePassword for ‘joe’:Adding newfileTransmitting file data .

    通过配置文件禁用:
    Or,if you want to disable credential caching permanently,you can edit the config file in yourruntime configuration area and set the store-auth-creds option to no.This will prevent thestoring of credentials used in any Subversion interactions you perform on the affected computer.Thiscan be extended to cover all users on the computer,too,by modifying the system-wide runtimeconfiguration area (described in 第 1.1 节 “配置区布局”).

    [auth]store-auth-creds =no