This file contains 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
import csv | |
import sys | |
def format_csv(input_file): | |
header = [] | |
final_output = [] | |
# Analyzing and formatting data | |
with open(input_file) as csv_file: | |
csv_reader = csv.reader(csv_file, delimiter=';') | |
This file contains 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
/** | |
* This algorithm is traversing a given array in search of a target value. | |
* It divides the array in halves in order to optimize the search | |
* @param list array that is going to be processed | |
* @param value that is being searched | |
*/ | |
function binarySearch (list, value) { | |
// initial values for start, middle and end | |
let start = 0 | |
let stop = list.length - 1 |
This file contains 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
/** | |
* This algorithm is traversing the list from two beginning and end searching for | |
* pairs that sum to the target value parameter | |
* @param list sorted array of numbers | |
* @param target sum number to find | |
**/ | |
function findPairs(list, target) { | |
const result = []; | |
let left = 0; |
This file contains 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
import React, { useState, useEffect, Props } from 'react'; | |
import firebase from '../config/firebase'; | |
export const AuthContext = React.createContext({ currentUser: undefined }) | |
export const AuthProvider = (props: Props<any>) => { | |
const [currentUser, setUser] = useState(); | |
useEffect(() => { |
This file contains 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
import React from 'react'; | |
import { Route, Redirect, RouteProps } from 'react-router'; | |
import { AuthContext } from './AuthContext'; | |
const ProtectedRoute = ({ component: Component, ...rest }: RouteProps) => ( | |
<Route {...rest} render={(props) => ( | |
<AuthContext.Consumer> | |
{(context) => context.currentUser | |
? Component |
This file contains 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
import io.jsonwebtoken.Claims; | |
import io.jsonwebtoken.Jwts; | |
import io.jsonwebtoken.SignatureAlgorithm; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.security.core.Authentication; | |
import org.springframework.security.core.GrantedAuthority; | |
import org.springframework.security.core.authority.SimpleGrantedAuthority; | |
import java.util.*; |
This file contains 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
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | |
import org.springframework.security.core.context.SecurityContextHolder; | |
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; | |
import org.springframework.web.filter.OncePerRequestFilter; | |
import javax.servlet.FilterChain; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServletRequest; |
This file contains 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
# get info | |
kubectl get pods | |
kubectl get services | |
kubectl get networkpolicy | |
kubectl get deployments | |
kubectl get ingress | |
kubectl get namespaces | |
kubectl get nodes | |
kubectl get rs | |
kubectl get configmaps |
This file contains 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: <ms-name> | |
labels: | |
app: <ms-name> | |
spec: | |
selector: | |
matchLabels: | |
app: <ms-name> |
This file contains 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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: <ms-name> | |
spec: | |
type: NodePort | |
ports: | |
- port: 80 | |
protocol: TCP | |
targetPort: 8080 |