Code Monkey home page Code Monkey logo

til's Introduction

TIL - Today I Learned

Learn and Be Curious: Leaders are never done learning and always seek to improve themselves. They are curious about new possibilities and act to explore them.

GitHub license GitHub stars

A collection of concise write-ups on small things I learn day to day across a variety of things: technologies (mostly), my hobbies, tips...

There are things that don't really warrant a full article. TILs are short Markdown notes, and they might be incomplete (mostly) 🙇 🙇

Here is til's guideline: Assume that you want to find about <keyword> (replace <keyword> with your actual one), do the follow steps:

  • Come to this page.
  • Hit S to search over this repository, enter your <keyword>.
  • If the above steps return nothing useful, hit T to perform a fuzzy search files through repository. Continue type <keyword>.
  • Maybe I don't write (and know) about <keyword>, continue your search somewherelse. Good luck 🙇

til's People

Contributors

ntk148v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

til's Issues

NoSQL Database Design & Data Modeling


title: NoSQL Database Design & Data Modeling
path: nosql/database-design-data-modeling.md

Source: https://www.mongodb.com/nosql-explained/data-modeling

Schema Design for NoSQL Databases

  • NoSQL databases are designed to store data that does not have a fixed structure.
  • Fundamental property: the need to optimize data access.
  • How users will query the data and how often.
  • How often will data be updated?

NoSQL Data Modeling

  • Each of the 4 main types of NoSQL databases is based on a specific way of storing data.
  • Document Store: Data and metadata are stored hierarchically in JSON-based documents inside the database. (query language)
  • Key Value Store: The simplest of the NoSQL databases, data is represented as a collection of key-value pairs. (direct request method)
  • Wide-Column Store: Related data is stored as a set of nested-key/value pairs within a single column. (direct language)
  • Graph Store: Data is stored in a graph structure as node, edge, and data properties. (specialized query language)

HTTP Headers


title: HTTP Headers
path: web-dev/http-headers.md

Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers

HTTP headers let the client and the server pass additional information with an HTTP request or response.

I don't aim to list all headers here, just some interested me.

1. Accept-Ranges and Range

  • When working with Golang HTTP client to download file, I find out these two headers.
  • Accept-Ranges HTTP response header is a marker used by the server to advertise its support for partial requests from the client for file downloads. The value of this field indicates the unit that can be used to define a range.
  • In the presence of an Accept-Ranges header, the browser may try to resume an interrupted download instead of trying to restart the download.
Accept-Ranges: <range-unit>
Accept-Ranges: none
  • If server implements partial downloads, client can use Range HTTP request header to indicate the part of a document that the server should return.
    • Several parts can be requested with one Range header at once, and the server may send back these ranges in a multipart document.
    • If the server sends back ranges --> 206 Partial Content for the response.
    • If ranges are invalid --> 416 Range Not Statisfiable.
    • The server can also ignore the Range header and return the whole document with a 200.
Range: <unit>=<range-start>-
Range: <unit>=<range-start>-<range-end>
Range: <unit>=<range-start>-<range-end>, <range-start>-<range-end>
Range: <unit>=<range-start>-<range-end>, <range-start>-<range-end>, <range-start>-<range-end>
Range: <unit>=-<suffix-length>
  • So, what can I do with them? You can use them to implement a server that hosts files (Golang http.ServeFile handles Range and Cache for you), then create a parallel download client.

// WIP: Add example here.

Sổ đỏ và Sổ hồng


title: Sổ đỏ và Sổ hồng
path: others/so-do-vs-so-hong.md

  • Sổ hồng: “Giấy chứng nhận quyền sở hữu nhà ở và quyền sử dụng đất ở” được cấp bởi Bộ xây dựng trước ngày 10/8/2005, đổi thành “Giấy chứng nhận quyền sở hữu nhà ở, quyền sở hữu công trình xây dựng” và được cấp từ ngày 10/8/2005 đến trước ngày 10/12/2009.
    • Đối tượng sử dụng: được sở hữu bởi chủ nhà, đồng thời là chủ sử dụng đất ở, chủ sở hữu căn hộ trong nhà chung cư.
    • Khu vực được cấp sổ: khu vực cấp sổ là đô thị
    • Loại đất được cáp sổ: cấp ho đất ở đô
  • Sổ đỏ: "Giấy chứng nhận quyền sử dụng đất" do Bộ Tài Nguyên và Môi trường ban hành trước ngày 10/12/2009 với tên gọi pháp lý là “Giấy chứng nhận quyền sử dụng đất.”
    • Đối tượng sử dụng: sổ đỏ chứng minh quyền sử dụng đất và là công cụ bảo vệ quyền hạn, lợi ích của chủ sở hữu đất.
    • Khu vực được cấp sổ: khu vực cấp ngoài đô thị
    • Loại đất được cấp sổ: cấp cho loại đất ở nông thôn, đất nông nghiệp, đất lâm nghiệp, đất nuôi trồng thủy sản và khu làm muối
  • Sổ hồng mới - Sự kết hợp giữa sổ hồng và sổ đỏ: từ ngày 10/12/2009, mẫu Giấy chứng nhận mới, có tên gọi pháp lý "Giấy chứng nhận quyền sử dụng đất, quyền sở hữu nhà ở và tài sản khác gắn liền với đất", là sự kết hợp giữa sổ hồng và sổ đỏ đã được Bộ Tài nguyên và môi trường đưa ra.

