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
| provider "docker" { | |
| host = "unix:///var/run/docker.sock" | |
| } | |
| resource "docker_image" "ubuntu" { | |
| name = "ubuntu:precise" | |
| } | |
| resource "docker_image" "nginx" { | |
| name = "nginx:latest" |
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
| $ pytest -s | |
| =========================================================================================== test session starts ============================================================================================ | |
| platform darwin -- Python 3.7.4, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 | |
| Django settings: dproject.settings (from ini file) | |
| rootdir: /Users/kharandziuk/Projects/django-long-query, inifile: pytest.ini | |
| plugins: django-3.5.1, django-webtest-1.9.7 | |
| collected 2 items | |
| users/tests.py .. |
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 DLQ_NAME = 'DeadLetterQueue' | |
| const EXCHANGE_NAME = 'MainExchange' | |
| const delay = (ms) => new Promise((resolve) => { | |
| setTimeout(resolve, ms) | |
| }) | |
| const delayWithRefresh = (ms) => { | |
| let flag = false |
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 pm2 = require('pm2') | |
| const pino = require('pino') | |
| const logger = pino() | |
| pm2.connect(true, function(err) { | |
| if (err) { | |
| logger.fatal(err) | |
| process.exit(2); | |
| } | |
| pm2.start([ |
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 gulp = require('gulp'); | |
| const util = require('util') | |
| const prompt = require('prompt') | |
| const schema = { | |
| properties: { | |
| password: { | |
| hidden: true | |
| } | |
| } |
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 stream = require('stream'); | |
| const process = require('process') | |
| const { promisify } = require('util') | |
| const fromList = (lst) => new stream.Readable({ | |
| read() { | |
| if (lst.length) { | |
| this.push(String(lst.shift())) | |
| } else { | |
| this.push(null) |
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
| function isBalanced(str) { | |
| const stack = str.split('') | |
| const compare = [] | |
| while(stack.length) { | |
| //console.log(stack, compare) | |
| let current = stack.shift(); | |
| if(compare.length == 0) { | |
| compare.push(current) |
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 streamAsPromise = (readable) => { | |
| const result = [] | |
| const w = new Writable({ | |
| write(chunk, encoding, callback) {· | |
| result.push(chunk) | |
| callback() | |
| } | |
| }) | |
| readable.pipe(w) | |
| return new Promise((resolve, reject) => { |
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 S = require('supertest') | |
| const { expect } = require('chai') | |
| const express = require('express') | |
| const app = express() | |
| const port = 3000 | |
| app.get('/', (req, res) => res.send('Hello World!')) | |
| //app.listen(port, () => console.log(`Example app listening on port ${port}!`)) | |
| describe('server', () => { |
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
| let HiMixin = Base => class extends Base { | |
| hi () { | |
| console.log('hi') | |
| } | |
| } | |
| let ByeMixin = Base => class extends Base { | |
| bye () { | |
| console.log('bye') | |
| } |