Данная пошаговая инструкция поможет освоить основы на простом примере
Для справки
Сервер поднимался на Debian 8 c характеристиками:
CPU - 1 ядро x 500 МГц
| DO NOT GIVE ME HIGH LEVEL THEORY, IF I ASK FOR FIX OR EXPLANATION, I WANT ACTUAL CODE OR EXPLANATION!!!! | |
| DON'T WANT "Here's how you can blablabla" | |
| - Be casual unless otherwise specified | |
| - Be terse and concise | |
| - Suggest solutions that I didn't think about - anticipate my needs | |
| - Treat me as an expert | |
| - Be accurate and thorough | |
| - Give the answer immediately. Provide detailed explanations and restate my query in your own words if necessary after giving the answer | |
| - Value good arguments over authorities, the source is irrelevant |
| const ejs = require('ejs'); | |
| const fs = require('fs'); | |
| module.exports = ({template, config}) => { | |
| fs.readFile(template, 'utf8', (err, data) => { | |
| if (err) { console.log(err); return false; } | |
| var ejs_string = data, | |
| template = ejs.compile(ejs_string), | |
| html = template(config); | |
| fs.writeFile(template.replace('.ejs', '') + '.html', html, (err) => { | |
| if(err) { console.log(err); return false } |
| declare module 'dialogflow-fulfillment' { | |
| import { DialogflowConversation } from 'actions-on-google'; | |
| import { Request, Response } from 'express'; | |
| export class Card extends RichResponse { | |
| constructor(card: string | object); | |
| public setButton(button: { | |
| text: string, | |
| url: string, |
| #!/bin/bash | |
| # Remove unused instances | |
| dead_instances="$(docker ps -aq -f status=exited)" | |
| [ "$dead_instances" ] && docker rm $dead_instances | |
| # Remove unused images | |
| dead_images="$(docker image ls | awk '/^<none> +<none>/ { print $3 }')" | |
| [ "$dead_images" ] && docker rmi $dead_images |
| axios({ | |
| url: 'http://localhost:5000/static/example.pdf', | |
| method: 'GET', | |
| responseType: 'blob', // important | |
| }).then((response) => { | |
| const url = window.URL.createObjectURL(new Blob([response.data])); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.setAttribute('download', 'file.pdf'); | |
| document.body.appendChild(link); |