分类 [ 技术 ] 下的文章:

修改RedHat/CentOS系统时区

时区文件目录:

$ ls /usr/share/zoneinfo/
Africa      Asia       Canada   Cuba   EST      GB       GMT-0      
America     Atlantic   CET      EET    EST5EDT  GB-Eire  GMT+0      
Antarctica  Australia  Chile    Egypt  Etc      GMT      Greenwich  
Arctic      Brazil     CST6CDT  Eire   Europe   GMT0     Hongkong   
HST      iso3166.tab  Kwajalein  MST      NZ-CHAT   posix       
Iceland  Israel       Libya      MST7MDT  Pacific   posixrules  
Indian   Jamaica      MET        Navajo   Poland    PRC         
Iran     Japan        Mexico     NZ       Portugal  PST8PDT     
right    Turkey       UTC        Zulu     ROC       UCT        
WETStep2ROK           Universal  W-SUSingapore    US   zone.tab1

修改时区

$ sudo ln -s /usr/share/zoneinfo/EST /etc/localtime -f

保存

$ sudo hwclock --systohc

为RedHat/Centos 7添加Windows7引导程序

由于安装redhat/centos7无法选择boot分区,所以安装完后会丢失原有的windows7系统引导,解决方法如下:

编辑文件/boot/grub2/grub.cfg,添加以下内容:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-WIN7UUID' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

WIN7UUID替换为win7系统分区的UUID。
hd0需按照实际修改。

RedHat/CentOS 7下修改网卡的设备名

该方法适用于物理机上的系统,同时也适用于kvm等虚拟机上安装的系统。
需要修改的文件/lib/udev/rules.d/60-net.rules

#刚装完的系统应该只有下面一句话
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="1", PROGRAM="/lib/udev/rename_device", RESULT=="?*", NAME="$result"

阅读全文>>

代码高亮测试

java code

package om.cmd.usr.define;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TestCmd {
    public static void main(String[] args){
        String cmd = "om wait 10s";
        if ( cmd.matches( "om .*")) {
            if ( cmd.matches( "om wait .*")) {
                Pattern p=Pattern. compile("(?<=om wait )([0-9]*)(?=s)");
                Matcher m= p.matcher( cmd);
                while( m.find()){
                    // result : 10
                    System. out.println( "result: " + m.group());
                }
                System. out.println( "over");
            }
        }
    }
}
# end

c code

#include <stdio.sh>

void main(char * args){
    printf("hello world : %s","zhouzhiping");
}
// end

bash code

#!/bin/bash
for line in `ls`
do
    echo "$line"
done

python code

import os

Class Test():
    def __init__(self):
        pass

    def test(self):
        print "hello world"

结束!