tutorial

Code coverage - tutorial

Code coverage Definition from Wikipedia: In computer science, test coverage is a measure (in percent) of the degree to which the source code of a program is executed when a particular test suite is run. Types: Function coverage – has each function (or subroutine) in the program been called? Statement coverage – has each statement in the program been executed? Edge coverage – has every edge in the control-flow graph been executed?

Tokio - Rust Concurrency (draft)

I started to discover Tokio framework. https://tokio.rs/tokio/tutorial You can find all official tutorial code at here. What is Tokio ultimately Asynchronous Rust code does not run on its own, so you must choose a runtime to execute it. Tokio is an asynchronous runtime for the Rust programming language. Handson tutorial with Redis-clone We’ll run a clone of Redis server. While running the redis server, your prompt will be blocked. For someone who doesn’t know about Redis, it is a key-value store server, and you need to follow a redis protocol on TCP/IP.

Lebesgue measure (updating)

My personal motivation(s): want to know when it is allowed to swap limit and sum. want to know when it is allowed to swap limit and integral. want to know what the Lebesgue integral is. want to make a base for probability theory. $\sigma$-algebra Suppose a set $X$ and its power set $\mathcal{P}(X)$. The “measure” will be defined for some elements of $\mathcal{P}(X)$ later. $\Sigma\subseteq\mathcal{P}(X)$ is $\sigma$-algebra if $\phi, X \in \Sigma$, $A\in\Sigma \implies A^c := X\backslash A \in\Sigma$, and $\displaystyle\{A_i\}_{i\in\mathbb{N}} \implies \bigcup_i A_i \in \Sigma$.

GitHub Actions to build/push a Docker image

https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions TL;DR mkdir -p .github/workflows. vim .github/workflows/deploy-image.yml: name: Create and publish a Docker image on: push: branches: ['main'] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: build-and-push-image: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@v2 - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: images: ${{ env.

GitHub Container Registry

https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry TL;DR Get an acccces token (Personal Access Token) https://github.com/settings/tokens/new The only permission required in this post is write:packages. From GitHub point of view, a container in Container Registry is a package. In this post ghp_abcdefghijklMNOpqrstuvwxyz0123456789. Login to the GitHub Container registry ghcr.io. export CR_PAT=ghp_abcdefghijklMNOpqrstuvwxyz0123456789 echo $CR_PAT | docker login ghcr.io -u atlex00 --password-stdin docker tag {{ my_local_image_id }} ghcr.io/atlex00/my-test docker push ghcr.io/atlex00/my-test How to delete https://docs.github.com/en/packages/learn-github-packages/deleting-and-restoring-a-package

Yew Tutorial (v0.19) - part 2

I continued learning Yew after [this post]({{< ref “rust/yew_tutorial_1.md” >}}). Important warning As of Feb. 12 2022, I’ve followed/referred the “Next” version of the Yew documentation (not only v0.19) because there are lots of changes. And I found this statement: You are currently reading about function components - the recommended way to write components when starting with Yew. But we have to note that there is a more advanced, but less recommended way to write them - Struct components

Yew Tutorial (v0.19) - part 1

Before Yew tutorial I want to try with wasm-pack, but after several tries, I realized that it was a bad try. And most parts of the official document uses Trunk, so I was back to Trunk. Please refer to my post about Trunk. Versions Cargo: 1.65 Yew: 0.19 Set up Rust environment for Yew rustup target add wasm32-unknown-unknown cargo install trunk My summary on Yew tutorial page I followed the official “Video page” tutorial.

Trunk (WASM bundler for Rust) - Tutorial

Try Trunk before Yew tutorial Just follow the simplest official tutorial To understand how Trunk behaves. I’ve simply followed the official getting started. Set up: cargo install trunk cargo new trunk-tutorial cd trunk-tutorial Keep the default Hello world code in src/main.rs. Create index.html: <html> <head> <link data-trunk rel="scss" href="index.scss"/> </head> </html> Create empty index.scss, and bild: trunk build Feb 03 18:59:17.553 INFO 📦 starting build Feb 03 18:59:17.555 INFO spawning asset pipelines Feb 03 18:59:17.

Rust - My note of Getting Started (19/21)

What’s this page? As of Dec. 2021, I work as a DevOps engineer, but I like to solve problems with codes (front, back, whatever. it depends on the purposes.) Thesedays, my motivation about learning Rust surged enough. This page is my memo while I’ve learned with Rust official document so that I can easily remind/refer to the key feafures. Most part of this post consist of quotes from the document, but I also leave my opinions (could be wrong.

CloudFormation - Tutorial with an EC2 instance

Important terminology Stack A stack is a collection of AWS resources that you can manage as a single unit. In other words, you can create, update, or delete a collection of resources by creating, updating, or deleting stacks. Resource Unbreakable components, like an EC2 instances, a routing table, VPC, Lambda function, etc. The form of template file The official document was quite comprehensive for me. Parameters: myparam: Type: String Default: foo .