Skip to main content

Recent Posts

CodeCatch API Loadtest

Nov 13, 2024AustinLeath

0 likes • 3 views

import concurrent.futures
import requests
import time
import logging
import urllib3
# Disable SSL warnings
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# URL of the API endpoint
url = "https://compile.codecatch.net/compile/code"
# Payload to be sent in the POST request
payload = {
"language": "python",
"content": "print(\"test\")"
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer xyz"
}
# init logging with basic config
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
# Function to send a POST request
def send_post_request():
response = requests.post(url, json=payload, headers=headers, verify=False)
return response.status_code
# Number of requests to send
num_requests = 1000 # You can adjust this number as needed
# Function to perform the load test
def load_test():
start_time = time.time()
success_count = 0
total_duration = 0
with concurrent.futures.ThreadPoolExecutor(max_workers=50) as executor:
futures = [executor.submit(send_post_request) for _ in range(num_requests)]
for future in concurrent.futures.as_completed(futures):
try:
status_code = future.result()
if status_code == 200:
success_count += 1
total_duration = time.time() - start_time
logging.info(f"Request completed with status code: {status_code}")
except Exception as e:
logging.error(f"Request generated an exception: {e}")
requests_per_second = success_count / total_duration
logging.info(f"Total successful requests: {success_count}")
logging.info(f"Total duration: {total_duration} seconds")
logging.info(f"Requests per second: {requests_per_second}")
if __name__ == "__main__":
load_test()

FRR_BGP_config

Oct 15, 2024AustinLeath

0 likes • 6 views

# default to using syslog. /etc/rsyslog.d/45-frr.conf places the log
# /var/log/frr/frr.log
#
# Note:
# FRR's configuration shell, vtysh, dynamically edits the live, in-memory
# configuration while FRR is running. When instructed, vtysh will persist the
# live configuration to this file, overwriting its contents. If you want to
# avoid this, you can edit this file manually before starting FRR, or instruct
# vtysh to write configuration to a different file.
#log syslog informational
hostname UDM-SE
frr defaults datacenter
log file stdout
service integrated-vtysh-config
!
!
router bgp 65001
bgp router-id 172.16.72.254
neighbor 172.16.72.1 remote-as 65000
neighbor 172.16.72.1 default-originate
!
address-family ipv4 unicast
redistribute connected
redistribute kernel
neighbor V4 soft-reconfiguration inbound
neighbor V4 route-map ALLOW-ALL in
neighbor V4 route-map ALLOW-ALL out
exit-address-family
!
route-map ALLOW-ALL permit 10
!
line vty
!

JSON for AI route

Sep 26, 2024AustinLeath

0 likes • 10 views

{
"postId": "93d3dc33-cf39-48e0-8a7e-2d72a0f33847",
"descriptionGeneratedTime": "2024-09-26T05:34:44.737Z",
"description": "**Description:**\n\nThis Pascal code is a simple \"Hello, World!\" program. It uses the `writeln` function to print \"Hello, World!\" to the console and then ends the program.\n\n**Improvement Insights:**\n\n1. **Add Comments:** Although the code is straightforward, adding comments can make it more readable and easier to understand, especially for beginners.\n\n Improved version:\n ```pascal\n program HelloWorld;\n begin\n // Print \"Hello, World!\" to the console\n writeln('Hello, World!');\n end.\n ```\n\n2. **User Interaction:** To make the program more interactive, you could modify it to accept user input before printing the message.\n\n Improved version:\n ```pascal\n program HelloWorld;\n uses\n sysutils;\n var\n userName: string;\n begin\n // Prompt user to enter their name\n writeln('Please enter your name:');\n readln(userName);\n // Greet the user\n writeln('Hello, ' + userName + '!');\n end.\n ```"
}

AWS CLI Locate ClientVPN

Sep 23, 2024AustinLeath

0 likes • 5 views

CLIENT_VPN_ID="cvpn-endpoint-xxxxxxxxxxxx"
for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do
echo "Searching in region: $region"
aws ec2 describe-client-vpn-endpoints --region $region --query "ClientVpnEndpoints[?ClientVpnEndpointId=='$CLIENT_VPN_ID']" --output table
done

Untitled

Sep 19, 2024AustinLeath

0 likes • 2 views

program HelloWorld;
begin
writeln('Hello, World!');
end.

defaultdict count

Aug 14, 2024AustinLeath

0 likes • 17 views

from collections import defaultdict
faceValues = [1, 2, 3, 4, 5, 6]
sums = defaultdict(int)
for i in range(6):
for j in range(6):
sums[faceValues[i] + faceValues[j]] += 1
print('sum', 'count')
for key in sorted(sums.keys()):
print(f'{key:0>2}: {sums[key]}')

Post Statistics

Posts

No Posts Found

It looks like AustinLeath has no public posts

Likes

Please Log In

You must be authenticated to view a user's likes

Shared

Please Log In

You must be authenticated to view a user's shared posts

Profile Privacy

Multi-Factor Authentication

Multi-Factor Authentication (MFA) is an authentication method that requires you to provide two or more verification factors to gain access to your account. In addition to username and password, MFA requires you to verify your email on every login, which decreases the likelihood of someone stealing your account.

Change Password

Forgot Password?

Identity Color

Changes the color of your profile icon and cursor highlight in the live code editor. You and other users will be able to view this change.

Delete Account

Deleting your account is permanent. All data associated with your account will be lost.