Skip to content

Instantly share code, notes, and snippets.

View MaxAnderson95's full-sized avatar

Max Anderson MaxAnderson95

View GitHub Profile

Ingress on K3d

  1. Create the cluster: k3d cluster create -p "8081:80@loadbalancer" --servers 3
  2. Deploy a web application kubectl create deployment nginx --image=nginx --replicas=3
  3. Expose the application as a service of type ClusterIP kubectl expose deployment/nginx --port 80 --name nginx
  4. Create an ingress object for the service:
@MaxAnderson95
MaxAnderson95 / Main.groovy
Last active June 22, 2023 18:25
A LogicMonitor EventSource script to alert on badge swipes at a QTS Colo facility
import com.santaba.agent.groovyapi.http.*;
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.Duration
import java.time.format.DateTimeFormatter
import groovy.json.JsonBuilder
DEBUG = true
API_URL = "https://api.qtsdatacenters.com"
USERNAME = hostProps.get("qts.username")
@MaxAnderson95
MaxAnderson95 / cloud-config.yaml
Last active May 22, 2023 18:18
Set proper hostname for Rancher-launched RKE2 clusters
#cloud-config
# Requires that the node template used has the jq utility installed.
runcmd:
- 'hostnamectl set-hostname $(cloud-init query -a | jq -r .v1.local_hostname)'
@MaxAnderson95
MaxAnderson95 / .zshrc
Created December 4, 2022 21:38
Proper zsh keybindings for arrow navigation. Place in your .zshrc file
### ctrl+arrows
bindkey "\e[1;5C" forward-word
bindkey "\e[1;5D" backward-word
# urxvt
bindkey "\eOc" forward-word
bindkey "\eOd" backward-word
### ctrl+delete
bindkey "\e[3;5~" kill-word
# urxvt
@MaxAnderson95
MaxAnderson95 / Today.md
Created November 30, 2022 19:01
A PowerShell function to add to your profile that filters file and folder objects for ones created on today's calendar date

Code

Function Today {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipeline = $True)]
        [System.IO.FileInfo[]]$Files,

        [Parameter(ValueFromPipeline = $True)]
        [System.IO.DirectoryInfo[]]$Folders
@MaxAnderson95
MaxAnderson95 / Get-FolderHash.ps1
Last active September 25, 2019 00:35
Hashes a directory of files and generates a single SHA1 hash
Function Get-FolderHash ($Folder) {
Get-ChildItem $folder -Recurse -Exclude "*.psd1" | Where-Object {!$_.psiscontainer} | ForEach-Object {[Byte[]]$contents += [System.IO.File]::ReadAllBytes($_.fullname)}
$hasher = [System.Security.Cryptography.SHA1]::Create()
[string]::Join("",$($hasher.ComputeHash($contents) | %{"{0:x2}" -f $_}))
}