Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ilkereroglu on github.
  • I am ilkereroglu (https://keybase.io/ilkereroglu) on keybase.
  • I have a public key ASB65HaPtUnJ9-urvM0b57JYALAXlmVmW15c23BuqBnKbQo

To claim this, I am signing this object:

@ilkereroglu
ilkereroglu / GoConcurrency.md
Created February 22, 2018 19:33 — forked from rushilgupta/GoConcurrency.md
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@ilkereroglu
ilkereroglu / go-install.md
Created August 31, 2016 11:18
How to install Go Lang on CentOS | AWS

How to Install GO Lang on CentOS / Amazon Linux?

sudo wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -xzf go1.4.2.linux-amd64.tar.gz 
export GOROOT=PATH_WHERE_YOU_EXTRACT_GO
export PATH=$PATH:$GOROOT/bin 
export GOBIN=$GOROOT/bin 
mkdir ~/golang/ 
export GOPATH=~/golang/ 
@ilkereroglu
ilkereroglu / Procfile
Created April 29, 2016 11:44
Kendi Slackbot’unu yazmak
web: node app
app.post('/selam', function (req, res, next) {
var userName = req.body.user_name;
var bot = {
text : userName + 'Ooo cahil bey hoşgeldiniz.'
};
if (userName !== 'slackbot') {
return res.status(200).json(bot);
} else {
return res.status(200).end();
@ilkereroglu
ilkereroglu / app-1.js
Created April 28, 2016 22:05
Kendi Slackbot'unu yazmak
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var port = process.env.PORT || 1666;
app.use(bodyParser.urlencoded({ extended: true }));
app.get('/', function (req, res) {
res.status(200).send('Çalışıyor...');
@ilkereroglu
ilkereroglu / package.json
Last active April 30, 2016 22:09
Kendi Slackbot’unu yazmak
{
"name": "ilberHocaBot",
"version": "0.0.1",
"description": "Node Server",
"main": "app.js",
"author": "İlker Eroğlu",
"license": "MIT",
"dependencies": {
"express": "^4.x.x",
"body-parser": "^1.x.x",
@ilkereroglu
ilkereroglu / simply-sending-e-mails-with-mailx.md
Created September 22, 2015 21:53
How To Send E-Mail On CentOS 7

Installing mailx

yum -y update
yum install -y mailx

We can now start sending e-mails using

@ilkereroglu
ilkereroglu / CentOS-7-Static-IP.md
Created September 22, 2015 14:22
How To Configure Static IP On CentOS 7

Configure eth0

vi /etc/sysconfig/network-scripts/ifcfg-eth0 
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"