Skip to content

Instantly share code, notes, and snippets.

View rayyildiz's full-sized avatar

Ramazan AYYILDIZ rayyildiz

View GitHub Profile
@rayyildiz
rayyildiz / ProjectEuler4.hs
Created September 5, 2016 07:16
Largest palindrome product (Project Euler Question 4)
palindromicNumbers = [x*y | x<-[1..999], y<- [1..999], reverse(show(x*y))==show(x*y)]
@rayyildiz
rayyildiz / Makefile
Created September 28, 2016 09:31
Makefile for golang project ( build, test, run) and git ( commit,push)
install:
go install .
build:
go build .
run:
go run main.go
test: build
@rayyildiz
rayyildiz / Makefile
Last active October 4, 2016 08:24
Golang Cross Platform Build
build:
CGO_ENABLED=0 GOOS=windows go build -a -installsuffix cgo -o myApp.exe .
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o myApp .
CGO_ENABLED=0 GOOS=darwin go build -a -installsuffix cgo -o myApp .
CGO_ENABLED=0 GOOS=freebsd go build -a -installsuffix cgo -o myApp .
CGO_ENABLED=0 GOOS=netbsd go build -a -installsuffix cgo -o myApp .
CGO_ENABLED=0 GOOS=openbsd go build -a -installsuffix cgo -o myApp .
CGO_ENABLED=0 GOOS=solaris go build -a -installsuffix cgo -o myApp .
@rayyildiz
rayyildiz / 1_Brackets.go
Last active September 10, 2019 09:13
Brackets confliction in Golang
package main
import "fmt"
type Person struct {
Name string
}
func main() {
p := Person{Name:"Golang"}
@rayyildiz
rayyildiz / main.go
Last active April 6, 2018 16:03
Generate Random Data and Send JSON Request
package main
import (
"bytes"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"time"
@rayyildiz
rayyildiz / Dockerfile
Created May 11, 2018 19:05
GraalVM multi stage build
FROM rayyildiz/graalvm as builder
# Set environment
ENV SBT_HOME /usr/lib/sbt
ENV PATH $PATH:$SBT_HOME/bin
ENV GRAAL_VERSION=1.0.0-rc1
RUN apt-get install bash -y && \
apt-get install ca-certificates -y && \
apt-get install wget -y && \
@rayyildiz
rayyildiz / docker-compose.yml
Last active October 6, 2018 06:45
Docker compose for a kafka cluster
version: '2'
services:
zookeeper-1:
image: confluentinc/cp-zookeeper:latest
hostname: zookeeper-1
ports:
- "12181:12181"
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 12181
@rayyildiz
rayyildiz / build.sbt
Last active February 20, 2019 10:42
Setting for spark project
scalaVersion := "2.11.12"
lazy val sparkVersion = "2.4.0"
val providedDependencies = Seq(
"org.apache.spark" %% "spark-sql" % sparkVersion% "provided",
"org.apache.spark" %% "spark-mllib" % sparkVersion% "provided",
"org.apache.spark" %% "spark-streaming" % sparkVersion% "provided"
)
@rayyildiz
rayyildiz / proxy.go
Last active February 22, 2019 10:16
Http Proxy with Go
package main
import (
"net/http"
"net/http/httputil"
"net/url"
)
const targetURL = "http://rayyildiz.com" // TODO: change with your URL
@rayyildiz
rayyildiz / index.js
Created March 3, 2019 10:43
AWS lambda@edge for cloudfront. Redirect 'subfolder/' to 'subfolder/index.html'
'use strict';
exports.handler = (event, context, callback) => {
var request = event.Records[0].cf.request;
var olduri = request.uri;
var newuri = olduri.replace(/\/$/, '\/index.html');
if (olduri == "/contact") {
newuri = "/contact/index.html";
}