Deno with TypeScript - intro

Install Follow to the official landig page. curl -fsSL https://deno.land/x/install/install.sh | sh Hello world Here is first_script.ts. var msg:string = "Hello world" console.log(msg) This is written in TypeScript. We can run the script by deno {{ your program name}}. Here is an example and result. deno first_script.ts Compile file:///Users/atlex/test/first_script.ts Hello World Run a simple web server with deno Here is the program hellow_serve.ts. import { serve } from "https://deno.land/std@v0.40.0/http/server.ts"; const s = serve({ port: 8000 }); console.

Set up Ubuntu 20.04 server with Nvidia GPU (and spaCy)

After OS install - basical update Upgrade softwares sudo su apt update apt upgrade -y ssh hardening ssh user@newserver.com mkdir .ssh chmod 700 .ssh #copy id_ecdsa.pub in .ssh/authorized_keys chmod 600 .ssh/authorized_keys In /etc/ssh/sshd_config add the following configurations. PermitRootLogin no PubkeyAuthentication yes PasswordAuthentication no After configuration, restart sshd. sudo systemctl restart sshd sudo su passwd # Change root passwd Firewall - ufw https://ubuntu.com/engage/20.04-webinars This comes through the constant security patching process and new features like the Ubuntu Server Live installer, iptables to nftables migration, and more resilient boot loader.

Gitlab community edition - Install and update (on-premise)

Install GitLab with apt (official way as of 2020/08/11) sudo apt update sudo apt upgrade -y sudo apt-get install -y curl openssh-server ca-certificates tzdata sudo apt install -y postfix curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo EXTERNAL_URL="https://{{ your_GitLab_server_domain }}" apt install gitlab-ce ## If you are using internal purpose and use your own domain, auto SSL configuration (ACME) would fail. ## Then, try http (not https) like below. ## sudo EXTERNAL_URL="http://{{ your_GitLab_server_domain }}" apt install gitlab-ce Configure TLS Create TLS self-sign CA certificate.

SSH snippets

Local Port forwarding ssh -L 50088:remote2.myserver.com:80 atlex@remote1.myserver.com SSH portforwarding in backgraound ssh -fNT -L 8888:localhost:8888 myuser@mydomain.com official mannual -f: Requests ssh to go to background just before command execution. -N: Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only). -T: Disable pseudo-tty allocation. Config file Host github.com User git Port 22 Hostname github.com IdentityFile ~/.ssh/id_ecdsa TCPKeepAlive yes IdentitiesOnly yes Host myserver*.com User atlex00 Host gcp User atlex00 Hostname 192.

Use a theme - Learn

The theme - Learn https://themes.gohugo.io/hugo-theme-learn/ When is it good? Write about a theme. hugo new site spec_page cd spec_page git init git submodule add https://github.com/matcornic/hugo-theme-learn.git themes/hugo-theme-learn echo "theme = \"hugo-theme-learn\"" >> config.toml hugo new general/test.md Memo: Your personal page https://github.com/gcushen/hugo-academic

Kubernetes basics - Secret

Concepts We can regard Secret as encrypted ConfigMap. In order to enabling encryption, we should Future scope: how to encrypted??? Secret We should store the key in base64 encode. Suppose we want to store secret value this_is_value with key key_1. First, we should encode the secret value as follow. $ echo -n "this_is_value" | base64 dGhpc19pc192YWx1ZQ== dGhpc19pc192YWx1ZQ== is base64 encoded this_is_value. Now, make a YAML file. apiVersion: v1 kind: Secrets metadata: name: my-secret data: key_1: dGhpc19pc192YWx1ZQ== Even we try to read a value with kubectl describe secrets it doesn’t return a credential.

ENTRYPOINT or CMD

TL;DR Best practice: When your Docker container runs as a daemon, write entrypoint.sh and run it when container starts by ENTRYPOINT. CMD can be overwritten. When ENTRYPOINT, not CMD Suppose you want to run a command when the Docker container starts. In that case, you can use CMD. The following code runs the command sleep 5 when the container starts. FROM Ubuntu CMD sleep 5 # or # CMD ["sleep", "5"] The arguments of CMD can be replaced when its run time command by:

k8s - uncategorized notes

Terminology SDS: Software Defined Storage CRD: Custom Resource Definition (one of kubernetes term) Text formatting of kubectl output -o json, yaml, name, file Ingerss Install nginx ingress controller (official) https://kubernetes.github.io/ingress-nginx/deploy/ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/baremetal/deploy.yaml All components are deployed in the namespace nginx-ingress. Using nodeport. It installs ingress-nginx Controller, not ingress.. https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#using-a-self-provisioned-edge connetct to the controller pod like kubectl exec --stdin --tty ingress-nginx-controller-75f84dfcd7-24vl4 -n ingress-nginx -- /bin/bash. You can find the nginx process is running.

Engines used in browser

Layer Browser engines contain a JS engine. JS engine Chrome, Chromium, Edge: V8 written in C++ Safari: JavaScriptCore FireFox: SpiderMoney IE: Chakra Browser engine a.k.a layout engine, rendering engine. Browser Browser engine Chrome Blink. Written in C++, V8 inside Safari Blink. Written in C++, V8 inside Edge Blink. Written in C++, V8 inside Opera Blink. Written in C++, V8 inside Safari Webkit Firefox Gecko Node.js stack https://medium.com/@chathuranga94/nodejs-architecture-concurrency-model-f71da5f53d1d Top layer: Node.js libraries, written in JS Middle layer: Node.

Memcached

Install in Ubuntu apt install -y memcached Configuration The configuration file is /etc/memcached.conf. There are comment of each options in the default config file. -d -m 256 -p 11211 -u memcache -l 0.0.0.0 -c 1000 -t 2 -b 500 -R 100 -C -d: Run memcached as a daemon. -m: Occupied memory by Memcached in unit of MB. -p: Connection port. -u: User name running Memcached. -l: Listen IP -c: the number of simultaneous incoming connections.