Skip to content

Instantly share code, notes, and snippets.

@tadcrazio
tadcrazio / KrogerClipper.js
Created October 19, 2023 17:53
Clip all Kroger coupons
//Kroger limits to 200 coupons, this will add the first 200..
// Get all coupon cards
const couponCards = document.querySelectorAll('.CouponCard-wrapper');
// Scroll to the bottom of the page
window.scrollTo(0, document.body.scrollHeight);
// Loop through each coupon card and clip the coupon
couponCards.forEach(couponCard => {
const clipButton = couponCard.querySelector('button[data-testid^="CouponActionButton-"]');
@tadcrazio
tadcrazio / Get-Tinyurl.ps1
Last active June 29, 2017 15:06
Powershell function to make a URL tiny.
Add-Type -AssemblyName System.Web
function Get-TinyURL
{
<#
.SYNOPSIS
Make a URL tiny.
.DESCRIPTION
Enter a URL to make tiny. Will encode URL's ideal for url's that have reserverd characters.
@tadcrazio
tadcrazio / Get-CpuUsage.ps1
Last active May 29, 2017 23:47
Get CPU usage and top processes
Function Get-CpuUsage
{
[cmdletbinding()]
Param()
$TopCPU = Get-Process | Sort-Object CPU -desc | Select-Object -first 10 | Format-Table -AutoSize CPU, ProcessName
$avg = Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Foreach {$_.Average}
if ($avg -ge 0)
{
@tadcrazio
tadcrazio / Get-MemoryUsage.ps1
Last active May 29, 2017 23:47
Get Memory usage and top processes.
## The idea and most of the code comes from. https://www.petri.com/display-memory-usage-powershell
Function show-MemoryUsage
{
[cmdletbinding()]
Param()
$os = Get-Ciminstance Win32_OperatingSystem
$pctFree = [math]::Round(($os.FreePhysicalMemory / $os.TotalVisibleMemorySize) * 100, 2)
$wmidiskblock = {
Param($server = "LocalHost", $credential)
$Space = Get-WMIObject Win32_LogicalDisk -ComputerName $Server -filter "DriveType=3" -Credential $Credential| Select name, freespace
$Ram = Get-WMIObject Win32_OperatingSystem -ComputerName $Server -Credential $Credential
$Ram = $Ram.FreePhysicalMemory / 1024 / 1024
$cpu = Get-WmiObject win32_processor -ComputerName $Server -Credential $Credential | Measure-Object -property LoadPercentage -Average | Select Average