Skip to content

Instantly share code, notes, and snippets.

View itwasmycode's full-sized avatar
🎯
Focusing

Kemal Emre Colak itwasmycode

🎯
Focusing
View GitHub Profile
@itwasmycode
itwasmycode / chaoticChipper.scala
Last active September 18, 2020 07:35
In order to increase nonlinearity of a encoder function we used chaotic chipper. It differs from Chaotic Chipper where we use two different key to encryption.
import scala.math.pow
import scala.util.Random
// KEMALEMRECOLAK CHECK! DONE!
@annotation.tailrec
def digitXorerFunc(xorer:List[Int]) : Option[Int] = xorer match{
case Nil => None
case xs::Nil => Some(xs)
case xs::ys::Nil => Some(xs^ys)
case xs::ys::zs => digitXorerFunc((xs^ys)::zs)
@itwasmycode
itwasmycode / operation_system_sim.py
Created August 27, 2020 12:44
A simulation of FCFS, SJF , Prioritized FCFS using Python
# 4,202,105
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import time
from collections import Counter, deque, namedtuple
from dataclasses import dataclass
from pprint import pprint
np.random.seed(105)
@itwasmycode
itwasmycode / test.pl
Created May 6, 2020 13:45
Prolog code project given by ICU.
% Students, Optional Lessons, Required Lessons and Student Grades
student(01, emre, comp).
student(02, merve, com).
student(03, eylul, elec).
oLesson(03, logicprog, 5).
oLesson(04, softengine, 6).
rLesson(01, programming, 3).
sLesson(01, 01, 40).
sLesson(01, 02, 10).
sLesson(03,02,0).
@itwasmycode
itwasmycode / ParanthesisCheck.scala
Created January 9, 2020 00:37
Controlling Paranthesis Scala with Recursion
def balance(chars: List[Char], tst: Int, tst1:Int) : Boolean= {
val pht = Array('(',')')
if ((chars==List()) && tst == tst1) true
else if(chars==List() && tst!= tst1)false
else balance(chars.tail, tst + bool2int(chars.head==pht(0))
,tst1+bool2int(chars.head==pht(1)))
}
@itwasmycode
itwasmycode / data_comm_sim_v2.py
Created December 28, 2019 14:36
Data Communication Text Simulation Includes Go-Back-N and Stop and Wait
import time
import numpy as np
import collections
import math
from collections import namedtuple
from itertools import chain
from functools import wraps
def bit_producer(mx):
"""
@itwasmycode
itwasmycode / data_communication_sim.py
Created December 16, 2019 14:48
Simulates Basic Data Communication Process(HTTP etc.) Produces Error. Calculates Utilization, ThroughPut-GoodPut.
import time
import numpy as np
import collections
from collections import namedtuple
from itertools import chain
from functools import wraps
def bit_producer(mx):
"""
DOCSTRING
@itwasmycode
itwasmycode / lineer_app.scala
Last active November 29, 2019 22:40
This is a file that implements lineer aproximation table with a given lookup table and according to lookup table, produce an 16x16 array which is our solution.
import collection.mutable.{Map => MM}
import scala.math.pow
import scala.collection.mutable.ListBuffer
import scala.collection.mutable.{ArrayBuffer}
//Lookup array described.
val lookupArr = Array(0xE, 0x4, 0xD, 0x1, 0x2, 0xF, 0xB, 0x8, 0x3, 0xA, 0x6, 0xC, 0x5, 0x9, 0x0, 0x7)
//There is an logical it is being applied to a 4-digit by logical XOR.
def xorerFunc(vl1 : String) = {
var holderStr = 1
for(vlr<-0.to(3))
@itwasmycode
itwasmycode / forward_selection.py
Created September 7, 2019 12:41
These file includes forward_selection updated version for self-learning. Instead of codes on the web, I prefer writing my own forward_selection.
def forward_selection(dataframe, predictors, response, max_features=8):
def process_linear_model(predictors_):
print(predictors_, "predictors")
X = dataframe[predictors_].values
y = dataframe[response]
model = LinearRegression()
model = model.fit(X,y)
y_pred = model.predict(X)
RSS = mean_squared_error(y, y_pred) * len(y)
return (model, RSS, predictors_)