Skip to content

Instantly share code, notes, and snippets.

@djahren
djahren / drink_water_reminder.yaml
Last active March 3, 2024 06:33
Home Assistant: Drink Water Reminder & Tracker Blueprint
blueprint:
name: Drinking Water Tracker & Reminder
description:
"Track your water drinking and remind yourself when you haven't for
a while. This blueprint requires you to create 3 input helpers: Date & Time, Button,
and Timer."
source_url: https://gist.github.com/djahren/322ce13a857b2099956429005669fe4a
domain: automation
input:
notify_device:
@djahren
djahren / FrequentlyUsedPSSnippets.ps1
Created April 10, 2021 21:40
Frequently Used PowerShell Snippets
#These are just a few PowerShell snippets I've written that I find myself coming back to time and time again. I hope they can help you too.
#Export To CSV $ReportsDir defined in my $profile file.
| Export-CSV (Join-Path $ReportsDir ".csv") -NoTypeInformation
#Before Loop - fill out activity and replace $Array with iterable varible.
$Activity = ""; $Total = $Array.Count;
$StartTime = Get-Date; $Count = 1;
#In Loop - replace -CurrentOperation
$ElapsedSeconds = (New-TimeSpan -Start $StartTime -End (Get-Date)).TotalSeconds; $SecondsPerOp = $ElapsedSeconds/$Count;
@djahren
djahren / SplitPicturesByYears.ps1
Last active March 26, 2021 04:28
Split Pictures by Years
<#
.SYNOPSIS Split files and their subfolders by years based on the last modified date
.DESCRIPTION Enter the source and destination folders in the strings below.
Set debug mode to preview what will happen without changing anything.
Set limit execution to only apply to the first few items in a folder - good for testing after debug is disabled.
Add any extensions you don't want to move to BlockedExtensions.
Reference $SkippedFiles afterwards to get a list of files that weres skipped on the most recent run.
Will work with the Source and destination folder the same, however recommended to have different source and destinations.
Doesn't work on empty directories.
.NOTES
@djahren
djahren / Disable ScreenConnect Animation.user.js
Created May 23, 2018 23:41
Disable ScreenConnect (ConnectWise) Animation - User Script
// ==UserScript==
// @name Disable ScreenConnect Animation
// @namespace http://djahren.com/
// @version 0.1
// @description Disables the unnecessary animation on screen connect.
// @author Ahren Bader-Jarvis
// @match https://*.screenconnect.com/Host*
// @grant none
// ==/UserScript==
@djahren
djahren / Snake!.ps1
Created March 12, 2018 04:30
Snake (in PowerShell)
$width = 10
$height = 10
$backgroundColor = "DarkBlue"
$gamecycle = 500 #milliseconds
$lasttick = 0
$gameclock = New-Object System.Diagnostics.Stopwatch
$snake = New-Object PSObject
$snake | Add-Member X ([Int]($width / 2))
$snake | Add-Member Y ([Int]($height / 2))
$snake | Add-Member Tail @()