Skip to content

Instantly share code, notes, and snippets.

View tillig's full-sized avatar

Travis Illig tillig

View GitHub Profile
@tillig
tillig / Install-DotnetCliTools.ps1
Last active November 7, 2023 15:58
PowerShell script for installing/updating my dotnet CLI global tools
# Tool lists:
# https://github.com/aspnet/AspNetCore/blob/master/src/Tools/
# https://github.com/natemcmaster/dotnet-tools
$tools = @(
'dotnet-counters',
'dotnet-depends',
'dotnet-dump',
'dotnet-format',
'dotnet-guid',
'dotnet-outdated-tool',
@tillig
tillig / kubectl-snippets.md
Last active July 9, 2019 22:16
Helpful snippets for working with kubectl

Queries

Get all pod names in a namespace:

kubectl get pods -n mynamespace -o jsonpath='{.items..metadata.name}'

Delete

Delete all running pods in a namespace:

@tillig
tillig / pilights-install.sh
Last active January 23, 2019 02:46
Pi Lights install/update script
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
scons \
@tillig
tillig / README.md
Last active February 1, 2024 06:13
Send Email Alert on Windows Backup

This allows you to use the Windows Task Scheduler to send an email via PowerShell script when a Windows Backup succeeds or fails.

  • Put the two PowerShell scripts in a secure folder that only the administrator can access. They will have credentials to send email in them.
  • Update the placeholders in each script to allow email to send. Run the scripts to ensure the email goes out.
  • Create a scheduled task that is triggered on an event from the event log. Set up a custom filter and use the backup-failed-filter.xml as the filter. This catches all the backup failure events and will trigger the script. Attach that to the Send-BackupFail.ps1.
  • Create a scheduled task that is triggered on an event from the event log. Attach Send-BackupSuccess.ps1 to that.
    • Log: Microsoft-Windows-Backup/Operational
    • Source: Backup
    • Event ID: 4
@tillig
tillig / Get-M3u8Content.ps1
Last active December 7, 2018 00:38
Download .m3u8 contents for ffmpeg concatenation
<#
.Synopsis
Downloads an M3U8 playlist and the subsequent TS files, ready for combining.
.DESCRIPTION
Using the headers from an authenticated session with a video provider, download the
contents of a playlist and prepare the TS files in the playlist for merging.
Assuming you have your headers exported as JSON like this...
{
@tillig
tillig / Get-KubectlAll.ps1
Last active June 20, 2019 20:22
kubectl get all - namespaced items
<#
.Synopsis
Gets all the entities from a Kubernetes namespace; or, alternatively, the set of all non-namespaced items.
.PARAMETER Namespace
The namespace from which entities should be retrieved. Omit this parameter to retrieve non-namespaced items.
.DESCRIPTION
Gets a list of all the API resources available in the Kubernetes cluster that are namespaced (or non-namespaced,
as the case may be.) Once that list has been retrieved, removes the 'events' objects if there are any (these get
too long and numerous to be valuable), then gets everything as requested.
@tillig
tillig / Vagrantfile
Last active December 12, 2018 23:09
Vagrantfile for a Google/Azure management environment
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Most boxes use 'vagrant' as the username
# but recent Ubuntu builds use 'ubuntu'.
$username = "vagrant"
# Check for required plugins.
# Vagrant 2.1.3, 2.1.4 plugin checks are broken.
# https://github.com/hashicorp/vagrant/issues/10161
@tillig
tillig / dotnet-sdk.cmd
Created July 9, 2018 18:58
dotnet sdk CLI Command
@echo off
rem Fork of https://github.com/faniereynders/dotnet-sdk-helpers/blob/master/dotnet-sdk.cmd to handle errors in downloads.
SET dotnet_releases_url=https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json
SET script_path=%~dp0
SET tools_path=%~dp0
rem FIX: Downloading to temp path to avoid missing directories.
SET download_path=%TEMP%\
@tillig
tillig / Measure-TargetFramework.ps1
Created May 7, 2018 20:51
Analyze .csproj Set With PowerShell
Get-ChildItem -Path C:\path\to\project\root -Filter *.csproj -Recurse |
Select-Xml -Namespace @{msb="http://schemas.microsoft.com/developer/msbuild/2003"} -XPath "//msb:TargetFrameworkVersion" |
Select-Object -Property @{Name="TargetFrameworkVersion"; Expression={$_.Node.InnerXml}} |
Select-Object -ExpandProperty TargetFrameworkVersion |
Group-Object
@tillig
tillig / rotate.md
Created January 13, 2018 19:52
Rotate Video with FFmpeg

Values for the transpose parameter:

  • 0 = 90 counter-clockwise and vertical flip (default)
  • 1 = 90 clockwise
  • 2 = 90 counter-clockwise
  • 3 = 90 clockwise and vertical flip

To rotate 180 degrees, use "transpose=2,transpose=2"

Using -codec:a copy will simply copy the audio instead of reencoding it.