Skip to content

Instantly share code, notes, and snippets.

View jasonBirchall's full-sized avatar
😶‍🌫️

Jason Birchall jasonBirchall

😶‍🌫️
  • Ministry of Justice
  • London
View GitHub Profile
@jasonBirchall
jasonBirchall / merge_lists.py
Created June 20, 2023 10:39
merge strings alternatively 1778
class Solution(object):
def mergeAlternately(self, word1, word2):
"""
:type word1: str
:type word2: str
:rtype: str
"""
# Pointer initialisation.
i, j = 0, 0
@jasonBirchall
jasonBirchall / 121.go
Created August 25, 2022 11:02
121. Best Time to Buy and Sell Stock
// maxProfit uses the 2 PTR approach to solve the problem.
// Credit goes to neetcode.io https://www.youtube.com/watch?v=1pkOgXD63yU
func maxProfit(prices []int) int {
var (
left = 0 // buy day
right = 1 // sell day
maxProfit = 0
)
if len(prices) == 0 {
### Keybase proof
I hereby claim:
* I am jasonbirchall on github.
* I am json0 (https://keybase.io/json0) on keybase.
* I have a public key ASCF2URR_2MVZ5_wqVUxJcZ2Cyy5gIBC9ZJW35d7UZ9Rpwo
To claim this, I am signing this object:
bash-5.0# kops update cluster
Using cluster from kubectl context: cp-0312-1044.cloud-platform.service.justice.gov.uk
W1203 13:12:31.203714 3441 firewall.go:255] Opening etcd port on masters for access from the nodes, for calico. This is unsafe in untrusted environments.
I1203 13:12:31.206637 3441 executor.go:103] Tasks: 0 done / 115 total; 52 can run
I1203 13:12:31.755058 3441 executor.go:103] Tasks: 52 done / 115 total; 30 can run
I1203 13:12:32.135808 3441 executor.go:103] Tasks: 82 done / 115 total; 23 can run
I1203 13:12:33.662455 3441 executor.go:103] Tasks: 105 done / 115 total; 7 can run
I1203 13:12:33.957819 3441 dnsname.go:111] AliasTarget for "api.cp-0312-1044.cloud-platform.service.justice.gov.uk." is "api-cp-0312-1044-cloud-pl-ol9qam-154071499.eu-west-2.elb.amazonaws.com."
I1203 13:12:34.065153 3441 executor.go:103] Tasks: 112 done / 115 total; 3 can run
@jasonBirchall
jasonBirchall / gist:0a3d8a3c1b225b3d7ad4395083135e69
Last active December 3, 2020 13:48
kops 1.18 upgrade diff
bash-5.0# kops update cluster
Using cluster from kubectl context: cp-0112-1439.cloud-platform.service.justice.gov.uk
]
*********************************************************************************
A new kubernetes version is available: 1.17.14
Upgrading is recommended (try kops upgrade cluster)
More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_k8s.md#1.17.14
@jasonBirchall
jasonBirchall / apply.rb
Created November 22, 2019 12:21
Apply script modified for gpg key creation WIP
#!/usr/bin/env ruby
require File.join(".", File.dirname(__FILE__), "pipeline")
require 'yaml'
require 'json'
require 'base64'
# TODO: Create more descriptive names for gpg key creation
# TODO: Move everything GPG to its own file and require it above
# TODO: Make generate_gpg_key method smaller
@jasonBirchall
jasonBirchall / pod-security-policies.yaml
Created November 19, 2018 18:21
Work done on PSP's
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: privileged
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: "*"
spec:
privileged: true
allowPrivilegeEscalation: true
allowedCapabilities:
resource "kubernetes_service" "helm" {
metadata {
name = "tiller-deploy"
namespace = "kube-system"
labels {
app = "helm"
name = "tiller"
}
}
@jasonBirchall
jasonBirchall / .tf
Created November 1, 2018 14:56
kubernetes_deploy.tf
resource "kubernetes_deployment" "helm" {
metadata {
name = "tiller-deploy"
namespace = "kube-system"
labels {
app = "helm"
name = "tiller"
}
}
@jasonBirchall
jasonBirchall / enable-admission-plugins
Created September 24, 2018 15:03
enable-admission-plugins
enableAdmissionPlugins:¬
228 - Initializers¬
229 - NamespaceLifecycle¬
230 - LimitRanger¬
231 - ServiceAccount¬
232 - PersistentVolumeLabel¬
233 - DefaultStorageClass¬
234 - DefaultTolerationSeconds¬
235 - MutatingAdmissionWebhook¬
236 - ValidatingAdmissionWebhook¬