Skip to content

Instantly share code, notes, and snippets.

View Attumm's full-sized avatar

Attumm

  • Amsterdam
View GitHub Profile
items = [
{'name': 'C', 'requires': ['E']},
{'name': 'B', 'requires': ['C', 'D']},
{'name': 'E', 'requires': []},
{'name': 'A', 'requires': ['B']},
{'name': 'D', 'requires': []},
]
items1 = {'C': ['E'], 'B': ['C', 'D'], 'E': [], 'A': ['B'], 'D': []}
@Attumm
Attumm / README.md
Last active June 5, 2024 09:16
Git Submodules Cheat Sheet

Git Submodules Cheat Sheet

This cheat sheet provides a quick reference for commonly used Git commands when working with submodules.

Adding a Submodule:
git submodule add <repository-url> <path>
Initializing Submodules:
71 0 RESUME 0
72 2 LOAD_GLOBAL 1 (NULL + len)
12 LOAD_FAST 0 (nums)
14 CALL 1
22 STORE_FAST 1 (n)
73 24 BUILD_LIST 0
26 STORE_FAST 2 (result)
package main
import "fmt"
const (
Electronics = uint8(1) << iota // 0000 0001 (1)
HomeGoods // 0000 0010 (2)
Apparel // 0000 0100 (4)
Toys // 0000 1000 (8)
Outdoor // 0001 0000 (16)
@Attumm
Attumm / recreate_run.sh
Last active December 18, 2023 10:42
Running docker in production will eventually lead to the question: "How was this instance initially started". This script tries recreate the initial docker run command from docker config.
#!/bin/bash
if (( $# != 1 )); then
echo "Error: No Docker container ID provided."
exit 1
fi
CONTAINER_ID=$1
if ! docker inspect "$CONTAINER_ID" &>/dev/null; then

Medusa: API Testing and Performance Tool

Medusa is a versatile command-line tool designed for developers working on API services. It provides functionalities to capture, replay, and test API calls, enhancing your workflow and ensuring the stability and performance of your services.

Features

Capture API Calls

When developing or maintaining APIs, Medusa allows you to capture API calls and their responses. This feature is particularly useful when fixing bugs or adding new features. By preserving the order of calls, you can analyze and compare results, facilitating regression testing and performance analysis.

URL Specification

Introduction

The API provides a mechanism to build complex query strings using different nodes and their fields. This document outlines the URL specification for constructing such queries.

Base URL

The base URL is given by <host>.

@Attumm
Attumm / csv_writer.py
Created September 11, 2023 11:54
csv writer written for handling json per line dataset.
import csv
class CSVWriter():
"""
A context manager for writing formatted data to CSV files.
This class handles the creation and writing of data to CSV files. It infers the CSV headers from the first data entry
for each table. The CSV files are saved in the specified directory.
Attributes:
import json
def new_dn(dn, key):
return dn + (key,)
def sm_looper(run_func, sm_model):
def loop_over(model, dn=()):
if "type" not in model:
func hasPrefixCaseInsensitive(s, prefix string) bool {
if len(prefix) > len(s) {
return false
}
return strings.EqualFold(s[:len(prefix)], prefix)
}
!hasPrefixCaseInsensitive(single, lSearchTerm)
func IMatch(s, match string) bool {