Skip to content

Instantly share code, notes, and snippets.

Avatar

Mustafa Akın mustafaakin

View GitHub Profile
@mustafaakin
mustafaakin / README.md
Last active Aug 17, 2020
Running Windows Server 2k16 with Docker under Linux, KVM or Virtualbox
View README.md

Are you let down when you saw there is no guide to use Windows Server 2016 under *nix environments? I really loved Microsoft when I heard they are working on Windows containers, but when this week has arrived, it was sad to see that installation requirements were Windows and HyperV. But actually it is not. You just have to modify the VHD file a bit with nicer tools and execute the already available script in the downloaded VM. I will assume you are running a decent version of Linux and accepted EULA and all the legal stuff that I do not care.

1. Getting the required tools:

$ sudo apt-get install qemu-kvm virt-manager // or virtualbox, but we need qemu-kvm for image manipulation
$ sudo apt-get install qemu-utils libguestfs-tools // image manipulation tools

2. Downloading files

View medium-swarm-netbench2.sh
// replace it with your own token
TOKEN=aaa12a00f2f264727a4c5436c070d58477cd6d5f13a0379955901c4a962e9ee2
# Create Key Store Node
docker-machine create --driver digitalocean \
--digitalocean-access-token=$TOKEN \
--digitalocean-region=ams3 mh-keystore-do
docker $(docker-machine config mh-keystore-do) run -d \
-p "8500:8500" \
-h "consul" \
View KMeans.java
import org.apache.commons.lang3.time.StopWatch;
import org.apache.commons.math3.ml.clustering.CentroidCluster;
import org.apache.commons.math3.ml.clustering.Clusterable;
import org.apache.commons.math3.ml.clustering.DoublePoint;
import org.apache.commons.math3.ml.clustering.KMeansPlusPlusClusterer;
import org.apache.commons.math3.random.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@mustafaakin
mustafaakin / SQLTester.java
Last active Dec 19, 2019
Flink Streaming SQL Example
View SQLTester.java
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.timestamps.AscendingTimestampExtractor;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.TableEnvironment;
import org.apache.flink.table.api.java.StreamTableEnvironment;
import org.apache.flink.types.Row;
@mustafaakin
mustafaakin / receivers.yaml
Created Dec 12, 2019
Receiver configuration for Kubernetes Event Exporter
View receivers.yaml
receivers:
- name: "alerts"
opsgenie:
apiKey: xxx
priority: "P3"
message: "Event {{ .Reason }} for {{ .InvolvedObject.Namespace }}/{{ .InvolvedObject.Name }} on K8s cluster"
alias: "{{ .UID }}"
description: "<pre>{{ toPrettyJson . }}</pre>"
tags:
- "event"
@mustafaakin
mustafaakin / configuration.yaml
Created Dec 12, 2019
Configuration for Kubernetes Event Exporteer
View configuration.yaml
route:
# Main route
routes:
# This route allows dumping all events because it has no fields to match and no drop rules.
- match:
- receiver: dump
# This starts another route, drops all the events in *test* namespaces and Normal events
# for capturing critical events
- drop:
- namespace: "*test*"
@mustafaakin
mustafaakin / Test.java
Created Jun 4, 2018
Graal + AWS Java Lambda + Golang
View Test.java
import org.json.JSONObject;
import org.json.JSONTokener;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
public class Test {
@mustafaakin
mustafaakin / find_blur_photos.py
Created Feb 18, 2019
Finding blurred photos by album
View find_blur_photos.py
import os
import sqlite3
import cv2
import numpy as np
def score(filename):
image = cv2.imread(filename)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
View results.csv
Memory(MB) Avg Duration(ms) Max Duration(ms) Avg Graal + Go(ms) Max Graal + Go(ms)
256 489 3179 992 1011
512 235 1426 486 529
1024 123 652 243 266
1536 85 443 162 173
2048 78 371 143 153
View Lambda.java
System.loadLibrary("Hello");
start();
while (true) {
String request = readRequest();
KMeansResult response = kMeans.calculate(request);
String response = response.toString();
writeResponse(response);
}
}
You can’t perform that action at this time.