Skip to content

Instantly share code, notes, and snippets.

View erkanzileli's full-sized avatar
:shipit:
what if

Erkan Zileli erkanzileli

:shipit:
what if
View GitHub Profile
@erkanzileli
erkanzileli / azurevm.tf
Created January 30, 2020 08:01
Example Azure Virtual Machine infra
provider "azurerm" {
version = "=1.38.0"
# subscription_id = "***"
skip_provider_registration = true
}
variable "prefix" {
default = "application"
}
@erkanzileli
erkanzileli / index.js
Last active December 20, 2019 12:38
Run async tasks sequentally and with delay while without blocking event-loop
async function getNumber(number) {
return number
}
let tasks = [
() => getNumber(1),
() => getNumber(2),
() => getNumber(3),
() => getNumber(4)
];
const redis = require('redis')
const publisher = redis.createClient()
const subscriber = redis.createClient()
subscriber.psubscribe('channel:*')
subscriber.on('psubscribe', console.log)
#! /bin/bash
for i in $(seq 100); do
bash -c "echo '' >/dev/tcp/$IP/8080" 2>/dev/null
if [ $? -eq 0 ]; then
break
fi
echo -n .
sleep 1
done
@erkanzileli
erkanzileli / index.js
Created October 4, 2019 22:55
Closure vs. High Order Functions in JavaScript
// A closure does not mean that it necessarily is returned by a function.
// A closure generally is a function that has access to the declaration context's scope.
// A closure example without returning a function
var oddNumber = 3;
function isOddNumberIsReallyOdd() {
return oddNumber % 2 === 1;
}
@erkanzileli
erkanzileli / single_node_rancher_installation.md
Last active August 19, 2019 10:53
Single node Rancher installation

docker volume create racher docker run -d --restart=unless-stopped -p 7080:80 -p 7443:443 --name rancher -v rancher:/var/lib/rancher -v pwd/fullchain.pem:/etc/rancher/ssl/cert.pem -v pwd/privkey.pem:/etc/rancher/ssl/key.pem rancher/rancher --no-cacerts

@erkanzileli
erkanzileli / binaryGap.js
Created April 21, 2019 21:40
JavaScript binary gap solution
/**
* Services:
* 1 - Convert integer to binary string
* 2 - Find binary gaps from binary string and add to custom data struct
* 3 - Get biggest binary gaps
*/
function binaryGap(N) {
// get binary string
var binaryString = N.toString(2);
@erkanzileli
erkanzileli / concourse.installation.md
Last active April 16, 2019 06:25
Concourse 5.0.1 Helm Chart Configuration for Minikube

Installation

Run

minikube addons enable ingress

Wait until default-http-backend pod activate

Learn your node ip

minikube ip
@erkanzileli
erkanzileli / chart-museum.values.yaml
Last active April 16, 2019 06:25
ChartMuseum values
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
certmanager.k8s.io/acme-http01-edit-in-place: "true"
hosts:
- name: chartmuseum.35.202.15.36.nip.io
path: /
tls: true
@erkanzileli
erkanzileli / remove-a-node.java
Last active April 4, 2019 14:42
Delete an element from an array
public static Object[] delete(Object[] array, int index) {
Object[] newArray = new Object[array.length - 1];
for (int i = 0; i < array.length; i++) {
if (i == index)
continue;
newArray[i] = array[i];
}
return newArray;
}