Class Note

<aside> <img src="/icons/bug_gray.svg" alt="/icons/bug_gray.svg" width="40px" />

Note

<aside> <img src="/icons/folder_gray.svg" alt="/icons/folder_gray.svg" width="40px" />

In a server node folder: NewProject

<aside> <img src="/icons/snippet_gray.svg" alt="/icons/snippet_gray.svg" width="40px" />

npm.init

The npm init command is used to initialize a new Node.js project and create a package.json file. This file stores metadata about your project, including its name, version, description, entry point, dependencies, and more.

</aside>


Assignment

<aside> <img src="/icons/squeeze-tube_red.svg" alt="/icons/squeeze-tube_red.svg" width="40px" />

VS Code can’t connect to remote host

I was trying to login to my droplet via VS Code, but encountered an error saying: "VS Code Could not establish connection to 'my droplet': Connecting with SSH timed out"

~$ sudo dmesg | grep -i kill

[5810308.157291] systemd-journal invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=-250
[5810308.157342]  oom_kill_process.cold+0xb/0xaf
[5810308.157878] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-11602.scope,task=node,pid=1021040,uid=1000
[5810308.157928] Out of memory: Killed process 1021040 (node) total-vm:33316388kB, anon-rss:98124kB, file-rss:2876kB, shmem-rss:0kB, UID:1000 pgtables:3020kB oom_score_adj:0

The message showed Out of memory error.

I also checked my remaining flash memory:

~$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        24G  5.2G   18G  23% /

I can swap some flash memory into RAM:

acan@understanding-networks-25-dev:~/NodeExamples/newProject$ free -h
               total        used        free      shared  buff/cache   available
Mem:           960Mi       940Mi        69Mi       6.7Mi        54Mi        20Mi
Swap:             0B          0B          0B
acan@understanding-networks-25-dev:~/NodeExamples/newProject$ sudo fallocate -l 2G /swapfile
acan@understanding-networks-25-dev:~/NodeExamples/newProject$ sudo chmod 600 /swapfile
acan@understanding-networks-25-dev:~/NodeExamples/newProject$ sudo mkswap /swapfile
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=3a4739fb-f41a-4a33-bf6e-10a11d3ebebe
acan@understanding-networks-25-dev:~/NodeExamples/newProject$ sudo swapon /swapfile
acan@understanding-networks-25-dev:~/NodeExamples/newProject$ free -h
               total        used        free      shared  buff/cache   available
Mem:           960Mi       897Mi        95Mi       6.7Mi        89Mi        63Mi
Swap:          2.0Gi        67Mi       1.9Gi

And this fixed my issue.

</aside>

<aside>

API up and running!

URI: https://www.rayrayrule.me

How the API works

https://www.rayrayrule.me/entropy/ —>shows a list of entropy value in different elements

https://www.rayrayrule.me/entropy/carbon —>filter out the specific elements

</aside>