Skip to content

Instantly share code, notes, and snippets.

Avatar

Travis Illig tillig

View GitHub Profile
@tillig
tillig / mac-install.sh
Last active Jul 29, 2020
Automated environment setup for Mac
View mac-install.sh
# Check that Homebrew is installed and install if not
if test ! $(which brew)
then
echo " Installing Homebrew for you."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" > /tmp/homebrew-install.log
fi
# Prep for Homebrew install
echo " Taking ownership of pkgconfig"
sudo chown -R $(whoami) /usr/local/lib/pkgconfig
@tillig
tillig / Switch-NodeJs.ps1
Last active Oct 19, 2020
Switch versions of Node.js using Homebrew
View Switch-NodeJs.ps1
# From
# https://medium.com/@katopz/how-to-install-specific-nodejs-version-c6e1cec8aa11
# See node versions
brew search node
# Remove the existing symlinks
brew unlink node
# Install node at specific version
@tillig
tillig / UnitTest.sublime-commands
Created Mar 15, 2019
User-level script to convert NUnit test fixtures to Xunit with simple regex replacement.
View UnitTest.sublime-commands
[
{
"caption": "Unit Test: NUnit to XUnit",
"command": "nunit_to_xunit"
},
{
"caption": "Unit Test: NUnit to XUnit (Batch)",
"command": "nunit_to_xunit_batch"
}
]
@tillig
tillig / Install-DotnetCliTools.ps1
Created Mar 5, 2019
PowerShell script for installing/updating my dotnet CLI global tools
View Install-DotnetCliTools.ps1
# Tool lists:
# https://github.com/aspnet/AspNetCore/blob/master/src/Tools/
# https://github.com/natemcmaster/dotnet-tools
$tools = @(
'dotnet-depends',
'dotnet-outdated',
'dotnet-format',
'dotnet-script',
'dotnet-symbol',
'dotnetsdkhelpers',
@tillig
tillig / kubectl-snippets.md
Last active Jul 9, 2019
Helpful snippets for working with kubectl
View kubectl-snippets.md

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 Jan 23, 2019
Pi Lights install/update script
View pilights-install.sh
#!/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 Dec 10, 2018
Send Email Alert on Windows Backup
View README.md

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 Dec 7, 2018
Download .m3u8 contents for ffmpeg concatenation
View Get-M3u8Content.ps1
<#
.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 Jun 20, 2019
kubectl get all - namespaced items
View Get-KubectlAll.ps1
<#
.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 Dec 12, 2018
Vagrantfile for a Google/Azure management environment
View Vagrantfile
# -*- 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
You can’t perform that action at this time.