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/python | |
import BaseHTTPServer | |
import CGIHTTPServer | |
import sys | |
import socket | |
def get_local_ip_address(target): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect((target,8000)) | |
ipaddr = s.getsockname()[0] |
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
python -c 'import BaseHTTPServer; import CGIHTTPServer; import sys; import socket; s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.connect(("www.google.com",8000)); ipaddr = s.getsockname()[0]; s.close(); print "="*36 ; print "Access: " + ipaddr +":"+str(9999); print "="*36 ; server=BaseHTTPServer.HTTPServer ; handler = CGIHTTPServer.CGIHTTPRequestHandler; server_address = ("",int(9999)); httpd = server(server_address, handler); httpd.serve_forever()' |
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 | |
read -a words | |
SA_FILE=${words[0]} | |
echo $SA_FILE | |
printf "%9s%9s%9s%9s%9s%10s%10s\n" "Start" "End" "%user" "%system" "%iowait" "RX" "TX" | |
while read -a words; do | |
CPU=`sar -f $SA_FILE -s ${words[0]} -e ${words[1]} | grep Average | awk '{print $3" "$5" "$6}'` | |
NETWORK=`sar -n DEV -f $SA_FILE -s ${words[0]} -e ${words[1]} | grep Average | grep em3 | awk '{print $5" "$6}'` | |
printf "%9s%9s%9s%9s%9s%10s%10s\n" ${words[0]} ${words[1]} ${CPU[0]} ${CPU[1]} ${CPU[2]} ${NETWORK[0]} ${NETWORK[1]} |
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
# color my terminal | |
export CLICOLOR=1 | |
export LSCOLORS=ExGxFxdxCxDxDxBxBxExEx | |
#sets up the prompt color (currently a green similar to linux terminal) | |
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ ' | |
#sets up proper alias commands when called | |
alias ls='ls -G' | |
alias ll='ls -hl' | |
alias subln='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl -n' |
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 | |
ORG_FILE=$1 | |
WORD_TO_CUT=$2 | |
WORD_TO_FIND=$3 | |
zcat ${ORG_FILE} | sed 's/'${WORD_TO_CUT}'/'${WORD_TO_CUT}'\n/g' | grep ${WORD_TO_FIND} |
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
source 'https://rubygems.org' | |
group :test do | |
gem 'chefspec', '~> 3.4.0' | |
gem 'foodcritic', '~> 3.0.3' | |
gem 'strainer', '~> 3.0' | |
gem 'test-kitchen', '~> 1.2.1' | |
gem 'knife-spork', '~> 1.3.2' | |
gem 'hipchat', '~> 1.1.0' | |
gem 'guard', '~> 1.8.3' |
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
Vagrant::Config.run do |config| | |
# debug default is :headless | |
config.vm.boot_mode = "gui" | |
# the .box file | |
config.vm.box = "afa-chef-server" | |
config.vm.box_url = "/V3/base_debian/with-apt.box" | |
# ssh config | |
config.ssh.private_key_path = "afa_private_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
git checkout master | |
COOKBOOK=`git log -1 --pretty=%s | awk '{print $1}'` | |
VERSION=`git log -1 --pretty=%s | awk '{print $2}'` | |
# In case, Jenkins commit merge before build | |
if [ "$COOKBOOK" == "Merge" ] ; then | |
COOKBOOK=`git log -2 --pretty=%s | tail -1 | awk '{print $1}'` | |
VERSION=`git log -2 --pretty=%s | tail -1 | awk '{print $2}'` | |
fi |
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
func doKickoff2(opts Option) { | |
scriptName := opts.Kickoff2.ScriptName | |
configFile := opts.Kickoff2.ConfigFile | |
contentByte, err := ioutil.ReadFile(opts.Kickoff2.ConfigFile) | |
if err != nil { | |
log.Error("%v", err) | |
return | |
} | |
var config TomlConfig | |
_, err = toml.Decode(string(contentByte), &config) |
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
#This is a comment | |
FROM centos:centos6 | |
MAINTAINER Theeraphol Wattanavekin <[email protected]> | |
# Basic packages for work & troubleshooting | |
RUN yum update -y && yum install -y \ | |
git \ | |
vim \ | |
zsh \ | |
tar | |
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm |
OlderNewer