Skip to content

Instantly share code, notes, and snippets.

View charlesa101's full-sized avatar

charles adetiloye charlesa101

View GitHub Profile
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@charlesa101
charlesa101 / kubectl.md
Created March 19, 2020 06:55 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@charlesa101
charlesa101 / gcrgc.sh
Created January 21, 2020 02:43 — forked from ahmetb/gcrgc.sh
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# 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
#
# Unless required by applicable law or agreed to in writing, software
@charlesa101
charlesa101 / postgres-brew.md
Created May 25, 2019 23:46 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
@charlesa101
charlesa101 / postgres-brew.md
Created May 25, 2019 23:46 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@charlesa101
charlesa101 / png_to_polygon_to_geojson.py
Created May 11, 2019 22:20 — forked from urschrei/png_to_polygon_to_geojson.py
Read a PNG into a numpy array, convert it to a Shapely Polygon, and dump it as GeoJSON
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by Stephan Hügel on 2017-03-02
The MIT License (MIT)
Copyright (c) 2017 Stephan Hügel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@charlesa101
charlesa101 / k8s-sa
Created November 11, 2018 14:08 — forked from mreferre/k8s-sa
Kubernetes Service Account
# Inspired by: https://stackoverflow.com/questions/42170380/how-to-add-users-to-kubernetes-kubectl
# this script creates a service account (user1) on a Kubernetes cluster (tested with AWS EKS 1.9)
# prereqs: a kubectl ver 1.10 installed and proper configuration of the heptio authenticator
# this has been tested on Linux in a Cloud9 environment (for MacOS the syntax may be slightly different)
**************************************************
******* Create an account *******
**************************************************
# Create service account for user user1
kubectl create sa user1
@charlesa101
charlesa101 / git-init-repo.sh
Created March 4, 2018 14:16 — forked from aldomann/git-init-repo.sh
Script to initialise Git repository
#!/bin/bash
# Author: Alfredo Hernández <aldomann.designs@gmail.com>
#----- MESSAGE FUNCTIONS -----#
show_info() {
echo -e "\033[1;34m$@\033[0m"
}
show_success() {
echo -e "\033[1;32m$@\033[0m"
}
@charlesa101
charlesa101 / docker
Created November 15, 2017 00:42 — forked from joselo/docker
Docker Useful Commands
# Remove unused images
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")
# Remove dangling images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
# Ejecutar bash dentro de un servicio docker
$ docker-compose exec <service id> bash