Skip to content

Instantly share code, notes, and snippets.

View loopyd's full-sized avatar

Robert Michael Smith loopyd

View GitHub Profile
@loopyd
loopyd / config_ssh.sh
Last active July 14, 2024 22:27
[bash] Do 98% of the work configuring SSH secure passwordless login on your new VPS
#!/usr/bin/env bash
# config_ssh.sh - A script to set up your VPS SSH configuration
# Author: loopyd <loopyd@github.com> 2024 | GPL3.0 Permassive License
# Run this script on your shiny new VPS to harden it and set up SSH keys and passwords.
# Note: If you are using a hosting proivder such as hostinger, you need to add the .pub keys in
# the dashbaord, as an overlayfs by the provider is used to overwrite the ssh configuration.
#
# If you experience errors trying to log in, try to add a ~/.ssh/config on your host with the following:
@loopyd
loopyd / ezrkflash.sh
Last active July 7, 2024 20:59
[bash] EzRkFlash - Easy Rockchip flashing tool (rkdevtool) wrapper.
#!/bin/bash
shopt -s extglob dotglob
IMAGE_PATH=${IMAGE_PATH:-}
LOADER_PATH=${LOADER_PATH:-}
FLASH_OFFSET=${FLASH_OFFSET:-0}
ERASE_EMMC_SIZE=${ERASE_EMMC_SIZE:-0}
WAIT_DEVICE=${WAIT_DEVICE:-false}
WAIT_DEVICE_TIMEOUT=${WAIT_DEVICE_TIMEOUT:-30}
@loopyd
loopyd / install-docker.sh
Created June 19, 2024 03:52
[bash] Install Docker
#!/bin/bash
ARGS=($*)
BOLD=$(tput bold)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
BLUE=$(tput setaf 4)
RESET=$(tput sgr0)
function __run_cmd() {
@loopyd
loopyd / docker.sh
Created April 15, 2024 08:29
[DeiDog] Docker Management API
#!/bin/bash
# @file deicog/docker.sh
# @brief A shell script API to manage Docker resources.
# @description This script is a wrapping API used to manage Docker resources like networks, swarms, services, stacks, containers, images, and volumes. It can be sourced as a library, or used as a command-line tool.
# @author Robert Smith <loopyd@github.com>
# @license MIT License
# @version 0.1
# Shell configuration
@loopyd
loopyd / autoclean.sh
Created February 14, 2024 01:30
[bash] File/Directory tidy tool
#!/bin/bash
# autoclean.sh | Version 0.0.1 | Author: @loopyd
#
# This script is used to clean up files and folders that are not needed on your linux system
# Directories to clean are stored in an associative array with the key being the directory and the value being:
# a comma separated list of file or folder names and types. These are compatible arguments for the
# find command. The script will search for these files and folders and remove them.
#
# DATA LOSS WARNING: This script will remove files and folders from your system. Please be careful with it.
@loopyd
loopyd / hp-omen-fix.sh
Last active March 12, 2024 07:03
[bash] HP Omen Fix for Linux Mint - Fixes error with missing audio firmware on this laptop
#!/bin/bash
# This script is used to fix the audio issues on HP Omen 15 laptop
#
# It installs the latest kernel, updates the sof firmware, removes old kernels, enables real-time audio support and disables mitigations for better performance, as well
# as applies additional tweaks to improve the overall system performance and stability on this laptop.
# Function to update sof firmware from sof project to the specified version
function update_sof() {
local sof_firmware_version="${1}"
@loopyd
loopyd / make_jenv_ant.sh
Created January 21, 2024 06:11
[bash] Ant in jenv
#!/bin/bash
# make.sh: Build script for Apache Ant in jenv environment | DeityDurg (2024-01-17)
#
# This script will download the specified version of Apache Ant,
# build it, and install it into the specified jenv environment.
# This script will also update the PATH environment variable to
# include the ant binary, set the JAVA_HOME environment variable
# to the specified jenv environment, and set the ANT_HOME environment
# variable to the installed ant directory.
@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"