View gakkou.py
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
import itertools | |
word_list = list('gakkou') | |
# gakkouを五十音順に | |
word_list.sort() | |
# 並べ替えの組み合わせパターン全取得 | |
word_list = list(itertools.permutations(word_list)) |
View gcd.py
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
import sys | |
import math | |
args = sys.argv | |
value1 = int(args[1]) | |
value2 = int(args[2]) | |
i = 2 | |
divisor_list = [] | |
while i < value1 or i < value2: |
View graph.sh
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 | |
usage() { | |
echo 'usage: ./graph.sh --file [PathToFile]' | |
} | |
while [[ ${#} -gt 0 ]]; do | |
opt="${1}" | |
shift | |
value="${1}" |
View opt_test.sh
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 | |
usage() { | |
echo 'usage: ./opt_test.sh --alpha [ALPHA] --bravo [BRAVO] [--charlie [CHARLIE]]' | |
} | |
while [[ ${#} -gt 0 ]]; do | |
opt="${1}" | |
shift | |
value="${1}" |
View update_iam_policy.sh
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 | |
policy_arn='arn:aws:iam::account:policy/policy-name-with-path' | |
policy_file='iam_policy.json' | |
default_version_id=`aws iam get-policy --policy-arn ${policy_arn} | jq -r .Policy.DefaultVersionId` | |
policy_version_result=`aws iam list-policy-versions --policy-arn ${policy_arn}` | |
version_counts=`echo ${policy_version_result} | jq '.Versions | length'` |
View get_containers.sh
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 | |
set -u | |
| |
while getopts n: opt; do | |
optarg="${OPTARG}" | |
if [[ "${opt}" = - ]]; then | |
opt="-${OPTARG%%=*}" | |
optarg="${OPTARG/${OPTARG%%=*}/}" | |
optarg="${optarg#=}" | |
set +u |
View option.sh
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 getopts w-:h-: opt; do | |
optarg="${OPTARG}" | |
if [[ "${opt}" = - ]]; then | |
opt="-${OPTARG%%=*}" | |
optarg="${OPTARG/${OPTARG%%=*}/}" | |
optarg="${optarg#=}" | |
set +u |
View kabegiwa-vs.yaml
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
apiVersion: networking.istio.io/v1beta1 | |
kind: VirtualService | |
metadata: | |
name: kabegiwa-vs | |
spec: | |
hosts: | |
- kabegiwa.example.com | |
http: | |
- match: | |
- uri: |
View delete_iroiro.py
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
import boto3, argparse | |
class iam(): | |
def __init__(self): | |
self.session = boto3.Session(profile_name=args.profile) | |
self.iam = self.session.resource('iam') | |
def detach_all_policies(self): # iam_resource is group or role | |
policies = list(self.iam_resource.attached_policies.all()) | |
for policy in policies: |
View delete_group.py
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
import boto3 | |
import argparse | |
parser = argparse.ArgumentParser(prog=__file__) | |
parser._action_groups.pop() # Edited this line | |
required = parser.add_argument_group('required arguments') | |
optional = parser.add_argument_group('optional arguments') | |
required.add_argument('--group-name',required=True,help='The name of the IAM group to delete.') | |
optional.add_argument('--profile',nargs='?',default='default',help='Use a specific profile from your credential file.') |
NewerOlder