Skip to content

Instantly share code, notes, and snippets.

@charlesrc019
charlesrc019 / web_manage_aws_services_easy.py
Created November 13, 2024 22:34
web_manage_aws_services_easy.py
import json
import boto3
def lambda_handler(event, context):
msg = None
try:
data = json.loads(event['body'].lower())
@charlesrc019
charlesrc019 / math_convert_datestamp_to_epoch.py
Created November 11, 2024 15:30
math_convert_datestamp_to_epoch.py
import time
import calendar
def dattim_to_epoch(dattim, fmt='%Y%m%d%H%M'):
return int(calendar.timegm(time.strptime(str(dattim), fmt)))
@charlesrc019
charlesrc019 / math_convert_epoch_to_datestamp.py
Created November 11, 2024 15:29
math_convert_epoch_to_datestamp.py
import datetime
def epoch_to_dattim(epoch_time, fmt='%Y%m%d%H%M%S'):
return int(datetime.datetime.utcfromtimestamp(int(epoch_time)).strftime(fmt))
@charlesrc019
charlesrc019 / endpoint_rename_to_numbers.sh
Created November 8, 2024 02:26
endpoint_rename_to_numbers.sh
#!/bin/zsh
# Check if directory argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 /path/to/directory"
exit 1
fi
# Set the directory
directory="$1"
@charlesrc019
charlesrc019 / web_store_variables.php
Created November 8, 2024 02:25
web_store_variables.php
<?php
// Initialize global parameters.
$SQL_USERNAME = "";
$SQL_PASSWORD = "";
$SQL_DATABASE = "";
$conn = NULL;
// Function. Display an JSON message.
function jsonMessage ($msg='Generic error.', $success=FALSE) {
@charlesrc019
charlesrc019 / web_track_device_ips.php
Created November 8, 2024 02:24
web_track_device_ips.php
<?php
$SQL_DATABASE = "";
$SQL_USERNAME = "";
$SQL_PASSWORD = "";
// Function. Display an JSON message.
function jsonMessage ($MessageDetails='Generic error.', $IsSuccess=FALSE) {
// Return message.
@charlesrc019
charlesrc019 / web_automate_byu_ytime.php
Last active November 8, 2024 02:23
web_automate_byu_ytime.php
<?php
/*
/ BYU Y-TIME TRIGGER FOR IFTTT (UNOFFICIAL)
/ Author: Charles Christensen
/ Edited: April 3, 2019
/
/ Required Dependencies:
/ - IFTTT
/ - PHP Webserver
@charlesrc019
charlesrc019 / server_sync_route53_dns.ps1
Last active November 13, 2024 22:33
server_sync_route53_dns.ps1
Start-Sleep -Seconds 60 # allow windows to spin-up
Import-Module -name AWSPowerShell
# Define your parameters
$hostedZoneId = "ZZZZZ" # The ID of your hosted zone in Route 53.
$recordName = "subdomain.url.co" # The A record you want to update (e.g., "subdomain.example.com.")
$awsRegion = "us-west-2" # The AWS region (if using Route 53 in a specific region)
# Fetch the public IPv4 address from the metadata service.
@charlesrc019
charlesrc019 / sccm_generate_machine_report.ps1
Created November 8, 2024 02:11
sccm_generate_machine_report.ps1
# Purpose: Create a CSV report of machines connected to SCCM.
# Set parameters.
Write-Host "Setting parameters."
$ServerAddress = "[YOUR_SERVER_ADDRESS]"
$ServerNamespace = "root\SMS\Site_[YOUR_SITE_ID]"
$BoxUsername = "[BOX_FTP_USERNAME]"
$BoxPassword = "[BOX_FTP_PASSWORD]"
$BoxSaveDirectory = "ftp://ftp.box.com/[BOX_DIRECTORY_URL_ENCODED]"
@charlesrc019
charlesrc019 / sccm_generate_application_report.ps1
Created November 8, 2024 02:10
sccm_generate_application_report.ps1
# Purpose: Create a CSV report of applications currently deployed in SCCM.
# Set parameters.
Write-Host "Setting parameters."
$FolderNames = @("Common","Purchased")
$LengthOfRecent = 7
$ServerAddress = "[YOUR_SERVER_ADDRESS]"
$ServerNamespace = "root\SMS\Site_[YOUR_SITE_ID]"
$BoxUsername = "[BOX_FTP_USERNAME]"
$BoxPassword = "[BOX_FTP_PASSWORD]"