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
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 / run.sh
Created October 8, 2019 07:28
Ubuntu 18.04 separate workspaces
gsettings set org.gnome.shell.app-switcher current-workspace-only true
gsettings set org.gnome.shell.extensions.dash-to-dock isolate-workspaces true
@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 / cert-manager.md
Created April 15, 2019 19:27
Cert Manager with Let's Encrypt

Otomatik TLS oluşturarak Let's Encrypt üzerinden SSL sertifikası nasıl alınır?

Cert Manager Kurulumu

helm install --name cert-manager --version v0.5.2 \
    --namespace kube-system stable/cert-manager

@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 / 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 / orderByKey.js
Created January 23, 2019 07:27
order an array by selected key and choose ascending or descending
function orderByKey (arr, key, asc) {
return arr.sort((a, b) => {
if (a[key] < b[key]) {
return asc === true ? -1 : 1
}
if (a[key] > b[key]) {
return asc === true ? 1 : -1
}
return 0
})