This file contains 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
from typing import List | |
import requests | |
#import json | |
import re | |
import os | |
import asyncio | |
from contextlib import closing | |
DOWNLOAD_FOLDER="download_videos" | |
URL_LIST_FILENAME="url_list.txt" |
This file contains 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
require 'mongoid' | |
require 'sinatra' | |
require 'json' | |
#加上:development避免mongoid找不到环境而报错 | |
#预先在"config/mongoid.yml"创建了, 详情见以上链接. | |
Mongoid.load!(File.join(File.dirname(__FILE__), 'config', 'mongoid.yml'), :development) | |
#无需声明id字段, mongoid会自动加上 | |
class Post | |
include Mongoid::Document |
This file contains 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 WebSocket from 'ws' | |
import mongodb, { ObjectID } from 'mongodb' | |
import * as querystring from 'querystring' | |
import {v4 as uuid} from 'uuid' | |
//Connect to ws://127.0.0.1:8081/thread?name=yourGroupname | |
//to test the server | |
interface WsSessionGroup{ | |
id?: ObjectID |
This file contains 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
package main | |
import ( | |
"log" | |
"net/http" | |
"net/url" | |
"github.com/gin-gonic/gin" | |
"github.com/google/uuid" |
This file contains 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 WebSocket from 'ws' | |
import mongodb, { ObjectID } from 'mongodb' | |
import * as mongoose from 'mongoose' | |
import { prop, getModelForClass } from '@typegoose/typegoose' | |
import * as querystring from 'querystring' | |
import { v4 as uuid } from 'uuid' | |
import Ajv from 'ajv' | |
import express from 'express' | |
import http, { Server } from 'http' | |
import url from 'url' |
This file contains 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 parsePost(yourDataStr:string) :YourClass|null{ | |
//require你所生成的schema, 不知道为什么用import的时候对json会报错, resolveJsonModule已经开了 | |
const yourSchema=require("./yourSchema") | |
const ajv = new Ajv({allErrors:true}) | |
//想要快一些应该可以先Compile罢 | |
try { | |
const yourDataJson = JSON.parse(yourDataStr) | |
const isValid = ajv.validate(yourSchema,yourDataStr) //return boolean | |
if (isValid) { | |
return yourDataJson as YourClass |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
namespace MyApp.Controllers { | |
[ApiController] | |
//path: "/hello" | |
//the same as the Controller name |
This file contains 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
// LaTeX | |
//"latex-workshop.latex.autoBuild.run": "never", | |
"latex-workshop.message.error.show": true, | |
"latex-workshop.message.warning.show": false, | |
//正向搜索 | |
"latex-workshop.view.pdf.internal.synctex.keybinding": "ctrl-click", | |
"latex-workshop.latex.tools": [ | |
{ | |
"name": "xelatex", |
This file contains 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
{ | |
"prime":{ | |
"scope": "latex", | |
"prefix": "prime", | |
"body": "^\\prime" | |
}, | |
"par":{ | |
"scope": "latex", | |
"prefix": "par", | |
"body": "\\par" |
This file contains 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
% 这是注释, 注释不会被解释成代码, 也不会被编译到文章里面 | |
% 这是文档类, 你会看到有人说要用 ctex 文档类(ctexrep), 我觉得无所谓啦, 只要用Xelatex编译就行 | |
\documentclass[a4paper]{report} % 或者用article, 那就没有chapter环境了 | |
% 下面是声明package (一般翻译成「宏包」可是我不觉得这是一个很好的翻译) | |
% 类似于其他编程语言的导入库 import | |
% CJK支持, 没它你就显示不了日文中文韩文等 | |
\usepackage{xeCJK} |
OlderNewer