Skip to content

Instantly share code, notes, and snippets.

View howellcc's full-sized avatar

Clint howellcc

  • 11:10 (UTC -04:00)
View GitHub Profile
@howellcc
howellcc / processPhotos.sh
Created March 3, 2021 13:29
Script to sort uploaded photos and videos into year/month sorted forlders
#!/bin/bash
#script to take a source dir and organize photos from that dir into a dest dir with a hierarchy of year/month/photo_name
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "Usage: processPhotos.sh {input folder}"
@howellcc
howellcc / backupHubitat.sh
Last active May 11, 2024 11:32
Backup script for Hubitat Elevation that runs on Synology NAS
#!/bin/bash
#https://gist.github.com/howellcc/70f5c45a9902f9a3fe4e566ceedf1bca
#This is a backup script that I'm running on my Synology NAS to back up my Hubitat Elevation.
he_login=[Hubitat Username]
he_passwd=[Hubitat Password]
he_ipaddr=[Hubitat IP Address]
backupdir='[Backup Location]' #no trailing space
hubname='Hubitat' #in case you have multiple hubs
@howellcc
howellcc / Console command
Last active November 11, 2020 15:48 — forked from KirillFormado/Console command
Visual Studio - Disable "Always Start When Debugging"
get-project -all | %{ $_.Properties | ?{ $_.Name -eq "WebApplication.StartWebServerOnDebug" } | %{ $_.Value = $False} }
@howellcc
howellcc / CreateBackDatedFiles.ps1
Created August 27, 2019 21:23
Create Backdated test files
# This script creates a series of text files and back-dates the createTime, modifiedTime and accessedTime.
# I wrote it to test deleting of files X number of days old. It creates the following files:
# 1days.txt - which is 1 day old
# 2days.txt - which is 2 days old
# .... you get the idea.
$destfolder = "C:\Users\{username}\temp";
$numFilesToCreate = 500;
For($i=1; $i -le $numFilesToCreate; $i++){
@howellcc
howellcc / RecursiveFileListing.ps1
Created May 13, 2019 19:39
Recursive File Listing
Get-ChildItem -Path .\ -Recurse | ForEach-Object { $_.FullName }
@howellcc
howellcc / FixNumlock.ps1
Last active March 1, 2019 21:19
Powershell script for turning Numlock on when its off
#I added this to task scheduler
#Triggers: on Login and on unlock
#action: Powershell.exe
#action Arguments: -ExecutionPolicy Bypass {PATH}\NumLockFix.ps1
if(-not [console]::NumberLock){
$w = New-Object -ComObject WScript.Shell;
$w.SendKeys('{NUMLOCK}');
}
@howellcc
howellcc / proppriv.snippet
Created January 3, 2019 16:39
Visual Studio text expansion snippet for private properties with public accessor
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Private Property With Public Accessor</Title>
<Shortcut>proppriv</Shortcut>
<Description>Code snippet for a private property with a public accessor.</Description>
<Author>howellcc</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@howellcc
howellcc / propn.snippet
Last active January 3, 2019 16:20
Visual Studio snippet for creating properties that include OnPropertyChanged
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Property With Change Event</Title>
<Shortcut>propn</Shortcut>
<Description>Code snippet for property that calls RaisePropertyChanged and XML description</Description>
<Author>howellcc</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@howellcc
howellcc / RotateImage.cs
Created November 16, 2018 16:13
Rotate Image by Exif Data
public static byte[] RotateImageByExifData(byte[] imgDataBytes, bool updateExifData = true)
{
try
{
using(MemoryStream origImageStream = new MemoryStream(imgDataBytes))
{
using(MemoryStream rotatedImageStream = new MemoryStream())
{
using(Image image = Image.FromStream(origImageStream, false, false))
{
@howellcc
howellcc / loadtestdata.bat
Created June 29, 2018 19:25
Batch script for clearing and reloading test data
@echo off
REM This file relies on the existence of C:\my.ini with the following contents
REM [client]
REM user=[username]
REM password=[password]
REM Ask user for dbname
SET /p dbname="Database Name: "