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 python | |
# -*- coding: utf-8 -*- | |
# FileName : aes_python.py | |
# must install the pycrypto at frist, cmd: pip install pycrypto | |
import hashlib | |
from Crypto.Cipher import AES | |
import base64 |
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 python | |
# -*- coding: utf-8 -*- | |
# FileName : redistools.py | |
# Author : wuqingfeng@ | |
from functools import wraps | |
try: | |
import cPickle as pickle | |
except ImportError: | |
import pickle |
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
@startuml Basic Sample | |
!include <awslib/AWSCommon> | |
!includeurl https://raw.githubusercontent.com/RicardoNiepel/C4-PlantUML/release/1-0/C4_Container.puml | |
' Uncomment the following line to create simplified view | |
' !include <awslib/AWSSimplified> | |
!include <awslib/General/all> | |
!include <awslib/NetworkingAndContentDelivery/all> |
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
this_max = min(sample["this"], sample["this"] * sample["max"] / sample["total"] + 1) | |
sample_a = 1 | |
if this_max > 1: | |
sample_b = math.log(sample["this"]) / math.log(this_max) | |
else: | |
sample_b = 1 | |
sample_target = int(sample_a * ((line_num + 1) ** sample_b) + 0.5) # line_no >= sample_target | |
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/sh | |
### BEGIN INIT INFO | |
# Provides: apache2 | |
# Required-Start: $local_fs $remote_fs $network $syslog $named | |
# Required-Stop: $local_fs $remote_fs $network $syslog $named | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# X-Interactive: true | |
# Short-Description: Start/stop apache2 web server | |
# Description: Start the web server and associated helpers |
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/sh | |
# | |
# Startup script for program | |
# | |
# chkconfig: 345 85 15 - start or stop process definition within the boot process | |
# description: Description of program | |
# processname: process-name | |
# pidfile: /var/run/process-name.pid | |
# Source function library. This creates the operating environment for the process to be started |
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
import sys | |
import socket | |
from zipfile import ZipFile | |
import logging | |
from datetime import datetime | |
import os | |
import shutil | |
import subprocess | |
import glob | |
import pwd |
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 -*- | |
import os | |
import time | |
import commands | |
import sys | |
class Pinger(): | |
STYLE = { |
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
# Check if user is root | |
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; } | |
# Check if wget installed | |
if [ ! -e '/usr/bin/wget' ]; then | |
echo "Error: wget command not found. You must be install wget command at first." | |
exit 1 | |
fi | |
# read -p "请输入你的服务器提供商: " Provider |
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/bash | |
# $1 -> rpmdir $2 -> id | |
set -e | |
array=() | |
i=1 | |
#change dir to destdir | |
cd `pwd`/$1 |