Best practices for configuring parameters for MySQL

Feynman Algorithm


title: Feynman Algorithm
path: feynam-algorithm/README.md

Source: http://wiki.c2.com/?FeynmanAlgorithm

The Feynman Algorithm:

  • Write down the problem.
  • Think real hard.
  • Write down the solution.
    The Feynman algorithm was facetiously suggested by Murray Gell-Mann, a colleague of Feynman, in a New York Times interview.

Export public key from WSO2 keystore


title: Export public key from WSO2 keystore
path: wso2/export-pub-key-from-keystore.md

  1. By default, the WSO2 Identity Server keystore is located at <IS_HOME>/repository/resources/security/wso2carbon.jks.
  2. Convert keystore to pkcs12 format. Default password is wso2carbon.
keytool -importkeystore -srckeystore wso2carbon.jks -destkeystore wso2carbon.jks -deststoretype pkcs12
  1. Export public key which can be used to validate JWT Token generated by WSO2.
keytool -export -rfc -alias wso2carbon -keystore wso2carbon.jks -file pub.pem

Consul overview


title: Consul overview
path: consul/README.md

1. Introduction

  • Consul is a service mesh solution providing a full featured control plane with service discovery, configuration, and segmentation functionality.
  • Main features:
    • Service Discovery
    • Health Checking
    • KV Store
    • Secure Service Communication
    • Multi Datacenter

2. Architecture

image

3. Pratical guide

https://www.velotio.com/engineering-blog/hashicorp-consul-guide-1

Differences Between OpenAPI 2.0 and 3.0


title: Differences Between OpenAPI 2.0 and 3.0
path: web-dev/openapi-2-and-3.md

Specification Restructured to Increase Reusability

image

Extended JSON Schema Support

The 3.0 release includes extended support for JSON Schema, which means you can use more JSON Schema keywords than with version 2.0. Some keywords supported in version 3.0 are handled slightly differently than in JSON Schema, including:

  • oneOf
  • anyOf
  • allOf

OpenAPI 2.0 does not support the oneOf or anyOf keywords, but you can use these keywords with version 3.0.

Examples Overhauled for Easy Reusability

Improved Parameter Descriptions

Version 3.0 includes improvements to parameter descriptions. The body and formData parameter types have been removed and replaced with requestBody. The specification supports arrays and objects in operation parameters, and you can specify the method of serialization. Operation parameters include path, query, header, and cookie.

More

Source: https://blog.stoplight.io/difference-between-open-v2-v3-v31

Phân biệt Sketch, Wireframe, Mockup, và Prototype


title: Phân biệt Sketch, Wireframe, Mockup, và Prototype
path: web-dev/phan-biet-sketch-wireframe-mockup-va-prototype.md

Source: https://thinhnotes.com/chuyen-nghe-ba/phan-biet-sketch-wireframe-mockup-va-prototype/

image

Sketch >> Wireframe >> Mockup >> Prototype

Sketch

  • Đơn giản là phác họa, nhanh, không thể hiện tiểu tiết.
  • Ghi nhận nhanh ý tưởng về một chức năng nào đó.
  • Mục đích sử dụng: Khi cần brainstorm.

Wireframe

  • Wireframe là bố cục của UI, mặc dù không quá chi tiết nhưng nó thể hiện rõ được luồng thao tác của người dùng và cấu trúc các nhóm thông tin có trên UI đó.
  • Để làm tốt Wireframe, đòi hỏi phải thực sự hiểu Uservấn đề mình giải quyết ở đây là gì.
  • Mục đích sử dụng: Khi làm user flow.

Mockup

  • Mockup chính là Wireframe, nhưng đầy đủ thông tin và thể hiện được nhiều chi tiết hơn.
  • Khi làm Mockup, cần phải rất rõ User requirement.
    • Màn hình này thuộc chức năng/ nhóm chức năng nào?
    • Màn hình này có nằm trong Business Process Flow nào không?
    • Màn hình này thể hiện những nội dung gì?
    • Input/Output của từng màn hình.
    • Những validation có trên những màn hình này?
  • Mục đích sử dụng: Khi cần xác nhận requirement.

