PROJECT='named-enigma-222'
INSTANCE_NAME='test1'
gcloud compute instances describe --format=json ${INSTANCE_NAME} | egrep -v 'TERMINATED|"id":|"creationTimestamp":|"natIP":' >instance-config.json
| --- move_cmds.py 2014-08-06 17:41:47.000000000 +1000 | |
| +++ /Users/sub/cloud/platform/gcutil/lib/google_compute_engine/gcutil_lib/move_cmds.py 2014-08-06 18:21:24.000000000 +1000 | |
| @@ -291,7 +291,7 @@ | |
| self._VerifyOperations(self.MakeListResult(results, 'operationList')) | |
| - def _DeleteInstances(self, instances, zone): | |
| + def _DeleteInstances(self, instances, zone, raisefatal=True): | |
| """Deletes the given instances. | |
SRC_ZONE="us-central1-a"
DST_ZONE="asia-east1-a"
DISK_NAME="disk1"
SNAP_NAME="snap1"
gcloud compute disks snapshot $DISK_NAME --snapshot-names $SNAP_NAME --zone $SRC_ZONE &&
gcloud compute disks delete $DISK_NAME --zone $SRC_ZONE --quiet &&
gcloud compute disks create $DISK_NAME --zone $DST_ZONE --source-snapshot $SNAP_NAME &&
gcloud compute snapshots delete $SNAP_NAME --quiet
| def ExecuteRequestWithRetries(request, num_tries=5): | |
| """Executes a request and retries certain failures. | |
| Failures are retried if they are in the list of errors to retry. | |
| List includes system errors(500, 503) and an | |
| authentication error(401) | |
| Args: | |
| request: The request to issue to big query. It must be an object with | |
| an execute method. |
| docker ps | |
| ID=291d97be9ac9 | |
| PID=`docker inspect --format "{{ .State.Pid }}" $ID` | |
| nsenter --target $PID --mount --uts --ipc --net --pid | |
| ref: | |
| https://blog.codecentric.de/en/2014/07/enter-docker-container/ |
| #!/usr/bin/python | |
| import httplib2 | |
| import urllib | |
| import json | |
| import sys | |
| from apiclient.discovery import build | |
| from oauth2client import client as oauth2_client | |
| # PREREQUISITE |
| BLOCKS=$(nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8 | awk -F "spf1 " '{print $2}' | sed -e "s/include:/\n/g" | sed -e "s/?all\"//g" | grep -v ^$) | |
| echo "$BLOCKS" | while read block; do nslookup -q=TXT $block 8.8.8.8 | awk -F "spf1 " '{print $2}' | sed -e "s/ip4:/\n/g" | sed -e "s/?all\"//g" |grep -v "^ip6:" | grep -v ^$; done ; |
| #!/usr/bin/python | |
| import json | |
| import re | |
| import datetime | |
| import logging | |
| import pprint | |
| import requests | |
| from time import sleep | |
| from googleapiclient import discovery | |
| from googleapiclient.errors import HttpError |
| - name: log2monitor | |
| cmd: /usr/local/bin/lb_response_code_logging.py | |
| time: '* * * * * *' | |
| onError: Backoff | |
| notifyOnError: false | |
| notifyOnFailure: true |
| /* | |
| * Copyright (C) 2015 Google Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| * use this file except in compliance with the License. You may obtain a copy of | |
| * the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |