Skip to content

Instantly share code, notes, and snippets.

View cdgco's full-sized avatar

Carter Roeser cdgco

View GitHub Profile
@cdgco
cdgco / ChooseTaskSequence.ps1
Last active April 22, 2024 20:18
Choose Task Sequence UI
<#
.SYNOPSIS
This script launches UI++ with dynamic choices based on Task Sequence Variables.
.DESCRIPTION
The script sets up the environment for a UI++ execution and dynamically modifies an XML template based on Task Sequence Variables.
.NOTES
- Author: Carter Roeser
- Last Updated: 2024-03-12
@cdgco
cdgco / DriverInjection.ps1
Last active March 12, 2024 18:30
MECM Driver Injection
<#
.SYNOPSIS
This script automates the process of installing drivers specific to the computer model and the Windows version.
It matches the computer model to a driver folder, checks for the appropriate Windows version, and installs the drivers from the matched folder.
.DESCRIPTION
The script retrieves the computer model and a specified Windows version. It then searches a given directory for a matching model and Windows version folder.
If a direct match is found, it copies the drivers to the system drive under C:\Drivers and initiates the installation.
If no direct match is found, it looks for the closest lower version available. If still no match is found, it defaults to the base model directory.
The drivers are installed silently without requiring user interaction.
@cdgco
cdgco / workerURLShortener.js
Created September 9, 2023 18:13
Lightweight Cloudflare Worker URL Shortener
/***************************************************************************************
* Lightweight Cloudflare Worker URL Shortener *
* By: Carter Roeser (cdgco) *
* *
* Simply add shortened URL as key to "urls", and redirect path to value *
* Will redirect any matches from root of trigger domain, or from /gh or /to, if *
* worker routes are enabled for domain. *
* *
* Any URLs that are not matched will redirect to "home" key (GitHub profile) *
***************************************************************************************/
@cdgco
cdgco / stock.php
Created January 6, 2022 06:23
UI Stock Tracker
<?php
$curl = curl_init('https://store.ui.com/collections/unifi-network-unifi-os-consoles/products/unifi-dream-machine');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0");
curl_setopt($curl, CURLOPT_REFERER, 'https://www.google.com/');
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
$html = curl_exec($curl);
curl_close($curl);
@cdgco
cdgco / draw.h
Last active August 9, 2018 23:29
C++ Border / Box Solution
#ifndef DRAW_H
#define DRAW_H
/* Draw routine:
First number = 1 for single line, 2 for a double lines
Second number = column's across
Third number = row's down
Fourth number = box total length
Fifth number = box total height
Sixth number = 0 for no shadow, 1 for a light shadow, 2 for medium shadow, 3 for a dark shadow and 4 for a solid shadow.
@cdgco
cdgco / stripe.html
Created July 2, 2018 20:39
Stripe HTML Currency Form
<!DOCTYPE html>
<html lang="en">
<head>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css'>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/css/bootstrap-select.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.css" rel="stylesheet">
</head>
@cdgco
cdgco / FormattedLocation.js
Last active September 24, 2017 20:14
Simple Javascript Geolocation Script / Library. Grabs location and decodes it to Zip Code, State, City, Country, Lat & Long, County, Address & Abbreviations.
window.navigator.geolocation.getCurrentPosition(function(pos){
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", 'https://maps.googleapis.com/maps/api/geocode/json?latlng='+pos.coords.latitude+','+pos.coords.longitude+'&sensor=true', false );
xmlHttp.send( null );
var locArr = JSON.parse(xmlHttp.responseText);
var locCity = locArr.results[3].address_components[1].long_name;
var locStateShort = locArr.results[3].address_components[2].short_name;
var locStateLong = locArr.results[3].address_components[2].long_name;
@cdgco
cdgco / guessthenumber.py
Created July 29, 2017 01:24
Guess The Number - TKinter Game
from random import *
from tkinter import *
import sys
prompt = "Welcome to Guess The Number! Pick a number number between 1 and 500 to begin!\n"
prompt0 = ''
prompt1 = ''
prompt2 = ''
prompt3 = ''
@cdgco
cdgco / ipaddr.py
Created July 29, 2017 01:23
Single Line IP Grabber
import urllib.request
from bs4 import BeautifulSoup
print(BeautifulSoup(urllib.request.urlopen("http://checkip.dyndns.org").read(), "html.parser").body.text.split(': ', 1)[-1])