Skip to content

Instantly share code, notes, and snippets.

@mgudesblatart
mgudesblatart / child-ingress.yaml
Last active March 24, 2024 16:30
current configurations
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-{{ .Release.Name }}-frontend
namespace: {{ .Release.Name }}
annotations:
kubernetes.io/ingress.class: "nginx-3"
nginx.ingress.kubernetes.io/auth-tls-verify-client: "on"
nginx.ingress.kubernetes.io/auth-tls-secret: {{ .Release.Name }}/tls-secret
nginx.ingress.kubernetes.io/auth-tls-verify-depth: "1"
@mgudesblatart
mgudesblatart / dcp5.js
Created May 14, 2019 19:49
Daily Coding Problem #5
function getAnagram( word, string ) {
let t1 = performance.now()
let res = [];
let word_array = word.split( '' );
for ( let i of [ ...Array( string.length - word.length + 1 ).keys() ] ) {
let a_window = string.substring( i, i + word.length );
let a_window_array = a_window.split( '' );
if ( JSON.stringify( word_array ) == JSON.stringify( a_window_array ) ||
JSON.stringify( word_array ) == JSON.stringify( a_window_array.reverse() )
) {
@mgudesblatart
mgudesblatart / dcp4.js
Created May 13, 2019 19:15
Daily Coding Problem #4
function smallElementsToTheRight(array){ //straightforward
let t0 = performance.now();
let res= array.map((x, i) => {
return array.slice(i, array.length).map(y => y < x).reduce((acc,curr)=>{return acc + curr;},0);
});
let t1 = performance.now();
let t = t1 - t0;
return {res, t};
}
@mgudesblatart
mgudesblatart / dcp3.js
Created May 8, 2019 18:06
Daily Coding Problem #3
function maxSumSubArray(array){
let res = 0;
let sum = 0;
let starting_index = 0;
let ending_index = 0;
for(let i = 0, l = array.length; i < l; i++){
sum = Math.max(array[i], sum + array[i]);
if(sum > res){
ending_index = i + 1;
res = sum;
@mgudesblatart
mgudesblatart / dcp2.js
Last active May 7, 2019 15:48
Daily Coding Problem #2
function wind(array){
let t = performance.now();
let left=null, right = null;
let s = [...array].sort();
for(let [i,v] of array.entries()){
if(v != s[i] && left == null){
left = i;
}else if (v != s[i]){
right = i;
}
@mgudesblatart
mgudesblatart / dcp1.js
Created May 6, 2019 23:36
Daily Coding Problem #1
//their solution
function products(nums){
var t0 = performance.now();
let prefix_products = [];
for(let num of nums){
if(prefix_products.length){
prefix_products.push(prefix_products[prefix_products.length - 1] * num);
}else{
prefix_products.push(num)
}