Skip to content

Instantly share code, notes, and snippets.

View mengjiann's full-sized avatar
🤔
code. code.

MJ mengjiann

🤔
code. code.
  • Illumina
  • Singapore
View GitHub Profile
@mengjiann
mengjiann / gist:91b604fd2e0f09f60ce86331448bc9f7
Created May 12, 2019 15:31
Kubernetes - Kong Dashboard
apiVersion: v1
kind: Service
metadata:
name: kong-dashboard-admin
spec:
type: LoadBalancer
loadBalancerSourceRanges:
- 0.0.0.0/0
ports:
- name: kong-dashboard-admin
# Docker’s commit command allows users to take a running container and save its current state as an image
docker commit ${container-id} ${image-name}
# Export the image as tar
docker save ${image-name} > ./{image-tar-name}.tar
# Load a tar image
docker load < ${image-tar-name}.tar
@mengjiann
mengjiann / state-choice.json
Last active April 7, 2019 16:12
Sample States for AWS Step Functions
{
"send-notification-if-less-than-5": {
"Comment": "A choice state to decide to send out notification for <5 or trigger power of three lambda for >5.",
"Type": "Choice",
"Choices": [
{
"Variable": "$",
"NumericGreaterThanEquals": 5,
"Next": "power-of-three-lambda"
# Add a new tag
git tag -a "v1" -m "Rolled out new changes"
# Push tags to remote
git push --tags
# Remove tag
git tag -d v1
# Remove tag from origin
@mengjiann
mengjiann / gist:156a5b3a3da3785353ff706c0976b617
Created April 4, 2019 06:56
Verizon Edgecast Curl Request
curl -sD- -H x-ec-debug:cache-verbose,x-ec-cache,x-ec-check-cacheable,x-ec-cache-key,x-ec-cache-state -H "Origin: https://www.google.com" https://www.google.com
# stop the ecs agent
sudo stop ecs
# remove exited container
docker ps -qa --filter "status=exited" | xargs docker rm
# prune unused docker volume
docker volume prune
# stop the ecs agent
@mengjiann
mengjiann / gist:5fed0cbdadc79b4a187cb5f8755a3995
Created April 2, 2019 16:18
Restricting AWS S3 Bucket Access from Defined IP Address
{
"Version": "2012-10-17",
"Id": "S3PolicyIPRestrict",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
Under normal mode
- daw - delete a word
- caw - delete a word and enter into edit mode.
Navigate
- b - previous word
- w - next word
- Ctrl+b - previous page
- Ctrl+f - next page
@mengjiann
mengjiann / gist:eec093d884cd402f48785a01de1a8bd7
Created March 24, 2019 07:40
Terminate Spring boot application
SpringApplication springApplication = new SpringApplicationBuilder()
.sources(<class name>.class).web(false).build();
springApplication.run(args).close();
@mengjiann
mengjiann / .zshrc
Last active April 7, 2019 07:21
my .zshrc
plugins=(
git docker docker-compose mvn tmux kubectl zsh-autosuggestions
)
# Pretty Json
alias pjson="python -m json.tool"
# Bind key
bindkey "\e\e[D" backward-word
bindkey "\e\e[C" forward-word