Posts

Curl

  Open Chrome Developer Tools, go to Network tab, make your request (you may need to check "Preserve Log" if the page refreshes). Find the request on the left, right-click, "Copy as cURL". Paste into curl.sh > bash curl.sh How to convert curl to scrapy https://michael-shub.github.io/curl2scrapy/ ================== > curl -c cookie.txt https://bizportal.go.th/th/Intro > curl -b cookie.txt https://bizportal.go.th/

[Laravel] DigitalPass

'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon https://stackoverflow.com/questions/40459280/docker-cannot-start-on-windows https://medium.com/@jinawongjino/%E0%B8%A1%E0%B8%B2%E0%B8%97%E0%B8%B3-docker-environment-%E0%B8%81%E0%B8%B1%E0%B8%9A-laravel-project-%E0%B8%81%E0%B8%B1%E0%B8%99-25feb02e720f 1.  docker-compose up -d --build   2. set .env #docker build -t <project-name> . #e.g.  docker build -t bizportal . #docker run -dp 3000:3000 <project-name> #e.g. docker run -dp 3000:3000 bizportal/server #How to rename container docker rename admiring_grothendieck bizportal #How to rename image docker image tag 44db5143cbd bizportal/server:latest https://docs.docker.com/get-started/ ==================== > wsl > code . =================== install nginx https://phoenixnap.com/kb/how-to-install-nginx-on-ubuntu-20-04 ==================== sudo apt install php7.4-cli sudo apt-get update sudo apt-get install php-mbstring ------------------ composer requi...

[Vugen] save param/ response

web_reg_save_param("RunStatus",    "LB=HTTP/1.1 ",    "RB=\n",    "Ord=1",    "NotFound=WARNING",    "Search=Headers",   LAST); using {RunStatus} to get the value.   It will return an array object. ------------------- web_reg_find("Search=Headers",    "SaveCount=SuccessCount",    "Text=200 OK",    LAST); using {SuccessCount} to value.   It will return integer. atoi(lr_eval_string("{SuccessCount}")) Reference [1]  https://www.perfmatrix.com/web_reg_save_param/ ========================== Set Timeout Syntax: web_set_timeout("STEP","20"); now the timeout is 20 Seconds... you need add this before the transaction Reference [1]  https://community.microfocus.com/t5/LoadRunner-Enterprise-User/Set-up-a-timeout-period-for-every-transaction-in-LR/td-p/636468 However, wininet doesn't accept any setting on vugen.  It needs to set ReceiveTimeout in registry to update timeout fo...

[Firebase] Free web

Image
We can create free webhosting using firebase. This is really nice and easy. Take a look the youtube link below.

[Firebase] ionic

Image
To connect firebase with ionic firebase login firebase init  Reference [1]  https://www.youtube.com/watch?v=fiRmjngNALA

[React] How to create web application

Image
This blog is going to tell you how to create the web application using React.js 1. Go to react website to get first tutorial https://reactjs.org/tutorial/tutorial.html - Make sure you have a recent version of Node.js installed. - Follow the installation instructions for Create React App to make a new project. Install NodeJS Node >= 8.10 (v13.5.0) and npm >= 5.6 (6.13.4) on your machine. To create a project, run: npx create-react-app my-app  cd my-app  npm start This will let you go to url :  http://localhost:3000/ 2. Install YARN > npm install -g yarn 2. Add bootstrap go to react  https://reactstrap.github.io/ > npm install --save reactstrap react react-dom > npm install --save bootstrap or > yarn add bootstrap reactstrap 4. Add AXIOS > npm install axios --save 5. Add .env to root folder     Define key and value as needed e.g. PORT=3001 Alternative Re...

[Grandma] Run Web & API

Image
Forever We use forever to make server run all the time > sudo npm install -g forever > forever list > forever stop 0 > forever restart 0 > forever -w server.js> forever server.js > forever yarn https Reference [1]  https://www.npmjs.com/package/forever [2]  https://stackoverflow.com/questions/12701259/how-to-make-a-node-js-application-run-permanently 1. Web > node server.js or > forever start -c "node server.js" ./ 2. API > npm start > yarn https or >  forever start -c "npm start" ./ > To support https in loopback

