Skip to main content

Posts

Showing posts from 2020

Visual Studio Code : .devcontainer | Dockerfile.yml (mongodb with mongo-express)

version : '3' services : app : build : context : . dockerfile : Dockerfile args : # [Choice] Node.js version: 14, 12, 10 VARIANT : 14 # On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000. USER_UID : 1000 USER_GID : 1000 volumes : - ..:/workspace:cached # Overrides default command so things don't shut down after the process ends. command : sleep infinity # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. network_mode : service:db # Uncomment the next line to use a non-root user for all processes. # user: node # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. # (Adding the "ports" property to this file will not forward from a Codespace.) db : image : mongo:latest restart : unless-stopped volumes : ...
node ➜ /workspace $ yarn init yarn init v1.22.5 question name (workspace): lotto-backend question version (1.0.0): question description: PCSO Lotto BackEnd with Express.Js & MongoDB question entry point (index.js): index.js question repository url: question author: bbytnz question license (MIT): question private: success Saved package.json Done in 330.16s. node ➜ /workspace $ npm install --save express morgan http-errors dotenv npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN lotto-backend@1.0.0 No repository field. + http-errors@1.8.0 + morgan@1.10.0 + express@4.17.1 + dotenv@8.2.0 added 61 packages from 37 contributors and audited 61 packages in 6.877s found 0 vulnerabilities node ➜ /workspace $

docker-compose : mongodb mongo-express redis rediscommander

version : "3" services : redis : image : redis:alpine container_name : redis_db command : redis-server --appendonly yes ports : - 6379:6379 volumes : - ./data:/data restart : always redis-commander : image : rediscommander/redis-commander:latest environment : - REDIS_HOSTS=local:redis:6379 ports : - 8082:8081 depends_on : - redis mongo : image : mongo restart : always ports : - "27017:27017" environment : MONGO_INITDB_ROOT_USERNAME : uroot MONGO_INITDB_ROOT_PASSWORD : usecret volumes : - ./mongo-data:/data/db mongo-express : image : mongo-express restart : always ports : - "8081:8081" environment : ME_CONFIG_MONGODB_ADMINUSERNAME : uroot ME_CONFIG_MONGODB_ADMINPASSWORD : usecret volumes : mongo-data :

Typescript Express Project base

Create repo on github with gitignore set to node $ mkdir <path/foldername> && cd <path/foldername> $ git init $ git remote add origin https://github.com/biboyatienza/typescript-expressjs.git $ git pull origin master $ echo "# typescript-expressjs" >> README.md $ npm init $ git add . $ git commit -m "first commit" $ git push -u origin master $ npm i -D typescript tslint $ npm i express -S $ npm i @types/express -D $ code tsconfig.json {     "compilerOptions": {       "module": "commonjs",       "esModuleInterop": true,       "target": "es6",       "moduleResolution": "node",       "sourceMap": true,       "outDir": "dist"     },     "lib": ["es2015"]   } $ code tslint.json {     "defaultSeverity": "error",     "extends": [         "tslint:recommended"     ],     "jsRule...

PWA - Service Worker

// https://github.com/185driver/pwa-app-updates /* eslint-disable no-undef, no-underscore-dangle, no-restricted-globals */ // This is the code piece that GenerateSW mode can't provide for us. // This code listens for the user's confirmation to update the app. self . addEventListener ( "message" , ( e ) => { if (! e . data ) { return ; } switch ( e . data ) { case "skipWaiting" : self . skipWaiting (); break ; default : // NOOP break ; } }); workbox . core . clientsClaim (); // Vue CLI 4 and Workbox v4, else // workbox.clientsClaim(); // Vue CLI 3 and Workbox v3. // The precaching code provided by Workbox. self . __precacheManifest = []. concat ( self . __precacheManifest || []); // workbox.precaching.suppressWarnings(); // Only used with Vue CLI 3 and Workbox v3. workbox . precaching . precacheAndRoute ( self . __precacheManifest , {}); // END OF => https://github.com/185driver/pwa-app-updates workbox ....

Ubunut 20.04 LTS | Installing vue cli

