Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!
openssl genrsa -des3 -out rootCA.key 4096
# Get IAM Role name from Instance Profile Id | |
curl http://169.254.169.254/latest/meta-data/iam/info | |
# Get credentials | |
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> | |
# More info | |
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html | |
class Solution { | |
public int networkDelayTime(int[][] times, int N, int K) { | |
int V = N + 1; | |
int[][] adj = new int[V][V]; | |
for (int i = 1; i < V; i++) | |
for (int j = 1; j < V; j++) | |
adj[i][j] = -1; | |
for (int[] conn : times) { | |
adj[conn[0]][conn[1]] = conn[2]; | |
} |
public class RedundantConnection { | |
private int[] parents; | |
public int[] findRedundantConnection(int[][] edges) { | |
int N = edges.length; | |
parents = new int[N + 1]; // # of nodes | |
for (int i = 0; i < N + 1; i++) { | |
parents[i] = i; | |
} |
package leetcode; | |
public class FriendCircles { | |
private int count; | |
public int findCircleNum(int[][] M) { | |
count = M.length; | |
int len = M.length; |
public class FriendCircles { | |
private int count; | |
public int findCircleNum(int[][] M) { | |
count = M.length; | |
int len = M.length; | |
int[] circles = new int[len]; | |
int[] rank = new int[len]; | |
for (int i = 0; i < len; i++) { |
class NQueens { | |
public int totalNQueens(int n) { | |
int[] B = new int[n]; | |
return nqueens(B, 0); | |
} | |
public int nqueens(int[] B, int row) { | |
if (row == B.length) return 1; | |
int count = 0; | |
for (int j=0; j<B.length; j++) { |
class NumEnclaves { | |
public int numEnclaves(int[][] A) { | |
if (A.length == 0) return 0; | |
int N = A.length, M = A[0].length; | |
for (int i=0; i<N; i++) { | |
if (A[i][0] == 1) { | |
dfs(A, i, 1); | |
} | |
if (A[i][M-1] == 1) { | |
dfs(A, i, M-2); |
class Solution { | |
public int longestIncreasingPath(int[][] matrix) { | |
if (matrix.length == 0) return 0; | |
int rowN = matrix.length, colN = matrix[0].length; | |
int res = 0; | |
int[][] cache = new int[rowN][colN]; | |
for (int i=0; i<rowN; i++) { | |
for (int j=0; j<colN; j++) { | |
res = Math.max(res, findMax(matrix, i, j, cache)+1); | |
} |
numpy==1.11.2 | |
scipy==0.18.1 | |
pandas==0.19.0 | |
boto3==0.0.1 |