[Version] How to check version of each application or OS

1. CentOS Use any command: > cat /etc/os-release > hostnamectl > rpm -qa centos-release > $ uname -r 2. Node > node -v 3. NPM > npm -v 4. Angular > ng -v 5. Node package > ng -v

[Cheat Sheet] Linux Command

1. Real time monitor CPU/RAM/Disk > top 2. See command history > history | less > history | tail > history 25 3. Exit | less type q 4. Check port using > netstat -tulpn | grep :443 5. Stop service > service httpd stop

[HTTPS] on centos using letsencrypt (Free SSL)

Right now, chrome browser will verify trusted ssl. If you use any ssl cert, it will show some warning which make users feel uncomfortable.  Let's see which ssl we can use for free. I have a chance to try one cert authority names 'Let's encrypt' Please see the instructions how to use it. My Environment 1. CentOS 7 Step  1. Install certbot client.  https://certbot.eff.org/ wget https://dl.eff.org/certbot-auto sudo mv certbot-auto /usr/local/bin/certbot-auto sudo chown root /usr/local/bin/certbot-auto sudo chmod 0755 /usr/local/bin/certbot-auto 2. Run certbot sudo /usr/local/bin/certbot-auto certonly --standalone https://certbot.eff.org/docs/install.html 3. Put your public and private key into secured folder e.g.  /etc/letsencrypt/live/... 4. Run automatic renewal echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew" | sudo tee -a /etc/cron...

[HTTPS] on nodejs and Centos using openssl

Image
1. First of all, you have to create private & public key - Install the system-specific openssl from this link . - Create openssl.cfg  http://www.flatmtn.com/article/setting-openssl-create-certificates.html - Set the following variable : set OPENSSL_CONF=LOCATION_OF_SSL_INSTALL\bin\openssl.cfg Update the path : set Path=...Other Values here...;LOCATION_OF_SSL_INSTALL\bin - Run > openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 - Double click at localhost.crt 2. Create "server.js" const { createServer } = require('https'); const { parse } = require('url'); const next = require('next'); const fs = require('fs'); const dev = process.env.NODE_ENV !== 'production'; const app = next({ dev }); const handle = app.getRequestHandler(); const httpsOptions = {   key: fs.readFileSync('./certificates/localhost.key'),   cert: fs.readFileSync('./certif...

GIT

1. [Setup] Git Clone git clone [url] [folder-name] example : git clone https://{user}@xxx.git {folder} 2. Fetch & checkout git fetch && git checkout [branchname] example: /home/react/dev/api> git fetch && git checkout develop /home/react/dev/api> git fetch && git checkout master 3. Pull git pull 4. Check Current Branch git rev-parse --abbrev-ref HEAD 5. Discard change git clean -df git checkout – . *Before code changed run : service supervisord restart Reference : [1] https://confluence.atlassian.com/bitbucket/clone-a-repository-223217891.html [2] https://www.atlassian.com/git/tutorials/syncing How to remove the last commit git reset --hard HEAD^ git push origin HEAD --force https://sethrobertson.github.io/GitFixUm/fixup.html

How to install/uninstall/update node / angular / npm

Image
INSTALL How to install Node.js to latest version Windows Install the latest,  https://nodejs.org/en/download CentOS Change setup_10.x to whatever version you need. - curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash - -  sudo yum install nodejs UPDATE How to update Node.js to latest version 1. Uninstall Node.js. Click the Start menu, type "Change or Remove a Program", click on the item shown, find Node.js in the list and uninstall it. 2. Delete directories, both C:\Program Files (x86)\nodejs\ and C:\Program Files\nodejs\ if they exist. 3. Install the latest, https://nodejs.org/en/download The uninstall/delete/install seems unnecessary, but it often is and this will save your time. These instructions come from Microsoft. How to Update NPM: https://www.npmjs.com/package/npm-windows-upgrade UNINSTALL How to Uninstall Node and NPM You uninstall Node.js and NPM the same as you would most all Windows software: Open the Windows Con...

