This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const catchAsync = (fn) => { | |
| return (req, res, next) => { | |
| fn(req, res, next).catch((err) => { | |
| console.error("err", err); | |
| if (err.errors) { | |
| let errorBag = []; | |
| Object.keys(err.errors).forEach((fieldName) => { | |
| errorBag.push({ [fieldName]: err.errors[fieldName] }); | |
| }); | |
| console.log("err", err); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function (req, res, next) { | |
| res.ok = function (data, message) { | |
| const response = { | |
| code: "OK", | |
| message: message || "Operation successfully executed.", | |
| data: data, | |
| }; | |
| res.status(200); | |
| res.json(response); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #open port | |
| iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone --recursive | |
| git pull --recurse-submodules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require("request"); | |
| let asyncRequest; | |
| let reqPromise = new Promise(function(resolve, reject) { | |
| //first query | |
| request("http://www.google.com", function(error, response, body) { | |
| console.log("called 1"); | |
| if (error) { | |
| reject("hi, this is error"); | |
| } else { | |
| //second query that is dependent on first query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
| server, but for some reason omit a client connecting to it. I added an | |
| example at the bottom. | |
| Save the following server in example.js: | |
| */ | |
| var net = require('net'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| adb shell input keyevent 82 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| adb shell input keyevent 82 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #wine | |
| sudo apt install wine64 | |
| #lightshot - for screenshot | |
| wget http://app.prntscr.com/build/setup-lightshot.exe --no-check-certificate | |
| wine ./setup-lightshot.exe | |
| #winscp | |
| wget https://cdn.winscp.net/files/winscp435setup.exe | |
| wine ./winscp435setup.exe | |
| #pac-vs | |
| wget http://sourceforge.net/projects/pacmanager/files/pac-4.0/pac-4.5.5.5-all.deb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz | |
| sudo tar -xzf postman.tar.gz -C /opt | |
| rm postman.tar.gz | |
| sudo ln -s /opt/Postman/Postman /usr/bin/postman | |
| cat > ~/.local/share/applications/postman.desktop <<EOL | |
| [Desktop Entry] | |
| Encoding=UTF-8 | |
| Name=Postman | |
| Exec=postman |
NewerOlder