Skip to content

Instantly share code, notes, and snippets.

View pldmgg's full-sized avatar

Paul DiMaggio pldmgg

View GitHub Profile
@pldmgg
pldmgg / MobyLinux.ps1
Created May 8, 2018 14:44
MobyLinux.ps1 Hyper-V VM Management from Docker CE Install
<#
.SYNOPSIS
Manages a MobyLinux VM to run Linux Docker on Hyper-V
.DESCRIPTION
Creates/Destroys/Starts/Stops A MobyLinux VM to run Docker on Hyper-V
.PARAMETER VmName
If passed, use this name for the MobyLinux VM, otherwise 'MobyLinuxVM'
@pldmgg
pldmgg / README.md
Created September 26, 2022 16:43 — forked from jamesramsay/README.md
Gmail: delete old emails automatically

Gmail: delete old emails automatically

Automatically deletes old emails that match the specified label.

Get started

  • Create a new Google Apps Script at https://script.google.com
  • Overwrite the placeholder with the javascript below
  • Update the following constants:
  • LABEL_TO_DELETE: the label that should be have old messages deleted
@pldmgg
pldmgg / Upgrade-PowerShellCore.ps1
Last active January 25, 2021 07:23
Upgrade PowerShell Core On Windows 10 x64
function Upgrade-PowerShellCore {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$False)]
[switch]$PreRelease,
[Parameter(Mandatory=$False)]
[switch]$Silent
)
@pldmgg
pldmgg / restore_docker_containers.sh
Created February 17, 2020 00:02
restore_docker_containers.sh
#!/bin/bash
# Reference: https://github.com/tlaanemaa/backup-docker
# Reference for starting addons via comd line: https://www.reddit.com/r/homeassistant/comments/an8lsl/how_do_you_issue_hassio_cli_commands_in_a/
# Installation of Prerequisites -
#
# sudo apt-get install npm
# sudo npm install -g backup-docker
# sudo apt-get install powershell
# cd ~
@pldmgg
pldmgg / backup_docker_containers.sh
Created February 16, 2020 23:58
backup_docker_containers.sh
#!/bin/bash
# Reference: https://github.com/tlaanemaa/backup-docker
# Reference for starting addons via comd line: https://www.reddit.com/r/homeassistant/comments/an8lsl/how_do_you_issue_hassio_cli_commands_in_a/
#
# Installation of Prerequisites
# sudo apt-get install npm
# sudo npm install -g backup-docker
# sudo apt-get install powershell
# cd ~
@pldmgg
pldmgg / AnacondaEnv.psm1
Last active July 8, 2020 09:00
Set Anaconda Environment in PowerShell
#region >> Helper Functions
function Get-FilePath {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$True)]
[string]$FileNameWExtension,
[Parameter(Mandatory=$True)]
[string[]]$DirectoriesToSearch
@pldmgg
pldmgg / Instructions_For_Set-AnacondaEnv.ps1
Last active July 7, 2020 06:07
Set Anaconda Usage Instructions
# Launch Windows PowerShell 5.1 or PowerShell Core 6.x and download the AnacondaEnv.psm1 Module
# to your Downloads folder (or wherever you like)
PS C:\Users\zeroadmin> $AnaEnvModuleUrl = "https://github.com/pldmgg/misc-powershell/blob/master/MyModules/AnacondaEnv/AnacondaEnv.psm1"
PS C:\Users\zeroadmin> $OutputPath = "$HOME\Downloads\AnacondaEnv.psm1"
PS C:\Users\zeroadmin> Invoke-WebRequest -Uri $AnaEnvModuleUrl -OutFile $OutputPath
# Import the AnacondaEnv Module
PS C:\Users\zeroadmin> Import-Module $OutputPath
# Now the following functions are available to you in your current PowerShell Session: Set-AnacondaEnv, Revert-AnacondaEnv
@pldmgg
pldmgg / UnRaid_HassOS_VM_Setup
Last active May 21, 2020 13:57
UnRaid_HassOS_VM_Setup
##### What You'll Need (assuming your workstation is Windows) #####
- Qemu For Windows: https://qemu.weilnetz.de/w64/
- WinSCP: https://winscp.net/eng/download.php
- 7zip: https://www.7-zip.org/download.html
- The VMDK virtual disk from the Home Assistant website: https://www.home-assistant.io/hassio/installation/
- Access to your UnRaid WebGUI from your Windows workstation
#### Installing Qemu On Your Windows Workstation ####
- Why? Because the virtual disk images provided by the Home Assistant website are not in a format that UnRaid can understand.
@pldmgg
pldmgg / Home_Assistant_Migration_to_HassOS_VM.txt
Last active May 19, 2020 23:43
Home_Assistant_Migration_to_HassOS_VM
##### Make a Snapshot of your existing HA implementation #####
- In the Home Assistant dashboard, navigate Supervisor -> Snapshots. Give the resulting .tar file a name, make sure "Full Snapshot" is checked, and then click "Create".
- Download the resulting snapshot .tar by clicking on it and selecting "Download"
##### Download your preferred virtual appliance containing HassOS #####
- From here (under the "As a virtual appliance" section): https://www.home-assistant.io/hassio/installation/
##### Deploy the VM #####
- How you deploy the VM depends on what hypervisor you're using, so I'm not going to cover that here.
- Whatever hypervisor you use, make sure the VM automatically starts when your host OS starts
@pldmgg
pldmgg / hassio_installer.sh
Last active May 13, 2020 22:26
hassio_installer.sh
#!/usr/bin/env bash
set -e
ARCH=$(uname -m)
DOCKER_BINARY=/usr/bin/docker
DOCKER_REPO=homeassistant
DOCKER_SERVICE=docker.service
URL_VERSION="https://version.home-assistant.io/stable.json"
URL_HA="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files/ha"
URL_BIN_HASSIO="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files/hassio-supervisor"