Skip to content

Instantly share code, notes, and snippets.

💭
this is not f* MSN

Mustafa Akın mustafaakin

💭
this is not f* MSN
Block or report user

Report or block mustafaakin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 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;
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);
}
}
View lambda.go
func communicateJava(input interface{}) (interface{}, error) {
inBytes, err := json.Marshal(input)
inputStr := string(inBytes)
goRequest <- inputStr
respStr := <-javaResponse
var resp interface{}
err = json.Unmarshal([]byte(respStr), &resp)
}
//export Java_Test_start
@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 {
View query6.sql
SELECT destinationaddress,
SUM(bytes) AS totalBytes
FROM flows TABLESAMPLE SYSTEM (10)
GROUP BY destinationaddress
ORDER BY totalBytes DESC LIMIT 10
View query5.sql
SELECT sum(packets) AS total,
split_part(sourceaddress,’.’, 1) =10AS isInternal,
action
FROM flows
GROUP BY 2, action
ORDER BY total DESC LIMIT 10
View query4.sql
SELECT corr(bytes,packets), action FROM flows GROUP BY action
View query3.sql
SELECT destinationport,
COUNT(*) AS total
FROM flows
WHERE action = ‘REJECT’
GROUP BY destinationport
ORDER BY total DESC LIMIT 10
You can’t perform that action at this time.