Skip to content

Instantly share code, notes, and snippets.

View mungi's full-sized avatar

Mungi mungi

  • SK Holdings
  • Korea
View GitHub Profile
@mungi
mungi / gist:a4e16e183d705e3e0313
Created January 12, 2015 15:57
Connecting to DynamoDB Local from boto
# http://sebastiandahlgren.se/2014/06/27/connecting-to-dynamodb-local-from-boto/
from boto.dynamodb2.layer1 import DynamoDBConnection
connection = DynamoDBConnection(
aws_access_key_id='foo', # Dummy access key
aws_secret_access_key='bar', # Dummy secret key
host='localhost', # Host where DynamoDB Local resides
port=8000, # DynamoDB Local port (8000 is the default)
is_secure=False) # Disable secure connections
#!/bin/bash
EC2_AVAIL_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
export AWS_DEFAULT_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
if [ $# -eq 0 ]
then
echo "Need Filter Value eg. $0 web"
else
ec2list | grep $1 | awk '{print $3,$1}' | while read param;do
@mungi
mungi / AWS NAT Script
Created April 29, 2016 07:28
/usr/local/sbin/configure-pat.sh
#!/bin/bash
# Configure the instance to run as a Port Address Translator (PAT) to provide
# Internet connectivity to private instances.
#
set -x
echo "Determining the MAC address on eth0"
ETH0_MAC=`/sbin/ifconfig | /bin/grep eth0 | awk '{print tolower($5)}' | grep '^[0-9a-f]\{2\}\(:[0-9a-f]\{2\}\)\{5\}$'`
if [ $? -ne 0 ] ; then
@mungi
mungi / pIP_inELB.sh
Created May 19, 2016 09:20
특정 ELB (여기선 myELB)에 소속되어 있는 running 중인 인스턴스의 사설 IP를 반환 해주는 CLI 입니다.
#!/bin/bash
ELB_NAME=myELB
IIDs=$(aws elb describe-instance-health --load-balancer-name $ELB_NAME --output text | awk '{print $3}')
aws ec2 describe-instances --instance-ids $IIDs --filters "Name=instance-state-name,Values=running" --query "Reservations[*].Instances[*].PrivateIpAddress" --output=text
@mungi
mungi / iperf_test.md
Created November 9, 2016 00:45
iperf 테스트 하기

iperf 사용법

주의점

  • iperf(사실iperf2) 또는 iperf3를 사용하되 양쪽에 같은 메이저 버전을 써야 합니다.
  • 가능하면 iperf3 추천.

다운로드 위치

@mungi
mungi / userdata
Created June 17, 2017 08:52
simple userdata for demo
#!/bin/bash
yum update -y
yum install -y httpd24 php56 mysql55-server php56-mysqlnd
service httpd start
chkconfig httpd on
groupadd www
usermod -a -G www ec2-user
chown -R root:www /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} +
@mungi
mungi / tping.sh
Last active July 16, 2017 06:30
ping with timestamp
#!/usr/bin/bash
ping $1 | while read data; do echo "$(date) | $data"; done
@mungi
mungi / base_functions.sh
Created July 16, 2017 06:47
softlayer bootstrap
#!/bin/sh
if [ -s "/root/provisioningConfiguration.cfg" ] || [ -s "/target/root/provisioningConfiguration.cfg" ]
then
if [ -s "/root/provisioningConfiguration.cfg" ] ; then
. /root/provisioningConfiguration.cfg
DOWNLOAD_HOST=${TXN_HOST}
LOCAL_INSTALL_LOG=${TXN_INSTALL_LOG}
elif [ -s "/target/root/provisioningConfiguration.cfg" ] ; then
. /target/root/provisioningConfiguration.cfg
@mungi
mungi / SoftlayerEdu.sh
Created July 18, 2017 08:44
Softlayer 기본 실습 커맨드
#=================================
# Putty Download 주소
# http://bit.do/putty
#=================================
#=================================
# WebSever설치 및 기본 페이지 작성
yum -y install httpd
echo "<h1> WEB Server 01 </h1>" > /var/www/html/index.html
service httpd start
@mungi
mungi / wordpress.sh
Last active September 29, 2021 14:11
Script to complete WordPress installation on CentOS 7
#!/bin/bash
# DB, Wordpress 초기비번 정의 /root/INIT_PASSWORD
INIT_ID="CloudZ"
INIT_PASSWORD=$(date +%s | sha256sum | base64 | head -c 10)
echo $INIT_PASSWORD > /root/INIT_PASSWORD
# 필요 패키지 설치
#yum update -y
yum install -y httpd php mariadb-server php-mysqlnd expect