Skip to content

Instantly share code, notes, and snippets.

View mdespriee's full-sized avatar

mathieu mdespriee

View GitHub Profile
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Array.from(document.querySelectorAll("[aria-labelledby=detail-header] label").values()).filter(i => i.control.checked ).forEach(i => {i.click()})
@mdespriee
mdespriee / python_async_cache_decorator.py
Created January 23, 2022 21:37
decorator meant to build singletons, and designed for async coroutines
def async_cache(func):
"""
decorator meant to build singletons, and designed for async coroutines
:param func:
:return:
"""
instances = {}
@functools.wraps(func)
async def wrapper(*args, **kwargs):
@mdespriee
mdespriee / list_ecr_images_vulnerabilities.sh
Created July 13, 2023 18:11
List vulnerabilities on ecr recent images
#!/bin/bash
repositories=$(aws ecr describe-repositories | jq -r '.repositories[].repositoryName')
for repo in $repositories
do
# latest image, having a version tag
latest_image=$(aws ecr describe-images --repository-name $repo --query 'sort_by(imageDetails,& imagePushedAt)[*]' | jq -r '.[] | select(.imageTags[] | startswith("v")) | "imageDigest=\(.imageDigest),imageTag=\(.imageTags[0])"' 2>/dev/null | tail -n 1 )
if [ -z "$latest_image" ]; then