Skip to content

Instantly share code, notes, and snippets.

View ChenLiZhan's full-sized avatar

Lee Chen ChenLiZhan

View GitHub Profile
@ChenLiZhan
ChenLiZhan / dex.md
Last active January 3, 2021 15:00
dex.md
靈巧 物攻
1805 40455
1776 39922
1486 32001
1375 29442
1187 24806
1092 23172
1085 22695
1010 21950
@ChenLiZhan
ChenLiZhan / ip_policy.json
Created July 19, 2018 03:37
S3 bucket policy for hosting static website with IP limitation
{
"Version": "2012-10-17",
"Id": "S3PolicyId1",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::BUCKET_NAME/*",
@ChenLiZhan
ChenLiZhan / public_policy.json
Last active July 19, 2018 03:36
S3 Bucket Policy for Hosting static website
{
"Version": "2008-10-17",
"Id": "b2cc31d0-cc91-4285-a658-473099d2c867",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@ChenLiZhan
ChenLiZhan / uuid.js
Created March 12, 2018 05:20
Generate uuid with JavaScript
function _uuid() {
var d = Date.now();
if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
d += performance.now(); //use high-precision timer if available
}
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
https://philipzheng.gitbooks.io/docker_practice/content/basic_concept/image.html
@ChenLiZhan
ChenLiZhan / Phase.1 検索一覧APIs & Responses.md
Last active March 9, 2017 02:23
Phase.1 検索一覧APIs & Responses

GET /api/vXXX/photos

  • 使えるquery params:
    1. q (free word)
    2. tags (tags list)
    3. equipments (equipments list)
    4. hours (hours list)
    5. months (months list)
    6. sort (sort type, i.e. date or popularity)
    7. lat (latitude)
    8. long (longitude)
@ChenLiZhan
ChenLiZhan / React Environment.md
Last active January 24, 2017 09:40
Setting development for React app
  • 新建webpack.json.js
module.exports = {
  entry: './src/index.js',

  output: {
    filename: 'bundle.js'
  },

 module: {
@ChenLiZhan
ChenLiZhan / Elasticsearch.md
Last active February 2, 2017 05:41
Note for Elasticsearch

名詞解釋

Relational DB -> Server -> Databases -> Schema -> Tables -> Rows -> Columns
Elasticsearch -> Node -> Indices -> Mapping -> Types  -> Documents -> Fields
  • 在 Elasticsearch 當中,每個儲存 Document 的動作我們稱之為 Indexing(索引)
  • Shard:通常叫做分片,這是 Elasticsearch 提供分散式搜尋的基礎,其含義是將一個完整的 Index 分成若干部分,儲存在相同或不同的 Node 上,這些組成 Index 的部分就叫做 Shard。
  • Replica:意思跟 Replication 差不多,就是 Shard 的備份,所以一個 Index 的 Shard 數量就等於 Shard × (1 + Replica)。
  • 映射(mapping)用於進行字段類型確認,將每個字段匹配為一種確定的數據類型(string, number, booleans, date等)。
@ChenLiZhan
ChenLiZhan / AWS VPC.md
Created January 23, 2017 04:49
Note for AWS VPC

Instructions of creating AWS VPC

  • Classes Inter-Domain Routing (CIDR) 用於給用戶分配 IP 位址以及在網際網路上有效地路由 IP 封包的對 IP 位址進行歸類的方法
  • CIDR 是一個按位,並且基於字首位數,用於解釋 IP 位址的標準
  • 假設有一 IP 位址為 A.B.C.D/N,斜線後面的數字 N 即為字首長度,也就是從左到右,被位址塊裡的位址所共享的位的數目。如果有一 IP 位址的前 N 位與一個 CIDR 位址塊的字首相同的話,那麼就說明這個 IP 位址屬於這個 CIDR 位址塊
@ChenLiZhan
ChenLiZhan / AWS EC2.md
Last active January 23, 2017 03:23
The note of Amazon EC2

Amazon Elastic Compute Cloud(EC2)

Amazon Elastic Compute Cloud(EC2) is a web service that provide resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.

The simple interface makes us obtain and configure capacity with minimal friction

Verifying Region in the AWS console

Most of the Amazon Web Services offer a regional endpoint to the requests to reduce the data latency in the applications. An endpoints is a URL that is the entry point for a web service. You can choose multiple locations to place your EC2 instance on. Amazon EC2 locations are composed of regions that contain Availability Zone. Regions are located in seperate geographic areas (US, EU, etc.). Availability Zones are distinct locations within a region that are engineered to be isolated from failures in other Availability Zones and to provide