Skip to content

Instantly share code, notes, and snippets.

View amitkrout's full-sized avatar
🙂

Amit Rout amitkrout

🙂
View GitHub Profile
#!/bin/bash
echo "Dict test"
declare -A appdomain_workflowID=(
["test-$1/$2"]="cow"
["test-$1/$2"]="dog"
["test-$1/$2"]="cat"
["test-$1/$2"]="fish"
)
@amitkrout
amitkrout / delete-dockerhub-images.sh
Created May 26, 2022 05:27 — forked from jriguera/delete-dockerhub-images.sh
Delete Docker images on DockerHub
#!/bin/bash
# Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
@amitkrout
amitkrout / dockerhub-v2-api-user.sh
Created May 26, 2022 05:27 — forked from kizbitz/dockerhub-v2-api-user.sh
Get the list of images and tags for a Docker Hub user account.
#!/bin/bash
# Example for the Docker Hub V2 API
# Returns all imagas and tags associated with a Docker Hub user account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username and password
UNAME=""
UPASS=""
def getNewKeyValuePair(sourcekey):
with open("test1.json") as jsonFile:
data = json.load(jsonFile)
dict = {}
lst = []
dict[sourcekey] = {}
print("_______",list(data.keys()))
print("++++++++++++", len(data))
# rules_items_source = list(findkeysvalues(data, sourcekey))
def insertValueindictonary():
with open("test1.json") as jsonFile:
data = json.load(jsonFile)
Dict = { }
for p in data:
print("ooooooooooo",p)
Dict[p] = { }
return Dict
import json
import re
def findkeysvalues(inputDict, key):
if isinstance(inputDict, list):
for i in inputDict:
for x in findkeysvalues(i, key):
yield x
if isinstance(inputDict, dict):
if key in inputDict:
{
"client": {
"name": "anyname"
},
"PEP": {
"tire2": {
"tire3": {
"compname": "test1"
},
"tire4": {
{
"tire1": {
"source": [ "{{ 'PEP' | YYYYYYY | join }}" ],
"dest": [ "{{ Microservice.host }}" ],
"port": "555"
},
"tire6": {
"source": [ "{{ 'REP' | LLLLLL | join }}" ],
"dest": [ "{{ Microservice.host2 }}" ],
"port": "555"
import json
import re
def findkeysvalues(inputDict, key):
if isinstance(inputDict, list):
for i in inputDict:
for x in findkeysvalues(i, key):
yield x
if isinstance(inputDict, dict):
if key in inputDict:
def findkeysvalues(inputDict, key):
if isinstance(inputDict, list):
for i in inputDict:
for x in findkeysvalues(i, key):
yield x
if isinstance(inputDict, dict):
if key in inputDict:
yield inputDict[key]
for j in inputDict.values():
for x in findkeysvalues(j, key):