Skip to content

Instantly share code, notes, and snippets.

import itertools
word_list = list('gakkou')
# gakkouを五十音順に
word_list.sort()
# 並べ替えの組み合わせパターン全取得
word_list = list(itertools.permutations(word_list))
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:
#!/bin/bash
usage() {
echo 'usage: ./graph.sh --file [PathToFile]'
}
while [[ ${#} -gt 0 ]]; do
opt="${1}"
shift
value="${1}"
#!/bin/bash
usage() {
echo 'usage: ./opt_test.sh --alpha [ALPHA] --bravo [BRAVO] [--charlie [CHARLIE]]'
}
while [[ ${#} -gt 0 ]]; do
opt="${1}"
shift
value="${1}"
#!/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'`
#!/bin/bash
set -u
while getopts n: opt; do
optarg="${OPTARG}"
if [[ "${opt}" = - ]]; then
opt="-${OPTARG%%=*}"
optarg="${OPTARG/${OPTARG%%=*}/}"
optarg="${optarg#=}"
set +u
#!/bin/bash
# ↓ここを編集
while getopts w-:h-: opt; do
optarg="${OPTARG}"
if [[ "${opt}" = - ]]; then
opt="-${OPTARG%%=*}"
optarg="${OPTARG/${OPTARG%%=*}/}"
optarg="${optarg#=}"
set +u
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: kabegiwa-vs
spec:
hosts:
- kabegiwa.example.com
http:
- match:
- uri:
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:
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.')