Skip to content

Instantly share code, notes, and snippets.

:shipit:
To the top

Erkan Zileli erkanzileli

:shipit:
To the top
View GitHub Profile
@erkanzileli
erkanzileli / websocket.js
Created Jun 7, 2020
Sample WebSocket Server with Node.js
View websocket.js
const http = require('http')
const WebSocketServer = require('websocket').server
const PORT = process.env.PORT || 8080
const MessageType = {
Join: 'Join',
Left: 'Left',
Message: 'Message'
}
@erkanzileli
erkanzileli / azurevm.tf
Created Jan 30, 2020
Example Azure Virtual Machine infra
View azurevm.tf
provider "azurerm" {
version = "=1.38.0"
# subscription_id = "***"
skip_provider_registration = true
}
variable "prefix" {
default = "application"
}
@erkanzileli
erkanzileli / index.js
Last active Dec 20, 2019
Run async tasks sequentally and with delay while without blocking event-loop
View index.js
async function getNumber(number) {
return number
}
let tasks = [
() => getNumber(1),
() => getNumber(2),
() => getNumber(3),
() => getNumber(4)
];
View redisNodePSubscribeExample.js
const redis = require('redis')
const publisher = redis.createClient()
const subscriber = redis.createClient()
subscriber.psubscribe('channel:*')
subscriber.on('psubscribe', console.log)
View wait-for-socket-connection.sh
#! /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 Oct 8, 2019
Ubuntu 18.04 separate workspaces
View run.sh
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 Oct 4, 2019
Closure vs. High Order Functions in JavaScript
View index.js
// 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 Aug 19, 2019
Single node Rancher installation
View single_node_rancher_installation.md

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 Apr 21, 2019
JavaScript binary gap solution
View binaryGap.js
/**
* 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 Apr 15, 2019
Cert Manager with Let's Encrypt
View cert-manager.md

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

You can’t perform that action at this time.