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
# hwclock --show;date | |
# hwclock --systohc | |
# hwclock --show;date | |
# ntpdate -s (server) | |
or | |
# ntpd -q |
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
require "time" | |
def AppendLog(f) | |
f.print Time.now.strftime("%Y-%m-%d %H:%M:%S.%6N")+"\n" | |
end | |
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
aws s3 ls --recursive s3://{bucketname}/logs/ | awk '{print $4}' | xargs -P4 -I{} aws s3api put-object-acl --acl private --bucket {bucketname} --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
#!/usr/bin/env ruby | |
require 'ipaddr' | |
begin | |
puts IPAddr.new(ARGV[0]).to_range.to_s.gsub(/\.\./,"-") | |
rescue | |
puts 'i.e.) $ cidr 192.168.1.0/24' | |
end |
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
aws s3 cp s3://(CloudTrail Bucket)/AWSLogs/(Account ID)/CloudTrail/(region)/yyyy/mm/dd/(cloud trail log file name).json.gz - |zcat |jq -r '.Records[]|select (.eventName=="ModifyInstanceAttribute")|[.eventTime, .requestParameters.instanceId,.requestParameters.instanceType.value]|@csv' |
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 | |
if [ -z "$1"];then | |
user="(master user)" | |
else | |
user=$1 | |
fi | |
PGPASSWORD=(password) psql -h (redshift endpoint) -U $user -p (port) -d (database name) |
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
$ rpm2cpio ../hoge.src.rpm | cpio -i |
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 | |
aws ec2 describe-instances|jq -r '.Reservations[].Instances[]|select (.State.Name=="running")|"\(.InstanceId)\t\(.InstanceType)\t\(.Tags[].Value)\t\(.PublicIpAddress)\t\(.PublicDnsName)\t\(.State.Name)"' |
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
select tb.trx_mysql_thread_id blocking_id | |
, tb.trx_state blocking_state | |
, tb.trx_started blocking_starttime | |
, pb.HOST blocking_host | |
, pb.TIME blocking_seconds | |
, pb.INFO blocking_info | |
, tw.trx_mysql_thread_id requesting_id | |
, tw.trx_state requesting_state | |
, tw.trx_started requesting_starttime | |
, pw.HOST requesting_host |
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
select t.trx_mysql_thread_id | |
, t.trx_state | |
, t.trx_started | |
, t.trx_isolation_level | |
, p.HOST host | |
, p.TIME seconds | |
, p.INFO query | |
from information_schema.INNODB_TRX t | |
inner join information_schema.PROCESSLIST p | |
on t.trx_mysql_thread_id = p.ID |
OlderNewer