Prototype

  • Prototype là "mẫu thử đầu tiên" của phần mềm/một chức năng của phần mềm, và người dùng có thể tương tác được ngay trên màn hình của chức năng/phần mềm đó.
  • Mockup chỉ thể hiện góc nhìn không gian (có những element nào trên màn hình). Prototype thể hiện luôn được góc nhìn thời gian: hiện tại màn hình như vậy, sau khi nhấn A, màn hình sẽ như vậy, sau khi kéo B, màn hình sẽ chuyển qua như vậy...
  • Mục đích sử dụng: Khi pitching dự án, hoặc kiểm thử/xác nhận requirement.

Berkeley Packet Filter


title: Berkeley Packet Filter
path: bpf/README.md

Source:

  • [Dive into BPF: a list of reading material]

Lava vs Magma


title: Lava vs Magma
path: others/lava-vs-magma.md

Source: https://earthhow.com/lava-magma-difference/

“When volcanoes erupt, magma consists of liquid rock within the interior of the Earth. But as molten rock finds its way to the surface, we refer to it as lava. So, the main difference between magma and lava is location.”

Magma is within the interior of the Earth.

But lava is on the outside.

Systemd-analyze


title: Systemd-analyze
path: linux/systemd-analyze.md

Source: https://www.freedesktop.org/software/systemd/man/systemd-analyze.html

Overview

  • systemd-analyze - Analyze and debug system manager
  • systemd-analyze is used to determine system boot-up performance statistics and retrieve other state and tracing information from the system and service manager, and to verify correctness of unit files. It is also used to access special functions useful for advanced system manager debugging.

Usage

  • systemd-analyze time
# Example 1. Show how long the boot took

# in a container
$ systemd-analyze time
Startup finished in 296ms (userspace)
multi-user.target reached after 275ms in userspace

# on a real machine
$ systemd-analyze time
Startup finished in 2.584s (kernel) + 19.176s (initrd) + 47.847s (userspace) = 1min 9.608s
multi-user.target reached after 47.820s in userspace
  • systemd-analyze blame
# Example 2. Show which units took the most time during boot

$ systemd-analyze blame
         32.875s pmlogger.service
         20.905s systemd-networkd-wait-online.service
         13.299s dev-vda1.device
         ...
            23ms sysroot.mount
            11ms initrd-udevadm-cleanup-db.service
             3ms sys-kernel-config.mount
  • systemd-analyze critical-chain [UNIT...]
# Example 3. systemd-analyze critical-chain
# prints a tree of the time-critical chain of units

$ systemd-analyze critical-chain
multi-user.target @47.820s
└─pmie.service @35.968s +548ms
  └─pmcd.service @33.715s +2.247s
    └─network-online.target @33.712s
      └─systemd-networkd-wait-online.service @12.804s +20.905s
        └─systemd-networkd.service @11.109s +1.690s
          └─systemd-udevd.service @9.201s +1.904s
            └─systemd-tmpfiles-setup-dev.service @7.306s +1.776s
              └─kmod-static-nodes.service @6.976s +177ms
                └─systemd-journald.socket
                  └─system.slice
                    └─-.slice
  • systemd-analyze dump
# Example 4. Show the internal state of user manager

$ systemd-analyze --user dump
Timestamp userspace: Thu 2019-03-14 23:28:07 CET
Timestamp finish: Thu 2019-03-14 23:28:07 CET
Timestamp generators-start: Thu 2019-03-14 23:28:07 CET
Timestamp generators-finish: Thu 2019-03-14 23:28:07 CET
Timestamp units-load-start: Thu 2019-03-14 23:28:07 CET
Timestamp units-load-finish: Thu 2019-03-14 23:28:07 CET
-> Unit proc-timer_list.mount:
        Description: /proc/timer_list
        ...
-> Unit default.target:
        Description: Main user target
...
  • systemd-analyze plot
# Example 5. Plot a bootchart

$ systemd-analyze plot >bootup.svg
$ eog bootup.svg&
  • systemd-analyze dot [pattern...]
# Example 6. Plot all dependencies of any unit whose name starts with "avahi-daemon"

$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg >avahi.svg
$ eog avahi.svg

# Example 7. Plot the dependencies between all known target units

$ systemd-analyze dot --to-pattern='*.target' --from-pattern='*.target' \
      | dot -Tsvg >targets.svg
$ eog targets.svg
  • Want more? Check source for complete guides.

Saving and exiting files


title: Saving and exiting files
path: vim/saving-and-exiting-files.md

Source: https://docstore.mik.ua/orelly/unix3/vi/ch05_03.htm

  • :w Writes (saves) the buffer to the file but does not exit. You can (and should) use :w throughout your editing session to protect your edits against system failure or a major editing error.

  • :q Quits the editor (and returns to the UNIX prompt).

  • :wq Both writes the file and quits the editor. The write happens unconditionally, even if the file was not changed.

  • :x Both writes the file and quits (exits) the editor. The file is written only if it has been modified.

  • What's the difference between :wq and :x? Modification time. If you :x a buffer that hasn’t changed, the modification time will be untouched because the file isn’t re-saved. The :wq command will alter the modification time no matter what.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.