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 () { | |
aws_cmd=`command which aws` | |
if [[ $@ =~ 'help' ]] | |
then | |
command $aws_cmd $@ | |
return | |
fi | |
identity=`$aws_cmd sts get-caller-identity` || return | |
account=`echo $identity | jq '.Account' | tr -d '"'` | |
arn=`echo $identity | jq '.Arn' | tr -d '"'` |
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/bash | |
while true | |
do | |
OUT=`/usr/bin/pmset -g batt` | |
PERCENTLEFT=`echo $OUT | awk '{print $8}' | sed 's/%;//'` | |
if [ ${PERCENTLEFT} \< 40 ]; | |
then | |
echo "${PERCENTLEFT} percent battery left" > /tmp/batterywarning | |
fi |
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 python | |
from google.cloud import monitoring | |
''' | |
# Using a service account with credentials in a json file: | |
JSON_CREDS = '/path/to/json' | |
from oauth2client.service_account import ServiceAccountCredentials | |
scopes = ["https://www.googleapis.com/auth/monitoring",] | |
credentials = ServiceAccountCredentials.from_json_keyfile_name( |