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 | |
# Get CPU (core number) and memory by instance_type | |
# usage: python instance.py (INSANCE_TYPE|VCPU MEMORY) | |
import json | |
import sys | |
import urllib2 | |
JSON_URL = 'https://raw.githubusercontent.com/powdahound/ec2instances.info/master/www/instances.json' |
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 | |
# vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 smarttab textwidth=78 | |
# | |
# Upload a torrent file and create a BitTorrent task | |
# Usage: python 115wangpan-up.py TORRENT_FILE | |
from __future__ import print_function | |
import sys | |
from u115 import API |
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 | |
# This script checks nginx error log for "upstream timed out" events | |
# Update $last_num variable to the latest error number after you fixed the issue | |
last_num=75305 | |
log_file=/var/log/nginx/error.log | |
[ -f "$log_file" ] || { echo "WARNING - error log does not exist: $log_file"; exit 1; } | |
current_num=$(grep 'upstream timed out' "$log_file" | tail -1 | awk ' { print $5 }' | tr -d '*') | |
# If $current_num is not empty string and larger than $last_num, then we get an error | |
[ -n "$current_num" ] && [ "$current_num" -gt $last_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
apt-get install nagios-nrpe-server nagios-plugins |
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
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.key |
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 | |
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm | |
yum install -y yum-plugin-replace | |
yum replace -y php-common --replace-with=php55w-common |
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: | |
# First, source this script: | |
# $ source add_public_key.sh | |
# Then, use the function add user: | |
# $ add_public_key john 'ssh-rsa very-long-hash' | |
add_public_key() | |
{ |
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 | |
# | |
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN | |
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise). | |
# With minor modifications, this script *can also be used* on dedicated servers | |
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers. | |
# | |
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN | |
# YOUR AMAZON EC2 INSTANCE STARTS! | |
# |
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 | |
# | |
# Author : N.Hashimoto | |
# E-mail : mrhashnao@gmail.com | |
# Description : Verify node joining cassandra multinode cluster, and | |
# send alert if the number of live node is less than the specified number. | |
# | |
# ------------------------------------------------------------ | |
# functions | |
# ------------------------------------------------------------ |
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 | |
# Setup Nagios NRPE on Amazon EC2 (Ubuntu) | |
apt-get update | |
apt-get install -y nagios-nrpe-server nagios-plugins | |
sleep 2 | |
mkdir -p /etc/nagios | |
cat > /etc/nagios/nrpe_local.cfg <<EOF |