Skip to content

Instantly share code, notes, and snippets.

View mike-weiner's full-sized avatar

Michael Weiner mike-weiner

View GitHub Profile
@mike-weiner
mike-weiner / brew-install-specific-formula.md
Last active April 4, 2024 20:30
An explanation of how to install a specific version of a Homebrew formula.

Install Previous Homebrew Formula

Sometimes you need to install a specific, older version of an existing Homebrew Formula. In this guide I am going to demonstrate how to install an older version of kubectl, but it can be generalized for an Formula.

The Kubernetes CLI is available as a Homebrew Formulae: https://formulae.brew.sh/formula/kubernetes-cli#default

At the time of writing, my only options to install kubectl via Homebrew are:

  • brew install kubectl
    • Would install the default version of v1.29
  • brew install kubectl@1.29 or brew install kubectl@1.28
@mike-weiner
mike-weiner / echoserver-daemonset.yaml
Created March 29, 2024 12:44
A k8s echoserver Daemonset that can be helpful for debugging. Not intended for production use.
# This YAML describes a rudimentary echoserver DaemonSet
# that can be useful for debugging purposes, especially
# when it comes to Services.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: echoserver-debug
namespace: default
labels:
@mike-weiner
mike-weiner / weather-link.py
Last active September 16, 2023 01:02
A Python script to serve as a template for WeatherLink API calls.
@mike-weiner
mike-weiner / weather-link-v2.py
Last active September 16, 2023 01:01
A Python script to serve as a template for WeatherLink API calls using the newer authentication method.
@mike-weiner
mike-weiner / basecamp.py
Last active August 23, 2023 14:36
A Python script to make calls to the Basecamp 4 API via OAuth authentication.
import datetime
import json
import os.path
import requests
# TO DO: Enter Your BC Account ID
# Example: 999999999 from https://3.basecamp.com/999999999/
BC_ACCOUNT_ID = "<your-client-id>"
# Basecamp App Integration Information
@mike-weiner
mike-weiner / weatherlink-stations.sh
Created June 3, 2023 19:48
A curl command to obtain the weather stations that your WeatherLink account has access to.
@mike-weiner
mike-weiner / discord-webhook.sh
Created May 29, 2023 16:06
A curl command to send automated bot messages via a webhook into a Discord channel.
curl \
-H "Content-Type: application/json" \
-d '{"content":"Your bot's message for the Discord channel goes here!"}' \
<your-discord-webhook-url>
@mike-weiner
mike-weiner / videocrop.sh
Last active January 11, 2023 02:48
A bash script that uses FFmpeg to crop a video.
#!/bin/bash
# Function that will print requirements if the user passes in the -help flag as the first argument.
function help
{
echo "Parameters are: "
echo " <filename>: The full filename of the video that you want to crop."
}
# Check for '-help' flag.
@mike-weiner
mike-weiner / git-command-line-prompt.sh
Created May 21, 2022 00:27
Modifies the command line prompt to include Git repository information (if applicable).
# Modifies the Command Line Prompt to the following format:
# <Username> <Current Directory Name> <Current Git Branch Name (if applicable)> %
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats '(%b)'
@mike-weiner
mike-weiner / docker-alias.sh
Created May 21, 2022 00:24
An alias to start Docker Desktop from the command line.
alias startdocker='open -a docker'