Skip to content

Instantly share code, notes, and snippets.

View itskingori's full-sized avatar
🚢
Shipping

King'ori Maina itskingori

🚢
Shipping
View GitHub Profile
@itskingori
itskingori / README.md
Last active July 26, 2019 15:37
Scripts to debug and fix weave CNI issues

Scripts

verify-weave.sh - Goes through all weave pods in the cluster, computes a checksum on the 'status ipam' list and tells you if there are any weave pods that disagree on their peer list. It was used this to identify the different groups of pods in the cluster and decide which we wanted to preserve and which ones we wanted to reset/restart. Another quick script bump-weave.sh - Used to remove the db file and restart for those weave pods we wished to reset.

Source

@itskingori
itskingori / README.md
Last active May 17, 2023 14:42
Handy MySQL Tips & Tricks

MySQL Notes

Scripts

  1. database-sizes.sql - To determine the sizes of all of your databases.
  2. table-sizes.sql - To determine the sizes of all of the tables in a specific database. Replace database_name with the name of the database that you want to check.
  3. new-database-with-user.sql - To create a new database and a user that has access to that database.
@itskingori
itskingori / Makefile
Created August 20, 2018 21:42
Makefile for generating TLS certs for the Prometheus custom metrics API adapter
# modified from https://github.com/stefanprodan/k8s-prom-hpa/blob/617a98c5d921c3413599bbbb1438dfb125e3bd21/Makefile
SHELL=bash
UNAME := $(shell uname)
PURPOSE:=custom-metrics-adapter
SERVICE_NAME:=custom-metrics-apiserver
ALT_NAMES:="custom-metrics-apiserver.kube-system","custom-metrics-apiserver.kube-system.svc"
SECRET_FILE:=custom-metrics-adapter-serving-certs.yml
certs: gensecret rmcerts
@itskingori
itskingori / README.md
Last active August 21, 2017 22:01
Testing setting environment variables in bash

Running ./test.sh gives the below output:

test1 is empty
test2 is set (empty string)
test3 is set (has string though)
test4 is not set (does not exist at all)
@itskingori
itskingori / docker-issue-sketch.md
Last active August 17, 2016 10:00
An issue I'm experiencing ...

Expected behaviour

The underlying file system on my machine (Mac OS X) is case sensitive (i.e. "foo" and "Foo" are considered to be different files). Mounting a shared directory (e.g. docker run -i -t -v ~/git:/code imagename) should mount as case sensitive, as well.

Actual behavior

Information

  • Diagnostic ID from "Diagnose & Feedback" in the menu.
  • a reproducible case if this is a bug, Dockerfiles FTW
@itskingori
itskingori / aws-ecs-cli-login.sh
Last active April 7, 2017 11:40
Authenticate into AWS ECR. Useful in a CI environment (to push images) ... and so on. If you're unhappy evaluating unvalidated commands ... this adds a regex that checks the output from get-login.
# See https://forums.aws.amazon.com/thread.jspa?threadID=222215
aws_login=$(aws ecr get-login --region us-east-1);
if echo "$aws_login" | grep -q -E '^docker login -u AWS -p \S{1092} -e none https://[0-9]{12}.dkr.ecr.\S+.amazonaws.com$'; then $aws_login; fi
@itskingori
itskingori / bundle-unlock.rb
Created March 2, 2016 15:15
Bundler: Bump 1 gem and touch nothing else with bundle-unlock
#!/usr/bin/env ruby
#
# Updating a gem normally leads to it's dependencies being updates as well.
# This script only removes the gem itself from the lockfile, allowing to update it without
# touching anything else.
#
# bundle-unlock foobar && bundle
# Source: https://github.com/grosser/dotfiles/blob/master/bin/bundle-unlock
@itskingori
itskingori / .irbrc
Created February 19, 2016 14:13 — forked from pjb3/.irbrc
Basic Ruby IRB config
require 'irb/completion'
# History
#require 'irb/ext/save-history' #wirble does history
IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
IRB.conf[:AUTO_INDENT] = true
# use HIRB if available
@itskingori
itskingori / pesapal_controller.rb
Last active October 25, 2016 17:41
Controller example on how to use Pesapal gem ...
module Account
module Payments
class PesapalController < ApplicationController
# GET /account/payments/pesapal/new
def new
# Configure transaction details
pesapal = Pesapal::Merchant.new
pesapal.order_details = {
amount: '<AMOUNT>',
description: '<DESCRIPTION>',