Skip to content

Instantly share code, notes, and snippets.

@WilliamDenniss
WilliamDenniss / upgrade.sh
Created October 17, 2024 00:13
GKE bulk node pool upgrader
#!/bin/bash
# Variables
PROJECT_ID="your-project-id" # Replace with your Google Cloud project ID
CLUSTER_NAME="your-cluster-name" # Replace with your GKE cluster name
LOCATION="us-central1" # Replace with the zone of your cluster, e.g., us-central1-a
# Get the current GKE control plane version
CONTROL_PLANE_VERSION=$(gcloud container clusters describe "$CLUSTER_NAME" \
--location "$LOCATION" \
@WilliamDenniss
WilliamDenniss / install-knative.sh
Last active December 7, 2022 07:43
Installation of Knative on a GKE Autopilot cluster
# Install Knative
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.0.0/serving-crds.yaml
kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.0.0/serving-core.yaml
# Autopilot Mod: Remove annotation
kubectl patch -n knative-serving deployment activator --type=json -p='[{"op":"remove","path":"/spec/template/metadata/annotations/cluster-autoscaler.kubernetes.io~1safe-to-evict"}]'
kubectl patch -n knative-serving deployment autoscaler --type=json -p='[{"op":"remove","path":"/spec/template/metadata/annotations/cluster-autoscaler.kubernetes.io~1safe-to-evict"}]'
kubectl patch -n knative-serving deployment domainmapping-webhook --type=json -p='[{"op":"remove","path":"/spec/template/metadata/annotations/cluster-autoscaler.kubernetes.io~1safe-to-evict"}]'
kubectl patch -n knative-serving deployment webhook --type=json -p='[{"op":"remove","path":"/spec/template/metadata/annotations/cluster-autoscaler.kubernetes.io~1safe-to-evict"}]'
@WilliamDenniss
WilliamDenniss / .tmux.conf
Created November 14, 2020 22:22
William's tmux Config
#ref: https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
/*! @file OIDExternalUserAgentIOSSafariViewController.h
@brief AppAuth iOS SDK
@copyright
Copyright 2018 Google Inc. All Rights Reserved.
@copydetails
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@WilliamDenniss
WilliamDenniss / AppAuthCustomBrowser.md
Last active March 24, 2020 14:06
AppAuth for iOS with Custom Browser

Custom Browser support for AppAuth for iOS has been implemented. Here's how to configure AppAuth to use a custom browser:

First, add the following array to your Info.plist (in XCode, right click -> Open As -> Source Code)

	<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>googlechromes</string>
		<string>opera-https</string>
		<string>firefox</string>
@WilliamDenniss
WilliamDenniss / archive_branch.sh
Created September 17, 2017 20:04
Creates a tag with a common format for an old branch, gives instructions to delete.
#!/bin/bash
git tag -a archive/$1 $1 -m "Archive of branch $1."
echo "Branch: `git rev-parse $1`"
echo "Tag: `git rev-list -n 1 archive/$1`"
echo "Run: git push origin --delete $1"
echo " git branch -d $1"
@WilliamDenniss
WilliamDenniss / Dockerfile
Created September 17, 2017 18:18 — forked from buth/Dockerfile
Docker Install ImageMagick
RUN \
curl -sfLO http://www.imagemagick.org/download/ImageMagick-6.9.0-4.tar.gz && \
echo 'cf51a1c6ebf627c627a8e6ac20aecce5f1425907c2cdb98c5a60f329c5c6caf2 ImageMagick-6.9.0-4.tar.gz' | sha256sum -c - && \
tar -xzf ImageMagick-6.9.0-4.tar.gz && \
cd ImageMagick-6.9.0-4 && \
./configure --prefix /usr/local && \
make install && \
cd .. && \
rm -rf ImageMagick*
@WilliamDenniss
WilliamDenniss / count_helm_tests.sh
Last active June 23, 2017 22:58
Counts the number of helm tests in subfolders
#!/bin/bash
# Iterates all subdirectors of the current path.
for d in */ ; do
# Count instances of test annotations in folder.
COUNT=`egrep -r "test-success|test-failure" "$d" | wc -l`
# Colors!
COUNT_COLOR=$([ $COUNT -gt 0 ] && echo "$(tput setaf 2)" || echo "$(tput setaf 1)")
@WilliamDenniss
WilliamDenniss / AppAuthExampleViewController.m
Created February 20, 2016 02:25
Creating an authorization request with AppAuth using the 'plain' PKCE challenge method.
// builds authentication request
NSString *state = [OIDAuthorizationRequest generateState];
NSString *codeVerifier = [OIDAuthorizationRequest generateCodeVerifier];
OIDAuthorizationRequest *request =
[[OIDAuthorizationRequest alloc] initWithConfiguration:configuration
clientId:kClientID
scope:@"openid profile"
redirectURL:redirectURI
responseType:OIDResponseTypeCode
state:state
@WilliamDenniss
WilliamDenniss / extractcomment.py
Last active August 12, 2017 02:48 — forked from mikeshi80/extractcomment.py
Extract the comments from the C/C++ style source code to the same name add .cmt ext name. Usage is `python extractcomment.py topdir .ext1 .ext2 ...`. You can set the encoding to read and write file correctly. Reference the source here http://www.cppblog.com/luyulaile/archive/2012/12/03/195907.html
#!/usr/bin/env python
import sys
import re
import os.path
import codecs
import os
encoding = 'cp932'