Ultimate member plugin wordpress does not render the form

When you apply the theme such as Hatro pro, it seems the form input is not rendered correctly. We might have to custom css on this plugin, ultimate member, by ourselves. Please see the solution below. 1. Go to wp-content>plugin>ultimate-member/assets/css 2. Edit up-old-default.css 3. Add opacity into class um .um { ... opacity:1; }

How to download all files from directory

Image
You can use wget command or gui wget for download files from website Reference [1] wget download

How to upgrade mariadb from 10.1 to 10.2

Reference https://stackoverflow.com/questions/44027926/update-xampp-from-maria-db-10-1-to-10-2

How to debug msbuild

To do trace in msbuild 1. using message text <Target Name = "MyTarget" > <!-- Some tasks --> <Message Text = "The value of SomeVariable is: $(SomeVariable)" Importance = "High" /> <!-- Some tasks --> </ Target> 2. Let visual studio is able to display verbose message To change the build output verbosity shown in the VS2010 window, open the Options dialog and select the Build and Run settings below the Projects and Solutions node. Unless you explicitly specify a low message importance, your messages should show up at Normalverbosity or higher. Reference [1] Debug msbuild [2] No switch /debug [3] Get message msbuild task

generate type declaration file (.d.ts) on visual studio code

To compile typescipt use following command 1. Open command line 2. Go to current project 3  >"C:\Program FIles (x86)\Microsoft SDKs\Typescript\2.3\tsc" -d -p "./scripts/typings" -outDir "./scripts/typings/jaa" Note -d means Generates corresponding .d.ts file -p means a directory path to a directory containing a tsconfig.json file --outDir means Redirect output structure to the directory. -------------------------------------------- tsconfig.json {   "compilerOptions": {     "target":"es5",     "module":"commonjs",     "declaration":true,     "removeComments": true,     "strict": true   },   "include":[      "D:/xxx/xxx/xx/scripts/typings/**/*"   ],   "files":[      "D:/xxx/xxx/xx/app/utility/yyy.ts",      "D:/xxx/xxx/xx/app/utility/zzz.ts"   ] } -------------------------------------------- Refe...

Node-Red and MQTT on Raspberry Pi

Image
Node-Red MQTT on Raspberry Pi Node Red A visual tool for wiring the IoT. Gateway to The IoT. Rapidly developing popular platform device data information. To install Node-Red > bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered) > node-red-start After this you can access the node-red dashboard from url http://<raspberrypi ip addr>:1880 Auto Start on Reboot > sudo systemctl enable nodered.service Install MQTT Broker > npm install node-red-contrib-mqtt-broker Reference [1] Install Node-Red  [2] Install node-red-contrb-mqtt-broker [3] First time mqtt-broker MQTT Publish Getting started install MQTT client > sudo pip install paho-mqtt Note: GPIO. Stands for " General Purpose Input/Output ."  MQTT stands for "Message Queue Telemetry Transport"

M5Stack ESP32

Image
1. use uPyCraft https://randomnerdtutorials.com/install-upycraft-ide-windows-pc-instructions/ 2. Tools > Burn Firmware -  m5stack-20180516-v0.4.0.bin Connect to Putty 1. Open Putty 2. Select 'Serial' Connection 3. Port: COM7, Speed 115200 4. exec(open('./main.py').read(),globals()) M5Cloud How to make it connect to wifi 1. Burn with M5Cloud firmware https://github.com/m5stack/M5Cloud/tree/master/firmwares 2. Connect to wifi using  http://192.168.4.1/ 3. Add device via  http://io.m5stack.com M5 UI-Flow 1 Instruction https://medium.com/mmp-li/m5stack-with-ui-flow-b6d1a37385b0  1.1 How to burn firmware  https://docs.makerfactory.io/m5stack/related-documents/burn-firmware/  1.2 M5Burner  https://github.com/m5stack/M5Stack-Firmware Arduino 1 Install Arduino IDE - [1] arduino ide - [2] arduino on vscode 2. Install ESP32 board on Arduino IDE https://randomnerdtutorials.com/installing-the-esp32-board-...