Skip to content

Instantly share code, notes, and snippets.

so0k so0k

Block or report user

Report or block so0k

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@so0k
so0k / postgres-cheatsheet.md
Last active Feb 5, 2019 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@so0k
so0k / play_with_moby.md
Last active Jun 26, 2017
Docker Singapore - Play with Moby
View play_with_moby.md

Play with Moby - Docker Singapore - June 2017

  • Driven by yaml file which defines the assembly we want to create:

    1. kernel (to build bootable vm, stored under /boot) ~> see kernel files info should point to container image which has kernel file (i.e. bzImage) and tar with kernel modules
    2. init: list of images used for init system (unpacked into root filesystem). In case of LinuxKit system this should bring up containerd and system containers
@so0k
so0k / print_values.py
Created Jun 15, 2017
Print Helm's Values.yaml
View print_values.py
import yaml
print_format="| {parameter:<40}| | {default:<50}|"
def walk_dict(d,keys=[],depth=0):
for k,v in sorted(d.items(),key=lambda x: x[0]):
keys.append(k)
if isinstance(v,dict):
walk_dict(v,keys,depth+1)
else:
print(print_format.format(parameter='`{0}`'.format(".".join(keys)),default='`{0}`'.format(v)))
@so0k
so0k / README.md
Created May 11, 2017
Wait until a port is up
View README.md

Use netcat to wait until port 8080 is open

while ! nc -z localhost 8080; do sleep 0.1; done; echo test

in a separate session open port 8080 (using netcat):

nc -l 8080
@so0k
so0k / README.md
Last active Nov 14, 2019
Alpine-shell
View README.md

Getting an Alpine shell

Often usefull for in-cluster debugging.

$ kubectl run --generator=run-pod/v1 --image=alpine:3.5 -it alpine-shell -- /bin/sh

detach (without killing the container):

View keybase.md

Keybase proof

I hereby claim:

  • I am so0k on github.
  • I am so0k (https://keybase.io/so0k) on keybase.
  • I have a public key ASDaffdVrhOLCfx0kMlQsvx-HA8ygWIhW3IpSrvYEFVP6Qo

To claim this, I am signing this object:

@so0k
so0k / README.md
Last active Apr 19, 2018
AWS CLI ElasticBeanstalk ec2 Queries
View README.md

AWS CLI snippets

The AWS Command Line Interface is a very powerfull ally to anyone managing AWS Infrastructure.

While automating infrastructure with Terraform, some configuration can be quickly retrieved using AWS CLI.

Alternatively, some information is hard to piece together from the AWS console, in which case terminal scripts can provide fast and simple windows into your cloud.

AWS Documentation

View Minikube-error.md
$ minikube version
minikube version: v0.14.0
$ minikube start
Starting local Kubernetes cluster...
E0108 18:19:32.625802   27742 start.go:94] Error starting host: Temporary Error: Error configuring auth on host: Too many retries waiting for SSH to be available.  Last error: Maximum number of retries (60) exceeded.
@so0k
so0k / kubectl.md
Last active Dec 8, 2019
Playing with kubectl output
View kubectl.md

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
@so0k
so0k / 00-README.md
Last active May 26, 2018
Cog Multi Pod deployment with external Postgres
View 00-README.md

Deploying Cog on Kubernetes (on AWS)

Note: Use the excellent helm chart - ohaiwalt/cog-helm to get up quickly on k8s

Follow the guide below to understand the inner workings a bit better.

We will be creating 1 deployment for the cog server and 1 deployment for the relay server.

We chose to run Postgres outside the Kubernetes cluster and provide instructions how to expose all service ports on a single ELB.

You can’t perform that action at this time.