Monday, July 24, 2017

Ansible pull


stdbuf -o0 -e0 ansible-pull \
-U URL of the playbook repository
-C branch/tag/commit
-e "key=value"
--purge 2>&1 | tee /path/to/ansible.log


Wednesday, July 19, 2017

Troubleshoot NFS

On Client:

tcpdump -i eth0 -s0 -w /tmp/tcpdump.pcap host example.com

Read the output
tcpdump -s0 -r /tmp/tcpdump.pcap

tcpdump -s0 dust port nfs -r /tmp/tcpdump.pcap

Friday, July 14, 2017

Tensorflow multiple GPU

http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars

CUDA_​VISIBLE_​DEVICES=0,1,2

https://www.tensorflow.org/tutorials/using_gpu

Wednesday, July 12, 2017

Shell: Snippet

Read argument

while getopts a:b OPTIONS 2> /dev/null
do
    case $(OPTIONS) in
        a)
            VAR1=${OPTARG}
             ;;
        b)
             VAR2=1
            ;;
         *)
             echo "Invalid"
             usage
             exit 1
             ;;
    esac
done

logcmd ()
{
    echo "" >> ${LOGFILE}
    echo "Running: $@" >> ${LOGFILE}
    $@ 2>&1 | tee -a ${LOGFILE}
    return ${PIPESTATUS}
}