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
| # © Lenconda | |
| # When the path is //path.example.com/api/path/to/interface, redirect to http://localhost:3000/api/path/to/interface | |
| # Backend should add a route prefix of '/api' | |
| server { | |
| listen 80; | |
| server_name path.example.com; | |
| location / { | |
| proxy_set_header X-Real-IP $remote_addr; |
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
| db.NEW_COLLECTION.ensureIndex({ 'KEY_TO_DISTINCT': 1 }, { 'unique': true, 'dropDups': true }); | |
| db.DUMMY_COLLECTION.find().forEach(function(doc) { | |
| db.NEW_COLLECTION.insert(doc); | |
| }); |
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
| console.log(`Child process running with ${process.pid}`) | |
| setInterval(() => { | |
| process.send(`Worker got time: ${Date.parse(new Date())}`) | |
| }, 1000) |
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
| // /src/publisher.js | |
| const amqp = require('amqp') | |
| const { | |
| MQ_HOST, | |
| MQ_PORT, | |
| MQ_LOGIN, | |
| MQ_PASSWORD, | |
| MQ_TIMEOUT, | |
| MQ_QUEUE } = require('../../config') |
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 redis = require('redis') | |
| const _db = Symbol('db') | |
| class RedisQueue { | |
| constructor () { | |
| this[_db] = redis.createClient({ | |
| host: 'localhost', | |
| port: 6379 |
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 mongoose = require('mongoose') | |
| const { | |
| DB_HOST, | |
| DB_PORT, | |
| DB_USER, | |
| DB_PASSWORD, | |
| DB_NAME } = require('../../config') | |
| const getLogger = require('../utils/logger') | |
| const logger = getLogger(__filename) |
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 amqp = require('amqp') | |
| const conn = amqp.createConnection({ | |
| host: '127.0.0.1', | |
| port: 5672, | |
| login: 'guest', | |
| password: 'guest', | |
| connectionTimeout: 10000 | |
| }) |
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
| IP=SERVER_ADDRESS | |
| # LOCAL_PORT:IP:SERVER_PORT | |
| ssh -fNg -L 3306:IP:3306 root@IP |
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 superagent = require('superagent'); | |
| const cheerio = require('cheerio'); | |
| const getSubdomains = (rootDomain) => { | |
| return new Promise((resolve, reject) => { | |
| superagent | |
| .post('https://hackertarget.com/find-dns-host-records/') | |
| .type('form') | |
| .send({ theinput: rootDomain }) | |
| .send({ thetest: 'hostsearch' }) |
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 baseUrl = window.isDevMode ? '/api' : 'https://os.ncuos.com/api' | |
| // 信息提示框 | |
| /** | |
| * @param {any} msg | |
| * @param {any} isSucc | |
| */ | |
| const alertBox = function (msg, isSucc) { | |
| msg = typeof msg !== 'undefined' ? msg : '操作失败' | |
| try { | |
| if (msg.indexOf('permission') >= 0) { |