Skip to content

Instantly share code, notes, and snippets.

@huangrh
huangrh / app.yaml
Created March 15, 2021 04:13 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
with apache_beam.Pipeline(options=options) as p:
rows = (
p |
ReadFromText(input_filename) |
apache_beam.ParDo(Split())
)
@huangrh
huangrh / web.py
Created March 3, 2021 05:10 — forked from CognitiveDave/web.py
A python flask backend
from flask import Flask, render_template, g, jsonify, request, redirect, url_for, session, flash
from gensim import corpora
import os
app = Flask(__name__,
static_folder = "./dist/static",
template_folder = "./dist")
@app.route("/home")
def hello():
ref: https://towardsdatascience.com/20-days-to-google-cloud-professional-machine-learning-engineer-exam-beta-b48909499942
https://cloud.google.com/certification/guides/machine-learning-engineer
@huangrh
huangrh / time series.md
Last active December 21, 2019 16:50
tensorFlow

‎‎​

@huangrh
huangrh / fastAUC.r
Created November 9, 2018 19:26 — forked from traversc/fastAUC.r
Fast AUC and ROC calculations in R
fastROC <- function(probs, class) {
class_sorted <- class[order(probs, decreasing=T)]
TPR <- cumsum(class_sorted) / sum(class)
FPR <- cumsum(class_sorted == 0) / sum(class == 0)
return(list(tpr=TPR, fpr=FPR))
}
# Helpful function adapted from: https://stat.ethz.ch/pipermail/r-help/2005-September/079872.html
fastAUC <- function(probs, class) {
x <- probs
@huangrh
huangrh / r_oracle_jdbc_example1.R
Created October 17, 2018 20:05 — forked from mjbommar/r_oracle_jdbc_example1.R
Example of connecting to an Oracle database using R and RJDBC
# Set JAVA_HOME, set max. memory, and load rJava library
Sys.setenv(JAVA_HOME='/path/to/java_home')
options(java.parameters="-Xmx2g")
library(rJava)
# Output Java version
.jinit()
print(.jcall("java/lang/System", "S", "getProperty", "java.version"))
# Load RJDBC library