Sep 232017
 
aws route53 change-resource-record-sets --hosted-zone-id $(aws route53 list-hosted-zones | grep -B 1 '"xiehang.com."' | grep '"Id"' | cut -f 4 -d \" | cut -f 3 -d /) --change-batch file://<(echo '{"Changes":[{"Action": "DELETE","ResourceRecordSet":' $(aws route53 list-resource-record-sets --hosted-zone-id $(aws route53 list-hosted-zones | grep -B 1 '"xiehang.com."' | grep '"Id"' | cut -f 4 -d \" | cut -f 3 -d /) --query "ResourceRecordSets[?Name == 'to-be-deleted.xiehang.com.']" --max-items 1| egrep -v '^\[|^\]')'}]}')

Or as a script:

ZONE_ID=$(aws route53 list-hosted-zones | grep -B 1 '"xiehang.com."' | grep '"Id"' | cut -f 4 -d \" | cut -f 3 -d /)
RECORD=$(aws route53 list-resource-record-sets --hosted-zone-id ${ZONE_ID} --query "ResourceRecordSets[?Name == 'to-be-deleted.xiehang.com.']" | egrep -v '^\[|^\]' --max-items 1)
JSON='{"Changes":[{"Action": "DELETE","ResourceRecordSet":'${RECORD}'}]}'
aws route53 change-resource-record-sets --hosted-zone-id ${ZONE_ID} --change-batch file://<(echo ${JSON})

 

Apr 182012
 

Here’s the whole command, with IP address masked:


ssh -A -t 111.111.111.111 "LD_PRELOAD= ssh -A -p 58422 222.222.222.222 -t \"SSH_AUTH_SOCK=\\\$(find /tmp -user xiehang -a -type s 2>/dev/null | xargs ls -tr | tail -1) ssh -p 58422 -l root $@\""

where 111.111.111.111 is jump host in office, and 222.222.222.222 is jump host in the IDC.

Tricks here: jump host in office is running tsocks, so I have to reset LD_PRELOAD to disable it, and jump host in IDC set default shell to eash (for audit) so I have to setup the ssh agent manually.

It took me 20 minutes to figure out all quotes and backslashes 🙁 .

May 012009
 

Just want to write this done so that I don’t have to man again in the future:

CC=; while [ 1 ] ; do read -s -t 1 -n 1 CC; if [ “$CC” = ‘q’ ] ; then break; fi; clear; ls -als crtv_* | tail -15 ; done

-s is “don’t echo”, -t 1 is “timeout after 1 second”, -n 1 is “read one character only” (so don’t have to wait for enter.

Pretty usefule, actually this can be used to do some interact applications with shell.