Skip to content

Instantly share code, notes, and snippets.

View hustshawn's full-sized avatar
🎯
Focusing

Shawn Zhang hustshawn

🎯
Focusing
  • AWS
  • Hong Kong
View GitHub Profile
@hustshawn
hustshawn / ses-email.py
Created February 21, 2019 07:38
A boilerplate of AWS SES email
import boto3
from botocore.exceptions import ClientError
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
# Replace sender@example.com with your "From" address.
# This address must be verified with Amazon SES.
SENDER = "Sender Name <no-reply@example.com>"
@hustshawn
hustshawn / tmux-cheatsheet.markdown
Created January 22, 2019 04:15 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@hustshawn
hustshawn / README.md
Created September 21, 2018 03:45 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@hustshawn
hustshawn / Makefile
Created August 4, 2018 04:01 — forked from ryu1kn/Makefile
Encrypt/decrypt with AWS KMS using AWS cli
# How to encrypt/decrypt your text/blob secret with AWS KMS with AWS cli
KEY_ID=alias/my-key
SECRET_BLOB_PATH=fileb://my-secret-blob
SECRET_TEXT="my secret text"
ENCRYPTED_SECRET_AS_BLOB=encrypted_secret_blob
DECRYPTED_SECRET_AS_BLOB=decrypted_secret_blob # Result of decrypt-blob target
encrypt-text:

Gitlab & CI Setup Guide

This guide includes the Gitlab Setup and CI configuration guide.

Infrastructure

  • a EC2 instance with Ubuntu 16.04(Xenial) in public subnet for Gitlab : m4.large
  • security group with inbound open port: 22/80/443
  • a EC2 instance with Ubuntu 16.04(Xenial) for CI
@hustshawn
hustshawn / dev.es
Last active July 19, 2018 04:03
The basic template for Elasticsearch dev
# Search all
GET _search
{
"query": {
"match_all": {}
}
}
# Cluster
GET _cluster/health
@hustshawn
hustshawn / Install_zookeeper.md
Last active September 7, 2018 02:07
kafka ver 2.12-1.0.1

Java8 Install

sudo apt-get update -y
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer -y
sudo java -version

Install zookeeper

#!/bin/bash
DOCKER_LOGIN=`aws ecr get-login --region us-west-2`
${DOCKER_LOGIN}
@hustshawn
hustshawn / elastic_backup_upload_s3.sh
Last active December 8, 2019 23:55
Using elasticdump to download and upload to S3
#!/bin/bash
today=`date "+%Y%m%d"`
echo $today
# Modify the config values here
BUCKET=
ES_DOMAIN=
ES_INDEX=
ES_DUMP_PREFIX=
export AWS_ACCESS_KEY_ID=
@hustshawn
hustshawn / Apache Kafka on Ubuntu.txt
Last active June 11, 2018 10:50 — forked from SemenMartynov/Apache Kafka on Ubuntu.txt
kafka installation on ubuntu 16.04
Install and configure Apache Kafka on Ubuntu 16.04
# preparation
sudo apt-get update -y
1. Install Java (JDK8)::
Add the repository
$ sudo add-apt-repository -y ppa:webupd8team/java