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
class Number { | |
constructor(x) { | |
this.x = x | |
} | |
apply(f) { | |
return f(this.x) | |
} | |
} | |
class Add { |
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
#!/usr/bin/env python3.5 | |
import socket | |
import asyncio | |
from struct import pack, unpack | |
class Client(asyncio.Protocol): | |
def connection_made(self, transport): | |
self.transport = transport | |
self.server_transport = None |
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
#!/usr/bin/env python3 | |
import moviepy.editor as mp | |
import os | |
import argparse | |
def process_one(video_path, logo_path, output_path): | |
video = mp.VideoFileClip(video_path) | |
logo_h = logo_w = video.h // 8 | |
logo_margin_x = logo_margin_y = logo_h // 3 |
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
#!/usr/bin/env python3 | |
from flask import * | |
import pymongo | |
app = Flask(__name__) | |
def get_client(): |
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 pandas as pd | |
import requests | |
import time | |
def get_data(ticker, start_date, end_date, delta="1d"): | |
data_url = "https://query2.finance.yahoo.com/v8/finance/chart/" + ticker | |
params = dict() | |
params['interval'] = delta | |
params['period1'] = int(time.mktime(start_date.timetuple())) |
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
#!/usr/bin/env python3 | |
import asyncio | |
loop = asyncio.get_event_loop() | |
req = asyncio.Queue() | |
async def fetcher(a): | |
print("start fetching", a) | |
await asyncio.sleep(3) | |
print("end fetching", a) |
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
#!/usr/bin/env python3 | |
class Chain: | |
cal = None | |
def __init__(self): | |
self.cal = lambda x: x | |
def chain(self, f): |
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
//app.js | |
App({ | |
onLaunch: function () { | |
//调用API从本地缓存中获取数据 | |
var logs = wx.getStorageSync('logs') || [] | |
logs.unshift(Date.now()) | |
wx.setStorageSync('logs', logs) | |
}, | |
getUserInfo:function(cb){ | |
var that = this |