tutorial

DynamoDB - quick review of concept and tutorial (hands-on with Python)

Concept TL;DR: DB consists of tables, and items in table have sort of “kay-value”. The main contents (attributes, ~values of key-value) is json. Table In table, we put items. Each items has “attributes”. Every items must have a “partition key (or primary key)” attribute. Each items could have “sort key” attribute. “We can think of the parition as a folder/bucket which contains items. And the sort key orders the items within the folder/bucket.

Packer - tutorial

Install https://learn.hashicorp.com/tutorials/packer/get-started-install-cli I installed pre-compiled version from the official download page (just download a binary). cd /usr/local/src sudo curl https://releases.hashicorp.com/packer/1.7.6/packer_1.7.6_linux_amd64.zip -O sudo unzip packer_1.7.6_linux_amd64.zip sudo mv packer /usr/bin/ packer version Use Build a Docker image mkdir packer_tutorial cd packer_tutorial touch docker-ubuntu.pkr.hcl In the file docker-ubuntu.pkr.hcl, we define how to set up Pakcer environment and how to build artifacts (images/containers/VMs/etc.). docker-ubuntu.pkr.hcl: packer { required_plugins { docker = { version = ">= 0.

QEMU+KVM - Tutorial

Overview QEMU https://de.slideshare.net/ChiaweiWang3/qemu-introduction ISA: Instruction Set Architecture Virtualization:Emulation = (Host ISA = GuestISA):(Host ISA can be differ from Guest ISA) QEMU stands for Quick EMUlator. Guest ISA -> TCG (Tiny Code Generator, IR code) -> Host ISA Code-Block based Translation -> effective (not one to one translation) Translation Block cache is also the reason QEMU is “fast”. QEMU process memory: https://wiki.xenproject.org/wiki/Weekly-report:20170227-20170305 KVM https://searchservervirtualization.techtarget.com/feature/Whats-the-difference-between-Type-1-and-Type-2-hypervisors https://www.how2shout.com/linux/how-to-install-qemu-kvm-and-virt-manager-gui-on-ubuntu-20-04-lts/ KVM stands for Kernel Virtual Machine. Type1 hypervisor and Type2 hypervisor.

Sonarqube

I tried SonarQube locally. Overview There are two servers. SonarQube and SonaScanner In this example, run SonarScanner with by CLI. The scan data will send to SonarQube. Getting started SonarQube (Docker) Run SonarQube on Docker: docker run -d --name sonarqube -p 9000:9000 sonarqube:8.9-community After that, Browse http://localhost:9000 Log in with admin/admin, and update your password Add a project, and get token. Project key: mytest Display name: MyTest Name of token: myToken Token (in my case): df19e6fee8433d746e65e0043976043fe059aa57 SonarScanner (Docker) Note the network of the SonarQube Docker container:

Use Decorator in Python

Let’s grasp the concept of decorator in Python PEP 318 with short snippets. Step 1: Function as a parameter def f1(): print("Called f1.") def f2(f): f() f2(f1) # Called f1 f2 takes a function (object) as a parameter. Step 2: Wapping function def f1(fun): def wrap(): print("Start wrap") fun() print("End wrap") return wrap def f(): print("In function f") f1(f)() ### python test.py #Start wrap #In function f #End wrap Step 3: Use decorator def f1(fun): def wrap(): print("Start wrap") fun() print("End wrap") return wrap @f1 def f(): print("In function f") f() ### python test.

NVM

What’s nvm Node.js Version Manager. Like pyenv in Python. One difference from Pyenv is, you can’t label a name to the environment. package.json manage the libraries. Install Follow the official document. https://github.com/nvm-sh/nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash ..... (simple results) Check. $ nvm --version 0.39.0 $ node Command 'node' not found, but can be installed with: sudo apt install nodejs Install Node.js and switch versions # Current available Node.js on the local machine nvm ls # List all available versions nvm ls-remote # Use latest version nvm install node # "node" is an alias for the latest version nvm use node # Use speccific version nvm install 14.

Serverless framework - Getting Started with Python

I tried Serverless framework with Python+AWS Lambda. Prerequirement Node.js and npm: $ node -v v10.19.0 $ npm -v 7.5.2 Install I created my serverless account with Google SSO: sudo npm install -g serverless Hello world Create a project: $ serverless Serverless: No project detected. Do you want to create a new one? Yes Serverless: What do you want to make? AWS Python Serverless: What do you want to call this project?

Cognito - tutorial

First thing you should decide We should decided “User pool” or “Identity pool”. Here is the official blog post about the differences. https://aws.amazon.com/de/premiumsupport/knowledge-center/cognito-user-pools-identity-pools/ In a nut shell, User pools are for authentication (identify verification), and Identity pools are for authorization (access control). I’ll try an User pool. Future scope: integrate with AppSync. Tutorial 1. Create an User pool I followed the link. Very easy. https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-user-pool.html Choose Manage User Pools. Manage User Pools.

MongoDB - Tutorial

Good tutorial video https://www.youtube.com/watch?v=pWbMrx5rVBE Handson Install on Ubuntu sudo su wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list apt update sudo apt install -y mongodb-org systemctl start mongodb Playground in local Docker container docker run -p 27017:27017 -d mongo:5.0-focal Toolkit curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.3.0.deb -O sudo apt install ./mongodb-database-tools-ubuntu2004-x86_64-100.3.0.deb Mongo shell mkdir mongosh cd mongosh curl https://downloads.mongodb.com/compass/mongosh-0.8.3-linux.tgz -O tar -zxvf mongosh-0.

WASM by Rust - Tutorial

Tutorial The URL I followed. https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm Pre-requirement You should install npm beforehand. To compile wasm-pack, apt install -y build-essential and install gcc. In case of Ubuntu, apt install -y libssl-dev pkg-config. Download wasm-pack To build the package, we need an additional tool, wasm-pack. This helps compile the code to WebAssembly, as well as produce the right packaging for npm. cargo install wasm-pack Write codes cargo new --lib hello-wasm cd hello-wasm src/lib.