Skip to content

Instantly share code, notes, and snippets.

View maxsimych's full-sized avatar

Max maxsimych

View GitHub Profile
@maxsimych
maxsimych / nodePath
Last active July 23, 2019 08:09
node PATH for VSCode
"runtimeExecutable": "~/.nvm/versions/node/v10.16.0/bin/node"
(launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
@maxsimych
maxsimych / dockerHost
Created July 21, 2019 14:15
Run docker Image with host network
docker run --network="host" image_name
@maxsimych
maxsimych / favoriteNpms.md
Last active October 10, 2019 06:53
Node.js - My list of packages with link to npmjs
@maxsimych
maxsimych / weeklies.md
Created July 21, 2019 13:36 — forked from cayasso/weeklies.md
List of Weeklies
@maxsimych
maxsimych / promiseTimeout
Created July 16, 2019 07:56
promisify setTimeout util
module.exports = ms => {
return new Promise((resolve, reject) => {
setTimeout(resolve, ms);
})
}
//EXAMPLE OF USAGE:
//const promuseTimeout = request('./utils/promiseTimeout');
//(async () => {
// await promiseTimeout(1000);
@maxsimych
maxsimych / commands
Last active October 15, 2019 07:38
UNIX Terminal helpful commands
Kill-port:
//To list any process listening to the port 8080:
sudo lsof -i:8080
//To kill any process listening to the port 8080:
sudo kill $(lsof -t -i:8080)
//or more violently:
sudo kill -9 $(lsof -t -i:8080)
//(-9 corresponds to the SIGKILL - terminate immediately/hard kill)
On freeze:
@maxsimych
maxsimych / docker get ip
Last active July 19, 2019 08:42 — forked from nerdalert/gistify691462.sh
Get an ip of docker container
### Example #1 ###
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e23d01384ac iperf-v1:latest "/usr/bin/iperf -s" 10 minutes ago Up 10 minutes 5001/tcp, 0.0.0.0:32768->5201/tcp compassionate_goodall
# Append the container ID (CID) to the end of an inspect
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' 2e23d01384ac
172.17.0.1
### Example #2 ###
# Add -q to automatically parse and return the last CID created.
@maxsimych
maxsimych / headerDisable
Created June 17, 2019 19:28
Disable leaks about using Express in production
app.disable("x-powered-by");
@maxsimych
maxsimych / catchException
Last active July 16, 2019 07:49
Async catch Exception
module.exports = fn => {
return (req, res, next) => {
Promise.resolve(fn(req, res)).catch(next);
}
};
// EXAMPLE OF USAGE:
//const catchException = require('./utils/catchException')
//app.get('/', catchExceptions(async (req, res) => {
// ...
@maxsimych
maxsimych / README.md
Created March 11, 2019 11:24 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet