Skip to content

Instantly share code, notes, and snippets.

View rulai-jianfang's full-sized avatar

Jian Fang rulai-jianfang

  • Rul.ai
  • Campbell, ca 95008
View GitHub Profile
@rulai-jianfang
rulai-jianfang / awslogs.md
Created April 22, 2019 17:41 — forked from achautha/awslogs.md
Monitor Docker container logs with AWS CloudWatch

Monitor Docker container logs with AWS CloudWatch

In this post, we are going to see how to monitor docker logs from AWS Cloudwatch logs. Docker supports different logging drivers one of which is awslogs

For this excersice, Docker container need NOT be running on EC2. We can send docker logs from anywhere to AWS.

Prerequisite

  • Ubuntu 14.04
  • Docker version 1.12 and above
@rulai-jianfang
rulai-jianfang / aws_create_site.yml
Created April 23, 2019 21:56 — forked from ruzickap/aws_create_site.yml
Ansible playbook which creates instances and tag volumes
---
- name: Create Instance in AWS
hosts: localhost
connection: local
gather_facts: false
vars:
aws_access_key: "xxxxxx"
aws_secret_key: "xxxxxx"
security_token: "xxxxxx"
@rulai-jianfang
rulai-jianfang / ansible-nested-variable.yml
Created April 29, 2019 21:39 — forked from enisozgen/ansible-nested-variable.yml
Ansible example which shows how to reach nested variable with dynamic elements
# Example which shows how to reach nested ansible variable which is partially different.
# Run that plabook with ansible-playbook -e "env=test" ansible-nested-variable.yml
---
#
- hosts: localhost
connection : ssh
gather_facts: no
vars:
cidr_blocks:
vpc_production_cidr_block: "10.10.0.0/28"
@rulai-jianfang
rulai-jianfang / ansible-bootstrap-ubuntu-16.04.yml
Created May 13, 2019 21:04 — forked from gwillem/ansible-bootstrap-ubuntu-16.04.yml
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@rulai-jianfang
rulai-jianfang / S3 buckets copy.md
Created June 8, 2019 00:03 — forked from ushu/S3 buckets copy.md
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@rulai-jianfang
rulai-jianfang / cuda_installation_on_ubuntu_18.04
Created June 28, 2019 23:55 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@rulai-jianfang
rulai-jianfang / cuda_installation_on_ubuntu_18.04
Last active June 29, 2019 01:07
cuda 9.0 and docker Nvidia runtime complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@rulai-jianfang
rulai-jianfang / docker.yml
Created September 5, 2019 21:35 — forked from rbq/docker.yaml
Install Docker CE on Ubuntu using Ansible
---
- hosts: all
tasks:
- name: Install prerequisites
apt:
name: ['apt-transport-https','ca-certificates','curl','gnupg2','software-properties-common']
update_cache: yes
- name: Add Docker GPG key
apt_key: url=https://download.docker.com/linux/ubuntu/gpg
@rulai-jianfang
rulai-jianfang / mongo-statefulset.yaml
Created October 26, 2019 23:41 — forked from thilinapiy/mongo-statefulset.yaml
MongoDB statefulset for kubernetes with authentication and replication
## Generate a key
# openssl rand -base64 741 > mongodb-keyfile
## Create k8s secrets
# kubectl create secret generic mongo-key --from-file=mongodb-keyfile
---
apiVersion: v1
kind: Service
metadata:
name: mongo
labels:
@rulai-jianfang
rulai-jianfang / README.md
Created May 3, 2020 03:29 — 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.