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
#vars | |
# SERVICE_ACCOUNT_FILE --> Service Account Json file | |
# project --> Gcp Project Name | |
# zone --> zone in which instance is created | |
# instance_name --> Instance name | |
from google.oauth2 import service_account | |
from googleapiclient import discovery | |
SCOPES = ["https://www.googleapis.com/auth/cloud-platform"] |
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
List all Google Compute Engine instance resources: | |
$ gcloud compute instances list | |
List Compute Engine instance resources that have machineType f1-micro: | |
$ gcloud compute instances list --filter="machineType:f1-micro" | |
List Compute Engine instance resources with zone prefix us and not | |
MachineType f1-micro: |
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
# importing the requests library | |
import requests | |
def getPostRestResponse(restUrl,inputRequest,contentType): | |
"""Sends a POST request. | |
:param url: URL for the new :class:`Request` object. | |
:param inputRequest: Data to send in the body of the request. | |
:return: :class:`Response <Response>` object. | |
""" | |
content = {'content-type': contentType} |
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 | |
# | |
# let's make an ansible rpm for offline deployment | |
# | |
yum makecache | |
yum -y update | |
# rpm build deps |
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
<% | |
import java.text.DateFormat | |
import java.text.SimpleDateFormat | |
%> | |
<STYLE> | |
BODY, TABLE, TD, TH, P { | |
font-family:Verdana,Helvetica,sans serif; | |
font-size:11px; | |
color:black; | |
} |
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/sh | |
echo -e "-- Removing exited containers --\n" | |
docker ps --all --quiet --filter="status=exited" | xargs --no-run-if-empty docker rm --volumes | |
echo -e "\n\n-- Removing untagged images --\n" | |
docker rmi --force $(docker images | awk '/^<none>/ { print $3 }') | |
echo -e "\n\n-- Removing volume directories --\n" | |
docker volume rm $(docker volume ls --quiet --filter="dangling=true") |