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
//https://docs.google.com/presentation/d/1bnDuaUqqDM8uh_dZD_JbfCIMtA5U4iP8mazT4h21yDI | |
function onOpen() { | |
let ui = SlidesApp.getUi(); | |
ui.createMenu('Custom Menu') | |
.addItem('Populate Donut Chart', 'showPrompt') | |
.addSeparator() | |
.addSubMenu(ui.createMenu('Sub-menu') | |
.addItem('Second item', 'menuItem2')) |
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
import re | |
# Ref: https://cloud.google.com/endpoints/docs/grpc/transcoding | |
regexparse = r'option\ \(google.api.http\)\ =\s{\s+(\w+: \"[\S]+)\s+(\w+:\s\"[\S]+\s+)?};' | |
with open('http_bookstore.proto','r') as file: | |
content = file.read() | |
[print(x.group()) for x in re.finditer(regexparse, content)] |
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 express = require('express'); | |
const bodyParser = require('body-parser'); | |
const path = require('path'); | |
const Busboy = require('busboy'); | |
const os = require('os'); | |
const fs = require('fs'); | |
// create express app | |
const app = express(); | |
var public = path.join(__dirname, 'public'); |
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
import json | |
from flask import Flask | |
from keras.models import load_model | |
from utils import preprocess | |
model = load_model('model.h5') | |
app = Flask(__name__) | |
@app.route('/forecast', methods=['POST']) | |
def forecast(): |
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
ATVI | |
ADBE | |
AMD | |
ALXN | |
ALGN | |
GOOGL | |
GOOG | |
AMZN | |
AMGN | |
ADI |
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 dir = '/tmp'; | |
// list content | |
fs.readdir(dir, (_, files) => { console.log(files.join('\n')) }); | |
// delete files (ignore permission errors) | |
fs.readdir(dir, (_, files) => { files.forEach(file => { fs.unlink(`${dir}/${file}`, _ => _)})}); |
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 expectedRowCount(ts1, ts2) { | |
let d1 = new Date(ts1); | |
let d2 = new Date(ts2); | |
let ms_diff = d2 - d1; | |
return ms_diff / (3.6e6) + 1; | |
} | |
// expectedRowCount('2020-09-07 10:00:00 UTC', '2020-09-10 06:00:00 UTC'); | |
// => 69 |
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
import numpy as np | |
def pow(x, n): | |
return np.exp(n * np.log(x)) | |
def cnd(x): | |
a1 = 0.31938153 | |
a2 = -0.356563782 | |
a3 = 1.781477937 | |
a4 = -1.821255978 |
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
import nltk | |
#sentence = """John waited for us at the bus stop.""" | |
def parse(sentence): | |
tokens = nltk.word_tokenize(sentence) | |
tagged = nltk.pos_tag(tokens) | |
print(tagged) |
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
def angle2(xx,yy,A): | |
t = (xx.T@A@yy)/(np.sqrt(xx@A@xx.T*yy.T@A@yy)) | |
return np.arccos(t) | |
def angle1(xx,yy): | |
t = (xx.T@yy)/(np.sqrt(xx@xx.T*yy.T@yy)) | |
return np.arccos(t) |