bboy@LatE7450:~/Documents/Codes$ npm install -g @vue/cli npm WARN deprecated @hapi/joi@15.1.1: joi is leaving the @hapi organization and moving back to 'joi' ( https://github.com/sideway/joi/issues/2411 ) npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained npm WARN deprecated @hapi/address@2.1.4: This version has been deprecated and is no longer supported or maintained npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated urix@0.1.0: Please see https://gi...

Ubuntu 20.04 LTS | Installing curl and yarn

bboy@LE7450:~$ curl Command 'curl' not found, but can be installed with: sudo apt install curl bboy@LE7450:~$ sudo apt install curl [sudo] password for bboy: Reading package lists... Done Building dependency tree       Reading state information... Done The following package was automatically installed and is no longer required:   libfprint-2-tod1 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed:   libcurl4 The following NEW packages will be installed:   curl libcurl4 0 upgraded, 2 newly installed, 0 to remove and 33 not upgraded. Need to get 394 kB of archives. After this operation, 1,115 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://ph.archive.ubuntu.com/ubuntu focal-updates/main amd64 libcurl4 amd64 7.68.0-1ubuntu2.2 [233 kB] Get:2 http://ph.archive.ubuntu.com/ubuntu focal-updates/main amd64 curl amd64 7.68.0-1ubuntu2.2 [161 kB] Fetched 394 kB in 4s (108 kB/s) Selecting previously u...

Ubunut 20.04 LTS | Installing nvm

bboy@LE7450:~$ sudo apt-get update -y bbboy@LE7450:~$ sudo apt-get install build-essential libssl-dev -y bbboy@LE7450:~$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash bbboy@LE7450:~$ source ~/.profile bbboy@LE7450:~$ nvm --version 0.35.3

Ubuntu 20.04 LTS - git installation

bboy@LE7450:~$ git Command 'git' not found, but can be installed with: sudo apt install git bboy@LE7450:~$ sudo apt install git [sudo] password for bboy: Reading package lists... Done Building dependency tree       Reading state information... Done The following package was automatically installed and is no longer required:   libfprint-2-tod1 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed:   git-man liberror-perl Suggested packages:   git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk   gitweb git-cvs git-mediawiki git-svn The following NEW packages will be installed:   git git-man liberror-perl 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 5,464 kB of archives. After this operation, 38.4 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://ph.archive.ubuntu.com/ubuntu focal/main amd64 liberror-perl all 0.17029-1 [26.5 kB] Get:2 http://ph...

Ubuntu 20.04 LTS Take 2! - Needed tools installation

boy@LatE7450:~$ sudo snap install shotcut --classic [sudo] password for bboy: shotcut 20.07.11 from Meltytech, LLC (meltytech✓) installed bboy@LatE7450:~$ sudo snap install libreoffice libreoffice 6.4.5.2 from Canonical✓ installed bboy@LatE7450:~$ sudo snap install vlc vlc 3.0.11 from VideoLAN✓ installed bboy@LatE7450:~$ sudo snap install gimp gimp 2.10.20 from Snapcrafters installed bboy@LatE7450:~$ sudo snap install chromium chromium 84.0.4147.105 from Canonical✓ installed bboy@LatE7450:~$ sudo snap install inkscape inkscape 1.0-b51213c273-2020-08-10 from Inkscape Project (inkscape✓) installed

Ubuntu 20.04 LTS - Installing Libre Office and OBS Studio

Latitude-E7450:~$ sudo snap install libreoffice [sudo] password for biboyatienza: libreoffice 6.4.5.2 from Canonical✓ installed Latitude-E7450:~$ sudo apt install ffmpeg [sudo] password for biboyatienza: Reading package lists... Done Building dependency tree       Reading state information... Done The following package was automatically installed and is no longer required:   libfprint-2-tod1 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed:   i965-va-driver intel-media-va-driver libaacs0 libaom0 libass9 libavcodec58   libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56   libbdplus0 libbluray2 libbs2b0 libchromaprint1 libcodec2-0.9 libdc1394-22   libfftw3-double3 libflite1 libgme0 libgsm1 libigdgmm11 liblilv-0-0   libmysofa1 libnorm1 libopenal-data libopenal1 libopenmpt0 libpgm-5.2-0   libpostproc55 librubberband2 libsdl2-2.0-0 libserd-0-0 libshine3   libsnappy1v5 libsndio7.0 libsord-0-0 libsratom-0-0 libssh-gcrypt-4   l...

RPI3 - Setting Up Web Server on Ubuntu 20.04 Server LTS

bboycan@bboy-Latitude-E7450:~$ ssh ubuntu@192.168.1.5 ubuntu@192.168.1.5 's password: Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-1015-raspi aarch64)  * Documentation:   https://help.ubuntu.com  * Management:     https://landscape.canonical.com  * Support:         https://ubuntu.com/advantage   System information as of Tue Aug 11 14:42:20 UTC 2020   System load:  0.08               Temperature:            44.0 C   Usage of /:   14.1% of 14.30GB   Processes:              132   Memory usage: 27%                Users logged in:        0   Swap usage:   0%                 IPv4 address for wlan0: 192.168.1.5  * Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with    sudo snap install microk8s --channel=1.19/candidate --classic     https://microk8s.io/ has docs and details. 0 updates can be installed immediately. 0 of these updates are security updates. Last login: Tue Aug 11 14:37:25 2020 from 192.168.1.7 ubuntu@ubuntu:~$ sudo apt update Hit:1 http://ports.ubuntu.co...