This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Script to query Panorama for connected firewall serial numbers | |
| and then iterate over them to collect rule hit counts from each firewall. | |
| """ | |
| import requests | |
| import xml.etree.ElementTree as ET | |
| import json | |
| from typing import List, Dict, Optional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for d in */ ; do | |
| echo "Processing directory: $d" | |
| find "$d" -type f -exec du -ah {} \; | sort -rh | head -n 10 | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ "$#" -ne 1 ]; then | |
| echo "You must enter exactly 1 command line argument (the string to search for)" | |
| exit 1 | |
| fi | |
| grep -rnw './' -e "$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| from typing import Dict, Optional | |
| import requests | |
| import json | |
| import gzip | |
| import boto3 | |
| import botocore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import necessary libraries | |
| from netmiko import ConnectHandler | |
| # Define list of devices | |
| devices = [ | |
| { | |
| 'device_type': 'cisco_ios', | |
| 'ip': '192.168.1.1', | |
| 'username': 'admin', | |
| 'password': 'password' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import time | |
| import platform | |
| import subprocess | |
| def continuous_traceroute(target, interval=1): | |
| print(f"Starting continuous traceroute to {target} with an interval of {interval} seconds") | |
| # Determine the appropriate command based on the operating system | |
| command = "traceroute" if platform.system() != "Windows" else "tracert" |
NewerOlder