This file contains hidden or 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 | |
disk="sda sdb sdc" | |
for i in $disk | |
do | |
j="/dev/${i}" |
This file contains hidden or 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 | |
# 有两种权限: | |
# 1. 允许访问外网 WEB 端口(80, 443, 8080), 把 IP 加到 wl_web_ip 即可. | |
# 2. 允许访问外网所有流量, 基于 wl_all_ip, 把 IP 加到 wl_all_ip 即可. | |
iptables -F FORWARD | |
iptables -F BLOCK | |
iptables -F MON |
This file contains hidden or 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/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import MySQLdb | |
class MysqlConn(object): | |
def __init__(self, host, port, user, passwd, db=None): |
This file contains hidden or 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/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import re | |
import time | |
import json | |
from urllib import urlencode | |
from io import BytesIO |
This file contains hidden or 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/python | |
# -*- coding: utf-8 -*- | |
""" | |
@author: [email protected] | |
@date: 2016-12-12 | |
抓取机器到另外一个机房的出入流量,并格式化输出. 包括到另外机房的每个ip的流量。 | |
iftop 要使用较高的版本. centos 中建议 1.0pre4 以上. | |
""" | |
import subprocess | |
import socket |
This file contains hidden or 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
# lib/puppet/parser/functions/pw_hash.rb | |
module Puppet::Parser::Functions | |
newfunction(:pw_hash, type: :rvalue) do |args| | |
raise Puppet::ParseError, "pw_hash takes exactly two arguments, #{args.length} provided" if args.length != 2 | |
# SHA512 ($6), default number of rounds (5000) | |
# rounds could be specified by prepending rounds=<n>$ parameter before the salt, i.e. | |
# args[0].crypt("$6$rounds=50000$#{args[1]}") | |
args[0].crypt("$6$#{args[1]}") | |
end |
This file contains hidden or 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 | |
key_word="USB|usb|eth1|CPU|time|softirq|CD-ROM|IPMI|ipmi|tcpdump|flooding|debugging|ffffffff|UDP|cf_|wzp" | |
if [ -f "/var/log/message" ];then | |
log_time=`date -r /var/log/message +%s` | |
real_time=`date +%s` | |
diff_time=`expr $real_time - $log_time` | |
if [ $diff_time -lt 60 ];then |
This file contains hidden or 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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"os/exec" | |
"time" | |
) | |
func run(timeout int, command string, args ...string) string { |
This file contains hidden or 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 sh | |
### Download and install megaraidcli for Ubuntu; | |
FILE="megacli_8.07.14.orig.tar.gz" | |
LINK="http://hwraid.le-vert.net/ubuntu/sources/$FILE" | |
wget $LINK -O /tmp/$FILE | |
cd /tmp |
This file contains hidden or 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 | |
cfssl gencert -initca ca-csr.json | cfssljson -bare ca - | |
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server server.json | cfssljson -bare server | |
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=peer member.json | cfssljson -bare member |