$ kubectl apply -f - <<EOF
<-- insert YAML content here -->
EOF
OR
$ cat file.yaml | kubectl apply -f -
$ kubectl apply -f - <<EOF
<-- insert YAML content here -->
EOF
OR
$ cat file.yaml | kubectl apply -f -
#CDK python WAF with CloudFront and regex and ip set rules (v1.102.0 of CDK and above) | |
from aws_cdk import ( | |
core as cdk, | |
aws_cloudfront as cloudfront, | |
aws_cloudfront_origins as cloudfront_origins, | |
aws_s3 as s3, | |
aws_certificatemanager as acm, | |
aws_route53 as route53, | |
aws_wafv2 as wafv2, |
>>> import pytz | |
>>> | |
>>> for tz in pytz.all_timezones: | |
... print tz | |
... | |
... | |
Africa/Abidjan | |
Africa/Accra | |
Africa/Addis_Ababa | |
Africa/Algiers |
import tensorflow_addons as tfa | |
import tensorflow as tf | |
def get_norm_layer(norm): | |
"""Utility function to get the normalization layer | |
""" | |
if norm == None: | |
return lambda: lambda x: x | |
elif norm == 'batch_norm': |
import tensorflow as tf | |
from tensorflow.python.framework import ops | |
from tensorflow.python.ops import gen_nn_ops | |
@ops.RegisterGradient("GuidedRelu") | |
def _GuidedReluGrad(op, grad): | |
return tf.select(0. < grad, gen_nn_ops._relu_grad(grad, op.outputs[0]), tf.zeros(grad.get_shape())) | |
if __name__ == '__main__': | |
with tf.Session() as sess: |
from tensorflow.examples.tutorials.mnist import input_data | |
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
import numpy as np | |
mnist = input_data.read_data_sets('mnist/', one_hot=True) | |
X = mnist.train.images | |
# 784 -> 128 -> 64 -> 128 -> 784 |
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
from tensorflow.examples.tutorials.mnist import input_data | |
import numpy as np | |
tf.reset_default_graph() | |
mnist = input_data.read_data_sets('mnist/', one_hot=True) | |
# Test |
from warnings import filterwarnings | |
filterwarnings('ignore') | |
import pandas as pd | |
import numpy as np | |
from lightgbm import LGBMClassifier | |
from sklearn.preprocessing import MinMaxScaler | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import roc_auc_score |
import warnings | |
warnings.filterwarnings('ignore') | |
import pandas as pd | |
import numpy as np | |
from tensorflow.python.keras import backend as K | |
from tensorflow.python.keras.models import Sequential | |
from tensorflow.python.keras.layers import InputLayer, Input | |
from tensorflow.python.keras.layers import Reshape, MaxPooling2D | |
from tensorflow.python.keras.layers import Conv2D, Dense, Flatten, Dropout |
from sklearn import datasets | |
iris = datasets.load_iris() | |
X = iris.data | |
y = iris.target | |
from sklearn.preprocessing import StandardScaler | |
scaler_x = StandardScaler() |