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 | |
| # ============================================================================= | |
| # macOS Bootstrap Script | |
| # | |
| # 使い方(公開 Gist から実行): | |
| # /bin/bash -c "$(curl -fsSL <gist_url>)" | |
| # | |
| # または手動で: | |
| # bash bootstrap.sh | |
| # ============================================================================= |
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
| /** | |
| * ユーザーリストを返す | |
| * @param {string} groupEmail - グループのEmail | |
| * @return {string[]} - ユーザーEmailのリスト | |
| */ | |
| function listMembers(groupEmail) { | |
| let memberships = listMemberships(groupEmail); | |
| var members = []; | |
| for (const membership of memberships) { | |
| // ロールがオブジェクトかつ配列になっているので「,」でジョインした文字列にする |
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 boto3 | |
| from botocore.exceptions import ClientError | |
| import datetime | |
| import time | |
| import os | |
| from dateutil.relativedelta import relativedelta | |
| athena_query_wait_time = 3 |
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
| #!/usr/bin/env bash | |
| # This script setups dockerized Redash on Mac OS. | |
| set -eu | |
| REDASH_BASE_PATH=/opt/redash | |
| create_directories() { | |
| sudo mkdir -p $REDASH_BASE_PATH/postgres-data | |
| sudo chown -R $USER $REDASH_BASE_PATH | |
| } |
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 -eu | |
| # Tokyo region | |
| price=0.023 | |
| region='ap-northeast-1' | |
| aws_accound_id=$(aws sts get-caller-identity --query 'Account' --output text) | |
| echo "aws_accound_id,aurora_cluster,total_bk_storage,days,avg_bk_storage_per_month,avg_bk_storage_per_month_gb,cost_bk_storage" |
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
| $instanceName = Invoke-RestMethod -Headers @{ 'Metadata-Flavor' = 'Google' } -Uri "http://metadata.google.internal/computeMetadata/v1/instance/name" | |
| $zoneInfo = Invoke-RestMethod -Headers @{ 'Metadata-Flavor' = 'Google' } -Uri "http://metadata.google.internal/computeMetadata/v1/instance/zone" | |
| $zone = $zoneInfo.Split("/")[-1] | |
| $region = $zone.Substring(0, $zone.Length-2) | |
| $createdBy = gcloud compute instances describe $instanceName --zone $zone --format "value[](metadata.items.created-by)" | |
| $instanceGroup = $createdBy.Split("/")[-1] | |
| $preempted = Invoke-RestMethod -Headers @{ 'Metadata-Flavor' = 'Google' } -Uri "http://metadata.google.internal/computeMetadata/v1/instance/preempted" | |
| try { | |
| if ($preempted -eq "TRUE") { |
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 | |
| set -u | |
| export PATH="/usr/local/bin:/sbin:/usr/sbin:$PATH" | |
| instance_name=$(curl -sSfL -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/name) | |
| zone_info=$(curl -sSfL -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/zone) | |
| zone=${zone_info##*/} | |
| region=${zone:0:-2} |
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 | |
| project=$1 | |
| hosts=("gcr.io" "us.gcr.io" "eu.gcr.io" "asia.gcr.io") | |
| for host in ${hosts[@]}; do | |
| gcloud container images list --repository=$host/$project --format json | jq -r ".[].name" | |
| done |
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
| # coding:utf-8 | |
| from __future__ import print_function | |
| import os, boto3, datetime, csv | |
| s3 = boto3.resource('s3') | |
| athena_client = boto3.client('athena') | |
| today = datetime.datetime.today().strftime("%Y%m%d") | |
| s3_bucket = os.environ.get('S3_BUCKET') | |
| max_items = 50 |
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
| source :gemcutter | |
| gem 'aws-sdk', '~> 2' |
NewerOlder