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
| import Joi from '@hapi/joi' | |
| import { Request, Response, NextFunction } from 'express' | |
| export const schema = Joi.object().keys({ | |
| body: Joi.object(), | |
| query: Joi.object(), | |
| params: Joi.object() | |
| }) | |
| const formatMemmoryUsage = (data: any) => `${Math.round(data / 1024 / 1024 * 100) / 100} MB` |
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 app = express() | |
| Sentry.init({ | |
| dsn: process.env.NODE_ENV === 'production' && process.env.SENTRY_DSN, | |
| environment: process.env.SENTRY_ENV, | |
| debug: process.env.SENTRY_LOGGING === 'true' || false, | |
| release: `${process.env.npm_package_name}@v${process.env.npm_package_version}`, | |
| integrations: [ | |
| new Sentry.Integrations.Http({ tracing: true }), | |
| new Tracing.Integrations.Express({ |
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
| #scan network hosts | |
| nmap -sP 192.168.1.0/24 | |
| #check open ports | |
| nmap -sT 192.168.1.1 | |
| #check specific ports | |
| nmap -sT -p 80,443 192.168.1.0/24 | |
| #check specific ports - stealth scan (without 3-way handshake) |
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
| save-exact=true | |
| message="v%s" |
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
| pg_dump -U [user] -d [database] -h [host] -p [port] -f [filename] -O -F tar | |
| pg_restore -O -d [database] [filename] | |
| # -O => --no-owner => cancel ownership of object to match original db | |
| # -F => --format => tar -> Output a tar-format archive suitable for input into pg_restore. | |
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
| /** | |
| * Logging with morgan | |
| * Custom log format | |
| * Logging to file from config | |
| */ | |
| import Morgan from 'morgan' | |
| import config from 'config' | |
| import path from 'path' | |
| import * as rotator from 'file-stream-rotator' |