Skip to content

Instantly share code, notes, and snippets.

View cgswong's full-sized avatar

Stuart Wong cgswong

View GitHub Profile
@cgswong
cgswong / kubernetes-war.md
Created January 27, 2020 21:09
Kubernetes Well Architected Review

Kubernetes Well Architected Review (WAR)

Customer: Midas Touch

Date: February 02, 2020

tags: meeting kubernetes EKS WAR

Intent:

  • Increase awareness of architectural best practices
@cgswong
cgswong / generate_cloudfront_signed_cookies.py
Created August 15, 2018 16:03 — forked from mjohnsullivan/generate_cloudfront_signed_cookies.py
Python script that generates signed cookies to control access to CloudFront content
#!/usr/bin/env python
"""
Copyright (C) 2017 Matt Sullivan
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
@cgswong
cgswong / cloudSettings
Last active November 17, 2021 15:49
Terraform debug for access denied
{"lastUpload":"2021-11-17T15:49:50.034Z","extensionVersion":"v3.4.3"}
@cgswong
cgswong / ansible-tester.sh
Created July 27, 2017 17:49
Ansible role tester using Docker
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/ansible-tester.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_name: the role name (default = "${role_name}")
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
@cgswong
cgswong / keybase.md
Created June 1, 2017 13:34
KeyBase proof

Keybase proof

I hereby claim:

  • I am cgswong on github.
  • I am cgswong (https://keybase.io/cgswong) on keybase.
  • I have a public key ASDP9xywaI3f0fjm2DdsvdJQZ_6LJH5WLUbBUwGGxz6k_wo

To claim this, I am signing this object:

@cgswong
cgswong / ssh_complete
Created May 15, 2017 14:14
SSH hostname auto complete
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=$(cat ~/.ssh/config ~/.ssh/conf.d/*.ssh | \
grep "^Host " | grep -v '\*' | uniq | \
awk '{print $2}')
COMPREPLY=( $(compgen -W "${comp_ssh_hosts}" -- $cur))
return 0
}
@cgswong
cgswong / .screenrc
Last active April 7, 2017 15:21
Screen config file
# Force screen to process ^S/^Q
deflogin on
# Autodetach session on hangup instead of terminating screen completely
autodetach on
# Change escape command key invocation
escape ``
# Instead of Control-a, make the escape/command character be Control-s
##escape ^Ss
@cgswong
cgswong / elasticsearch-iam-policy.json
Created March 8, 2017 16:12
AWS ES IAM policy allows both IP access (Kibana proxy) and resource (EC2) access
{
"Version": "2012-10-17",
"Statement": [
{
"Resource": "arn:aws:es:us-east-1:<account_id>:domain/<es_domain>/<es_index|*>",
"Principal": {
"AWS": "arn:aws:iam::<account_id>:role/<iam_role>"
},
"Action": ["es:*"],
"Effect": "Allow",
@cgswong
cgswong / Atom.md
Last active May 15, 2018 15:16
Atom shortcut cheat sheet

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@cgswong
cgswong / iterm2.md
Last active March 25, 2024 08:43
iterm2 shortcut cheat sheet

Note: You may have to go into Preferences (⌘,) -> Profiles -> Keys and enable Left option (⌥) key acts as: +Esc for the option commands to work.

Modifier Symbol
Option
Command
Control
Caps Lock
Shift