Skip to content

Instantly share code, notes, and snippets.

View crazyguitar's full-sized avatar
🎯
Focusing

CHANG-NING TSAI crazyguitar

🎯
Focusing
View GitHub Profile
@crazyguitar
crazyguitar / redis.md
Last active October 12, 2021 03:34
Redis

Redis Note

Features

  • An in-memory database (often shortened to IMDB) which stores data using the main memory of a machine as the primary storage facility, rather than storing the data on a disk as in a typical disk-optimized database.
  • Redis can store a mapping of keys to values (Key-Value Store) and can even achieve similar performance levels as memcached.
  • Redis supports the writing of its data to disk
  • Redis has two different forms of writing in-memory data to disk in a compact format:
    1. point-in-time dump (snapshot): when certain conditions are met (a number of writes in a given period) or when one of the two dump-to-disk commands is called
  1. append-only file: writes every command that alters data in Redis to disk as it happens
@crazyguitar
crazyguitar / tmux-cheatsheet.markdown
Created February 28, 2018 07:14 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@crazyguitar
crazyguitar / docker-swarm.md
Last active November 28, 2018 19:49
docker swarm
@crazyguitar
crazyguitar / it.md
Last active February 27, 2019 06:04
system design

System design

Faas concepts

  1. Event driven system - serverless function usually glue the services together and work properly.
  2. Serverless function was called service bus in the past.
  3. The features of serverless function:
    1. short-lived
    2. not a daemon
  4. stateful
@crazyguitar
crazyguitar / lambda-note-1.md
Last active March 16, 2018 14:17
aws lambda note
@crazyguitar
crazyguitar / boto-note.md
Last active June 24, 2022 18:13
aws resource access note

Boto Note

Quick Start

S3

Before start using boto3, we should set up an user on AWS IAM and grant S3 access permission.

List Buckets

@crazyguitar
crazyguitar / aws-codepipeline.md
Last active March 18, 2018 11:28
aws codestar note

CodeBuid, CodeDeploy, CodePipeline

CodeBuild

Build Spec Syntax

  1. version: Required mapping. Represents the build spec version. We recommend you use 0.2.
  2. env: Optional sequence. Represents information for one or more custom environment variables.
  3. phases: Required sequence. Represents the commands AWS CodeBuild will run during each phase of the build.
  4. artifacts: Optional sequence. Represents information about where AWS CodeBuild can find the build output and
@crazyguitar
crazyguitar / lambda-note-2.md
Last active June 24, 2022 18:05
aws lambda note

Lambda note

Quick Start With DynamoDB

A DynamoDB stream is an ordered flow of information about changes to items in an Amazon DynamoDB table. In this case, lambda function poll the stream of DynamoDB 4 times per seconds and be trigered by an event of DynamoDB stream.

Futher reading:

@crazyguitar
crazyguitar / lambda-note-3.md
Last active March 17, 2018 01:32
aws lambda note

Lambda note

Quick Start with S3

Lambda function can detect events of S3 operations including put, delete, move. Therefore, we can use lambda function to monitor S3 buckets which contain the data we are interesting.

Process the S3 event

First, we git clone the serverless-application-model from GitHub

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.