Skip to content

Instantly share code, notes, and snippets.

View cdot65's full-sized avatar
πŸ’
πŸ’¨

Calvin Remsburg cdot65

πŸ’
πŸ’¨
View GitHub Profile
@cdot65
cdot65 / file_sizes.sh
Created July 15, 2023 13:12
To iterate over all folders in your current directory, and display the sizes of files in each directory sorted by size, you can use the du and sort commands in Bash. The du command estimates file and directory space usage, while sort can sort lines in text files.
#!/bin/bash
for d in */ ; do
echo "Processing directory: $d"
find "$d" -type f -exec du -ah {} \; | sort -rh | head -n 10
done
@cdot65
cdot65 / delete_files_by_name.sh
Created July 15, 2023 13:38
Loop through the arguments and find the files and folders to be deleted
#!/bin/bash
# Check if there are arguments
if [ $# -eq 0 ]; then
echo "No arguments supplied. Please provide the names of the files or directories to be deleted."
exit 1
fi
# Loop through the arguments and find the files and folders to be deleted
for name in "$@"; do
(function () {
/**
* This script performs a POST request to update an external XML configuration.
* The goal is to insert a new URL as a <member> into an existing <list> for a specified URL category.
*
* Steps:
* 1. Retrieve and log input variables: the website URL, URL category, and request number.
* 2. Build an x-www-form-urlencoded request body:
* - Encode an XPath string that points to the configuration entry for the URL category.
* - Create an XML fragment with the new URL.
* Always check for a PRD (Product Requirements Document) before starting a new task and follow it closely
* Look for comprehensive project documentation to understand requirements before making changes
* Focus only on code areas relevant to the assigned task
* Prefer iterating on existing code rather than creating new solutions
* Keep solutions simple and avoid introducing unnecessary complexity
* If you run into issues that take multiple iterations to fix. After you fix it, write up a description of the problem and how we fixed it and store it in a folder called "fixes", in an individual .md file with the name of the issue. Only do this for major issues and solutions.
* For issues that are taking multiple iterations to fix, check the fixes folder for previous fixes and see if the same issue has been fixed before.
* Keep a running list of patterns and technology used in the README.md file
* Reference the README.md file for patterns and technology used in the project
* If you run into the same persistent error