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
| #!/usr/bin/env python | |
| # Store 32-bit floating point number within three 8bit channels of a 32-bit RGBA pixel. | |
| # Only suitable for normalised input values in the range [0.0, 1.0). | |
| # | |
| # Refer: https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ | |
| import numpy as np | |
| def frac(x): | |
| return x - np.floor(x) |
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
| # run as root or sudo everything below | |
| # install epel | |
| amazon-linux-extras install epel -y | |
| # install fail2ban | |
| yum -y install fail2ban | |
| # configure fail2ban (just adding enabled=true in the sshd section) | |
| cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local |
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 create_1d_middle_mean_array(arr): | |
| mean_arr = [] | |
| for i in range(arr.shape[0] - 1): | |
| mean = (arr[i] + arr[i+1])/2.0 | |
| mean_arr.append(mean) | |
| return numpy.array(mean_arr) | |
| def x_to_2d_with_duplication(X,num_rows): | |
| data_2d = numpy.tile(X, (num_rows, 1)) | |
| return data_2d |
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 build_1_dim_data(data_for_dim1): | |
| data_shape = data_for_dim1.shape | |
| DATA1D = numpy.zeros((data_shape[0],1),dtype=float) | |
| DATA1D[:,0] = data_for_dim1 | |
| return DATA1D | |
| def build_2_dim_data(data_for_dim1, data_for_dim2): | |
| data_shape = data_for_dim1.shape | |
| DATA2D = numpy.zeros((data_shape[0],2),dtype=float) | |
| DATA2D[:,0] = data_for_dim1 | |
| DATA2D[:,1] = data_for_dim2 |
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
| nws_precip_colors = [ | |
| "#ffffff", | |
| "#04e9e7", # 0.01 - 0.10 inches | |
| "#019ff4", # 0.10 - 0.25 inches | |
| "#0300f4", # 0.25 - 0.50 inches | |
| "#02fd02", # 0.50 - 0.75 inches | |
| "#01c501", # 0.75 - 1.00 inches | |
| "#008e00", # 1.00 - 1.50 inches | |
| "#fdf802", # 1.50 - 2.00 inches | |
| "#e5bc00", # 2.00 - 2.50 inches |
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
| #!/bin/bash | |
| #Whenever you clone a repo, you do not clone all of its branches by default. | |
| #If you wish to do so, use the following script: | |
| for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do | |
| git branch --track ${branch#remotes/origin/} $branch | |
| done |