Skip to content

Instantly share code, notes, and snippets.

View WoozyMasta's full-sized avatar
👽
gotcha

Maxim Levchenko WoozyMasta

👽
gotcha
View GitHub Profile
@WoozyMasta
WoozyMasta / nexus-proxy-caches-revalidate.sh
Created June 16, 2022 09:41
Script for rebuild indexes and invalidate cache in Sonatype nexus 3 npm|nuget|pypi|maven proxy
#!/usr/bin/env bash
#
# Script for rebuild indexes and invalidate cache in NPM proxy repositories.
# Configuration can load from hide file with same name as script
# Example: this-srcipt.sh load config from ./.this-srcipt
#
# Copyright 2020 WoozyMasta <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@WoozyMasta
WoozyMasta / wg-post-chain.sh
Last active February 14, 2023 13:13
Wireguard PostUp PostDown script
#!/usr/bin/env bash
# wg-post %i UP/DOWN
set -euo pipefail
: "${WG_IFACE:=${1:-wg0}}"
: "${WG_ACTION:=${2:-down}}"
: "${WG_CONF:=/etc/wireguard/$WG_IFACE.conf}"
[ -f "$WG_CONF" ] || { >&2 echo "File $WG_CONF not accessible"; exit 1; }
@WoozyMasta
WoozyMasta / opencontainers-anotations.sh
Last active February 27, 2022 09:15
An example of assigning opencontainers annotations when building containers in GitLab CI
# https://github.com/opencontainers/image-spec/blob/main/annotations.md
image="$REGISTRY_DOMAIN/$CI_PROJECT_ROOT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME"
docker build \
--file ./Dockerfile --tag "$image" \
--label org.opencontainers.image.url="$image" \
--label org.opencontainers.image.vendor="$CI_PROJECT_ROOT_NAMESPACE@$CI_SERVER_HOST" \
--label org.opencontainers.image.version="$CI_COMMIT_REF_SLUG" \
--label org.opencontainers.image.description="$CI_PROJECT_TITLE" \
@WoozyMasta
WoozyMasta / create-container-registry-proxies.sh
Last active February 18, 2025 23:55
Create multiplie container registry cache proxies using docker distribution in registry mirror mode
#!/bin/bash
set -eu
# Listen address for all docker.io/registry instances
listen_address=0.0.0.0
# Listen port for the first container
# all subsequent ports for containers will be incremented by one
listen_port_first=5000
insecure=true
@WoozyMasta
WoozyMasta / nexus-npm-cache-revalidate.sh
Created September 9, 2021 08:32
Script for rebuild indexes and invalidate cache in Sonatype nexus 3 NPM proxy repositories
#!/usr/bin/env bash
#
# Script for rebuild indexes and invalidate cache in NPM proxy repositories.
# Configuration can load from hide file with same name as script
# Example: this-srcipt.sh load config from ./.this-srcipt
#
# Copyright 2020 WoozyMasta <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@WoozyMasta
WoozyMasta / bash-logger.sh
Last active June 3, 2022 23:00
Bash logger
#!/bin/bash
# Logging level
: "${LOG_LEVEL:=INFO}"
# Associative arrays for logging
declare -A log_c log_l
# Color codes
log_c[0]='\033[0m' # Reset colors
log_c[error]='\033[1;31m' # Red
@WoozyMasta
WoozyMasta / clusterrole-view.yml
Created May 5, 2021 15:55
Default k8s ClusterRole view
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: view
rules:
- apiGroups:
- ""
resources:
- configmaps
- endpoints