Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

wateer tawateer

View GitHub Profile
@tawateer
tawateer / README.md
Last active Mar 26, 2019
根据网段和掩码计算起始 IP 和终止 IP
View README.md

下载 ip.py 到本机, 执行 python ip.py 网段 掩码

> python ip.py 111.10.40.128 255.255.255.192

 111.10.40.128 111.10.40.191

输出即是起始和终止 IP。

@tawateer
tawateer / ip_laiyuan.py
Created Mar 21, 2019
写 excel 相关操作
View ip_laiyuan.py
#!/bin/env python
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from IPy import IP
import xlwt
@tawateer
tawateer / ip.py
Last active Feb 19, 2019
根据网段和掩码查询起始和结束 IP
View ip.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from IPy import IP
file_path = "/Users/wateer/Downloads/1"
"""
file content like this:
183.232.67.128 255.255.255.240
183.232.76.98 255.255.255.248
View gen_etcd_cert.sh
#!/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
View gist:9f4d653cde49fe05e1b75ff287658006
#!/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
@tawateer
tawateer / cmdtimeout.go
Created Jun 16, 2017 — forked from scottcagno/cmdtimeout.go
Golang exec.Command Timeout Wrapper
View cmdtimeout.go
package main
import (
"bytes"
"fmt"
"os/exec"
"time"
)
func run(timeout int, command string, args ...string) string {
@tawateer
tawateer / filter_log.sh
Created Dec 20, 2016
过滤系统日志
View filter_log.sh
#!/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
@tawateer
tawateer / 0_pw_hash.rb
Created Dec 14, 2016 — forked from pschyska/0_pw_hash.rb
PW hashing with puppet parser function
View 0_pw_hash.rb
# 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
@tawateer
tawateer / iftop.py
Last active Dec 13, 2016 — forked from zhouqiang-cl/iftop.py
在机器上抓取到另一个网段的出入流量,基于 iftop,输出是 open-falcon 的数据收集格式。
View iftop.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
@author: zhouqiang-cl@gmail.com
@date: 2016-12-12
抓取机器到另外一个机房的出入流量,并格式化输出. 包括到另外机房的每个ip的流量。
iftop 要使用较高的版本. centos 中建议 1.0pre4 以上.
"""
import subprocess
import socket
@tawateer
tawateer / http_base_for_openfalcon.py
Created Dec 13, 2016
http montior base for openfalcon
View http_base_for_openfalcon.py
#!/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import time
import json
from urllib import urlencode
from io import BytesIO
You can’t perform that action at this time.