Skip to content

Instantly share code, notes, and snippets.

View loopyd's full-sized avatar

Robert Michael Smith loopyd

View GitHub Profile
@loopyd
loopyd / list_tool.py
Created January 11, 2024 06:20
[python] Number list tool
import os
import sys
from typing import Callable, Sequence, Union
from argparse import ArgumentParser, Namespace
def filter_number_list(items: list[int | float], min_value: int | float = None, max_value: int | float = None, unique_values: bool = False, sort_order: str = "ascending") -> list[int | float]:
"""
Filter a list of numbers.
Arguments:
@loopyd
loopyd / deienv.py
Last active January 10, 2024 03:22
[py] Pydantic environment (.env) file parser
from pydantic import BaseModel, Field
from typing import Any, Callable, Type, TypeVar, Union
import os, sys
class EnvFileModel(BaseModel):
class Config:
validate_assignment = True
extra = "forbid"
arbitrary_types_allowed = True
@loopyd
loopyd / run.sh
Last active December 6, 2023 23:00
AutoGen Assistant Runner
#!/bin/bash -i
# This script runs autogenra UI easily with a folder. Simply create the folder, drop this script into it, and run.
#
# Notice: Because this script adds groups to your user, for anaconda, python, and node, you'll need to re-run it a few times.
# The process isn't fully automated due to a restriction with newgrp command spawning a subshell.
# Put your OPENAI API key here.
export OPENAI_API_KEY="your_api_key_here"
@loopyd
loopyd / aider-too.sh
Last active December 6, 2023 10:05
[bash] Aider Linux Tool - aider is AI pair programming in your terminal: https://github.com/paul-gauthier/aider | This is a run script for aider that streamlines its workflow by automating it in a conda environment.
#!/bin/bash
export SCRIPT_PATH=$(dirname "$(realpath "$0")" )
function __usage() {
BASENAME=$(basename "$0")
printf "%0.s=" {1..80}
printf "\n%-10s%-60s%-10s\n" "$BASENAME" "Aider Linux CLI tool" "v0.0.1"
printf "%0.s-" {1..80}
printf "\n\n%s" "This is a CLI tool for managing Aider projects. It streamlines the aider workflow and allows a developer to iterate fast." | fold -w 75 | awk '{ print " " $0 }'
@loopyd
loopyd / civitai_scraper.py
Last active November 26, 2023 06:41
[python] CivitAI Scraper - Data archival utility for CivitAI
""" =======================================================================================
civitai-scraper.py v1.0.3 deitydurg
=======================================================================================
This script is used to scrape CivitAI (https://civitai.com) for models and creators.
It will save the results to a json file, which can be used to bulk-download the models.
This script is not affiliated with CivitAI in any way, and is provided as-is with some
updates when I have time. Therefore you should use it at your own risk.
---------------------------------------------------------------------------------------
Questions? Comments? Need to scream at me for writing this? OK!
@loopyd
loopyd / colors.sh
Last active November 22, 2023 01:27
[sh|bash] ANSII color library
# ---------------------------------------------------------------------------------
# Color library - created by deity l. dragon <[email protected]>
# ---------------------------------------------------------------------------------
#
# Covers all ANSI colors and formatting options in standard 7-color TTY mode.
#
C_Reset="\033[0m"
# Normal Bold Underline
C_Black="\033[0;30m"; C_B_Black="\033[1;30m"; C_U_Black="\033[4;30m"
@loopyd
loopyd / deigear.ps1
Last active November 30, 2023 07:00
[POLYGLOT] DeiGEAR - Bootstrapper for Windows Subsystem for Linux
# =================================================================================
# Title: Dei G. E. A. R. - Grossly Enormous Automated Runner
# WSL2 Polyglot Bootstrapping Script
#
# Description: This script configures WSL2 the easy way. It is useful from
# outside of a WSL container to configure the WSL2 environment. It is also
# useful from within a WSL container to configure the WSL2 environment. Thus it is
# an all-in-one single file solution to configure/manage WSL2.
#
# ---------------------------------------------------------------------------------
@loopyd
loopyd / ini-parselib.sh
Last active November 14, 2023 04:35
[Bash] ini parselib - Bash/perl library for reading/modifying ini files
#!/bin/bash
#
# 📯 * AAAAAAAAAAAAAAAAAAAUUUUUUUUUUUUUUUUHHHHHHNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN!!!! * 📯
#
# You didn't ask. I did it anyway. Now as a zero-dependency gulp.sh
#
# CONTRIBUTIONS? BUGFIXES? UNCONVERED EDGE CASES? Make them known.
#
# update_ini_file: Updates or adds a key-value pair in a specific section of an INI file
@loopyd
loopyd / wsl-init.sh
Last active October 27, 2023 00:24
[WSL2] Configuration injector
#!/bin/bash
# wsl-init.sh | Version 1.0.0
# License: Unilicense <https://unlicense.org/>
# Author: loopyd <[email protected]>
#
# Simple bash script that injects preferred WSL configuration, and updates the system.
#
# USAGE INSTRUCTIONS
#
@loopyd
loopyd / roar.ps1
Last active October 21, 2023 21:06
[R. O. A. R.] Ridiculous Output Augmentation Routine - A pretty multithreaded PowerShell console-based HUD wrapper for shell commands using runspaces. Customize it as you like. Perfect for long-running operations to show a heads-up display and real time status.
<#
.SYNOPSIS
Ridiculous Output Augmentation Routine - R. O. A. R.
.DESCRIPTION
This function invokes a command. It displays a timer with resource usage while the command is running. It also displays the command name, and entertains the user with an animation.
.PARAMETER Command
The command to invoke.
.PARAMETER Arguments
The arguments to pass to the command.
.EXAMPLE