Skip to content

Instantly share code, notes, and snippets.

Setup and testing using local docker registry

Making the credential file

Create the folder

mkdir registry
cd registry/
mkdir auth

Crete the auth file

@Tranquility2
Tranquility2 / xmake.lua
Created February 16, 2024 10:36
xmake test with std
set_toolchains("mingw")
set_plat("mingw")
set_arch("x86_64")
add_rules("mode.debug", "mode.release")
target("test")
add_cxflags("-static-libstdc++", "-static-libgcc")
add_ldflags("-static-libstdc++", "-static-libgcc")
@Tranquility2
Tranquility2 / test_aws_lmabda.sh
Last active November 23, 2023 14:07
Run and test aws container based lambdas
#!/bin/sh
BASE_IMAGE_NAME="new_lambda"
CONTAINER_NAME="${BASE_IMAGE_NAME}_container"
IMAGE_WITH_TAG="${BASE_IMAGE_NAME}:test"
docker build . -t ${IMAGE_WITH_TAG}
docker run -d -p 9000:8080 --name ${CONTAINER_NAME} ${IMAGE_WITH_TAG}
result=$(curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}')
@Tranquility2
Tranquility2 / get_samples.py
Created November 11, 2023 15:54
Util to fetch sample files
#!/usr/bin/env python3
"""Util to fetch sample files."""
import json
import logging
from dataclasses import dataclass
from urllib.error import HTTPError
from urllib.request import Request, urlopen
logging.basicConfig(encoding="utf-8", level=logging.INFO, format="%(asctime)-15s %(levelname)-8s | %(message)s")
@Tranquility2
Tranquility2 / yaml_updater.py
Created November 9, 2023 09:22
Script to update values in a YAML file
from argparse import ArgumentParser
from pathlib import Path
from ruamel.yaml import YAML
yaml = YAML()
yaml.preserve_quotes = True
yaml.width = 4096
yaml.boolean_representation = ["false", "true"]
@Tranquility2
Tranquility2 / sys_info.py
Created August 8, 2023 08:57
System info
import os
import platform
import sys
from rich.console import Console
from rich.table import Table
FILE_READ_BUFFER_SIZE = 32 * 1024
@Tranquility2
Tranquility2 / set-output-regex.py
Created November 2, 2022 15:38
Fix Github set-output command (Pre deprecation)
import re
import click
import fileinput
# Used to address deprecating set-outputcommand
# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
# Search project for relevant files
# egrep -r --include="*.yml" "set-output" | awk '{print $1}' | awk '!seen[$0]++' | awk -F':' '{print $1}'\ | sort > temp/github_files.txt
@Tranquility2
Tranquility2 / .gitconfig
Created June 23, 2021 06:45
Git's configuration file
1 .gitconfig X
# This is Git's per-user configuration file.
[user]
name = <user>
email = <email>
[alias]
# Base
co = checkout
@Tranquility2
Tranquility2 / make_certs.sh
Last active January 18, 2021 09:54 — forked from mediaupstream/make_certs.sh
extract ca-certs, key, and crt from a pfx file
#!/bin/bash
#
# Usage:
# ./make_certs.sh test.example.com
#
# The required input to make_certs.sh is the path to your pfx file without the .pfx prefix
#
# test.example.com.key
# test.example.com.crt (includes ca-certs)
@Tranquility2
Tranquility2 / pretty_request.py
Last active December 23, 2019 12:53 — forked from defrex/pretty_request.py
A simple function to print a Django request the way requests are meant to be printed.
class AnsiColors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'