- 准备
-
windows:
- windows 10 需要禁用 hyper-v
- windows 需要在 bios 中开启 vt-x / amd-v
- 下载 virtualbox
-
mac:
brew cask install virtualbox
| function delay(t, v) { | |
| return new Promise(function(resolve) { | |
| setTimeout(resolve.bind(null, v), t) | |
| }); | |
| } | |
| function f1(count = 10) { | |
| console.log('f1', count) | |
| let p = delay(10).then(() => { | |
| if (count > 0) { |
| from contextlib import contextmanager | |
| from tee import StdoutTee, StderrTee | |
| # λ python test.py | |
| # test tee | |
| # λ cat stdout.log | |
| # test tee | |
| @contextmanager | |
| def Tee(): |
| class Model(object): | |
| id: int = None | |
| def __init__(self, **kwargs): | |
| annotations = {**self.__annotations__, **Model.__annotations__} | |
| for name, annotated in annotations.items(): | |
| if name in kwargs: | |
| value = kwargs.get(name) | |
| value = annotated(value) | |
| setattr(self, name, value) |
| #!/usr/bin/env python3 | |
| import time | |
| import sys | |
| import fileinput | |
| import os.path | |
| import time | |
| import json | |
| def log(*args, **kwargs): |
| import sqlite3 | |
| from utils import log | |
| db_path = 'model.sqlite' | |
| conn = sqlite3.connect(db_path) | |
| class Model(object): | |
| fields = [ |
windows:
mac:
brew cask install virtualbox
| from collections import deque | |
| def encoded(json): | |
| t = type(json) | |
| if t is dict: | |
| text = "" | |
| for k, v in json.items(): | |
| text += "'{}': {},".format(k, encoded(v)) |
| package com.company; | |
| import java.io.ByteArrayInputStream; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.util.*; | |
| import java.util.stream.Collectors; | |
| import java.util.stream.IntStream; | |
| import java.util.stream.Stream; |
| using System; | |
| using Newtonsoft.Json; | |
| using System.IO; | |
| namespace Test | |
| { | |
| public class Model | |
| { |
| const express = require('express'); | |
| const app = express(); | |
| const db = require('./database.js'); | |
| app.listen(3000); | |
| console.log("Listening on port 3000"); | |
| app.get("/", (req, res) =>{ | |
| db.query().then(docs =>{ | |
| res.send(docs); |