Skip to content

Instantly share code, notes, and snippets.

Stanley Zheng stanzheng

Block or report user

Report or block stanzheng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stanzheng
stanzheng / aws.txt
Created Jun 25, 2019
Useful Cloud Commands
View aws.txt
# Authenticate ECR
eval $(aws ecr get-login --no-include-email | sed 's|https://||')
View gist:cecac459cceb20492499ba71150bd874
import unittest
def is_binary_search_tree(root):
# Determine if the tree is a valid binary search tree
stack = [(root, -float('inf'), float('inf'))]
while len(stack):
node, lower_bound, upper_bound = stack.pop()
if (node.value <= lower_bound) or (node.value >= upper_bound):
return False
View tricks.py
## https://docs.scipy.org/doc/numpy-1.13.0/user/basics.io.html
import np
## get all input
claims = [[int(sub_str) for sub_str in re.findall(r'-?\d+', line)] for line in inputz.split('\n')]
## populate an array
canvas = np.zeros((1000,1000))
@stanzheng
stanzheng / mlapis.html
Last active Aug 22, 2018
instructor turned off the notebook lol
View mlapis.html
<!DOCTYPE html>
<!-- saved from url=(0086)https://8081-dot-4315443-dot-devshell.appspot.com/notebooks/datalab/docs/mlapis.ipynb# -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>mlapis</title>
<link rel="shortcut icon" type="image/x-icon" href="https://8081-dot-4315443-dot-devshell.appspot.com/static/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./mlapis_files/codemirror.css">
<link rel="stylesheet" href="./mlapis_files/style.min.css" type="text/css">
@stanzheng
stanzheng / demandforecast.ipynb
Last active Sep 24, 2018
[GCP Data Training August 22, 2018] Analyzing Taxi + Weather data on GCP with BQ and TF
View demandforecast.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stanzheng
stanzheng / hb_all_books_dl.js
Last active Aug 19, 2018 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
View hb_all_books_dl.js
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
Updated: Credit @jmerle
*/
const commands = [];
document.querySelectorAll('.row').forEach(row => {
const bookTitle = row.dataset.humanName;
@stanzheng
stanzheng / selfsigncert.sh
Created Jul 18, 2018
Make Self Signed Cert
View selfsigncert.sh
# openssl genrsa -des3 -out www.google.com.key 2048
export HOSTNAME=ci.prod.ny-c3.com
openssl genrsa -des3 -out ${HOSTNAME}.key 2048
# Fill in Cert info basics
openssl req -new -key ${HOSTNAME}.key -out ${HOSTNAME}.csr
openssl x509 -req -days 365 -in ${HOSTNAME}.csr -signkey ${HOSTNAME}.key -out ${HOSTNAME}.crt
@stanzheng
stanzheng / command.sh
Created Jun 26, 2018
docker volume backup
View command.sh
#docker volume backup
docker run -v jenkins_new_jenkins:/volume -v /tmp:/backup --rm loomchild/volume-backup backup jenkins_archive
docker run -v jenkins_home:/volume -v /tmp:/backup --rm loomchild/volume-backup restore jenkins_archive
docker run --name new-jenkins -p 8082:8080 -p 5000:50000 --mount source=jenkins_home,target=/var/jenkins_home launcher.gcr.io/google/jenkins2
View Serverless_deploy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"cloudformation:CreateUploadBucket",
"cloudformation:CancelUpdateStack",
"cloudformation:CreateStack",
@stanzheng
stanzheng / README.md
Last active Feb 7, 2019
postgres examples from pgexercises.com
View README.md
You can’t perform that action at this time.