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
#!/bin/bash | |
# manage /etc/hosts | |
isIp() { | |
# test variable is an ip address or not | |
# true: return 0 | |
# false: return 1 | |
local ip=$1 | |
local stat=1 | |
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | |
OIFS=$IFS |
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
#!/bin/sh | |
[ -z $1 ] || dig +nocmd +noall +answer +stats $@ | grep 'IN\|Query time' | sed 's/;; Query time://' | sed ';N;s/\n//' |
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
#include <assert.h> | |
#include <errno.h> | |
#include <fstab.h> | |
#include <inttypes.h> | |
#include <malloc.h> | |
#include <mntent.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/quota.h> |
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
#!/bin/bash | |
usage(){ | |
echo "usage: $0 <addrec> <view> <zone> <domain> <type> <value> <mxpr> <ttl>" | |
echo "usage: $0 <delrec> <view> <zone> <domain> [type] [value] [mxpr] [ttl]" | |
exit 1 | |
} | |
DEBUG() { | |
if [[ $DEBUG = true ]]; then | |
"$@" |
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
virsh pool-define-as default dir - - - - /var/lib/libvirt/images | |
virsh pool-build default | |
virsh pool-start default | |
virsh pool-autostart default | |
virsh pool-list |
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 | |
# -*- coding: utf-8 -*- | |
import time, os, socket | |
import json | |
metric = ['usr', 'nice', 'sys', 'idle', 'iowait', 'irq', 'soft', 'steal', 'guest'] | |
host = socket.gethostname() | |
def get_cpu_core_stat(num): |
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
Name: falcon-agent | |
Version: 0.4 | |
Release: 1%{?dist} | |
Summary: falcon-agent | |
Group: system/daemon | |
License: GPL | |
URL: http://open-falcon.com/ | |
Source0: http://open-falcon.com/download/%{name}-%{version}.tar.gz | |
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) |
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
#!/bin/bash | |
# send named metrics to falcon-agent | |
RNDC_BIN=/usr/sbin/rndc | |
STATS='/var/named/data/named_stats.txt' | |
rm -f $STATS | |
if ! $RNDC_BIN stats; then | |
exit 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
set nocompatible "关闭vi兼容 | |
set enc=utf-8 | |
"set number "显示行号 | |
filetype plugin on "文件类型 | |
set history=500 "历史命令 | |
syntax on "语法高亮 | |
"set autoindent "ai 自动缩进 | |
"set smartindent "智能缩进 | |
set showmatch "括号匹配 | |
set ruler "右下角显示光标状态行 |
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
http://stackoverflow.com/questions/12671587/isolated-test-network-on-a-linux-server-running-a-web-server-lightttpd-and-cu | |
https://code.google.com/p/coreemu/ | |
http://stuff.onse.fi/man?program=ip-netns§ion=8 | |
http://blog.kghost.info/2013/03/01/linux-network-emulator/ | |
http://blog.kghost.info/2013/03/27/linux-network-tun/ | |
http://seravo.fi/2012/virtualized-bridged-networking-with-macvtap | |
http://blog.csdn.net/kl222/article/details/8513593 |