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
sudo chpasswd <<EOT | |
user1:password1 | |
user2:password2 | |
EOT |
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/bash -ex | |
# lanch | |
instance_id=`aws ec2 run-instances --image-id ami-hoge --instance-type t2.micro --subnet-id subnet-hoge --security-group-ids sg-hoge --key-name hogekey |jq -r '.Instances[].InstanceId'` | |
echo "instance_id = ${instance_id}" | |
sleep 5 | |
# add tag | |
aws ec2 create-tags --resources ${instance_id} --tags Key=Name,Value=my-host-name |
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
require "selenium-webdriver" | |
driver = Selenium::WebDriver.for :firefox | |
driver.navigate.to "http://www.google.co.jp" | |
element = driver.find_element(:name, 'q') | |
element.send_keys "selenium" | |
element.submit | |
puts driver.title |
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
WAPFILENAME=/swap.img | |
MEMSIZE=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'` | |
if [ $MEMSIZE -lt 2097152 ]; then | |
SIZE=$(($MEMSIZE * 2))k | |
elif [ $MEMSIZE -lt 8388608 ]; then | |
SIZE=${MEMSIZE}k | |
elif [ $MEMSIZE -lt 67108864 ]; then | |
SIZE=$(($MEMSIZE / 2))k | |
else |
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
# *.deb or *.sh | |
find . -type f -name "*.deb" -or -name "*.sh" | |
# not *.deb or *.sh | |
find . -type f ! -name "*.deb" -and ! -name "*.sh" | |
# date format(hoge_20150307 etc...) | |
find . -type f -name "*`date +%Y%m%d`" |
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/bash | |
dir=/etc/crontab | |
echo -e "\n**************${dir}****************" | |
cat ${dir} | |
echo "***********************************" | |
for dir in `ls -d /var/spool/cron/*` | |
do | |
echo -e "\n**************${dir}****************" |
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
# valid | |
aws cloudformation validate-template --template-body file://MyStack.json | |
# create stack | |
aws cloudformation create-stack --template-body file://Mystack.json --stack-name MyFirstStack | |
# create stack with parameter | |
aws cloudformation create-stack --template-body file://CloufFormationSample.json --stack-name MyFirstStack --parameters ParameterKey=KeyNameParameter,ParameterValue=HogeKeyPair | |
# update stack |
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
# dry run | |
logrotate -d /etc/logrotate.conf | |
# specific conf | |
logrotate -d /etc/logrotate.d/httpd | |
# force execute(Normally logrotate confirms /var/lib/logrotate.status) | |
logrotate -f /etc/logrotate.conf |
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
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "A simple stack that launches an instance.", | |
"Parameters" : { | |
"InstanceTypeParameter" : { | |
"Type" : "String", | |
"Default" : "t2.micro" | |
}, | |
"KeyNameParameter" : { | |
"Type" : "String" |
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
module Hoge | |
def filter_record | |
puts "hoge hello" | |
end | |
end | |
module Fuga | |
include Hoge | |
def filter_record |