Skip to content

Instantly share code, notes, and snippets.

View MrSimsek's full-sized avatar
🎸
Jamming in Javascript

Deniz Simsek MrSimsek

🎸
Jamming in Javascript
View GitHub Profile
@MrSimsek
MrSimsek / left_rotation.py
Last active July 23, 2017 07:23
Arrays: Left Rotation
def array_left_rotation(a, n, k):
# Creta Empty List
b = []
# Loop through a
for i in range(n):
# Append new position value to b
b.append(a[(i + k) % n])
return b
n, k = 5, 4 # map(int, input().strip().split(' '))
@MrSimsek
MrSimsek / Book Inventroy Database
Last active August 6, 2017 18:29
Genre Database Optimization
# For databases that each item might have more than one tags like genres.
# It is not an optimal solution to append appropriate genres to each items seperately. For example; when we search for adventure novels,
# the database nelow will firts loop through each book and then each genre it contains which will give a O(N^2).
{
"novels" : {
"The Lord of The Rings" : {
"author" : "JRR Tolkien",
"genre" : ["Fantasy", "Adventure"]
},
@MrSimsek
MrSimsek / secret_love_message.py
Created October 7, 2017 07:29
A Public Key Cryptography Story
from Crypto.PublicKey import RSA
# Ross created a public-private key pair himself
ross_key = RSA.generate(2048)
# He seperated his public key from the pair
ross_pubkey = ross_key.publickey()
# A key pair for Rachel, NORMALY THIS MUST BE CREATED BY HER!
rachel_key = RSA.generate(2048)
# Rachel's public key
@MrSimsek
MrSimsek / advanced_secret_love_message.py
Last active October 7, 2017 09:28
The PKC Story Continues
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA256
ross_key = RSA.generate(2048)
ross_pubkey = ross_key.publickey()
# NORMALY THIS MUST BE CREATED ON THE RECIPIENT SIDE!
# Because it involves PRIVATE KEY INFORMATION!
rachel_key = RSA.generate(2048)
<html>
<head>
<title>Doughnuts Recipe</title>
</head>
<body>
<h1>How to make Doughnuts</h1>
<p>Homemade doughnuts are a bit of a project, but they’re less work than you might think, and the result is a truly great, hot, crisp doughnut.
Once you’ve mastered <br /> this basic recipe for a fluffy, yeasted doughnut, you can do pretty much anything you like in terms of glazes, toppings and fillings.</p>
<img src="https://static01.nyt.com/images/2014/12/14/magazine/14eat1/14mag-14eat.t_CA0-articleLarge.jpg" />
<h2>Ingridients</h2>
@MrSimsek
MrSimsek / colored-address-bar.html
Created November 12, 2018 12:55
Meta tags to color address bar
<meta name="theme-color" content="#000"> <!-- Chrome, Firefox OS, Opera and Vivaldi -->
<meta name="msapplication-navbutton-color" content="#000"> <!-- Windows Phone -->
<meta name="apple-mobile-web-app-status-bar-style" content="#000"> <!-- iOS Safari -->
@MrSimsek
MrSimsek / outputEmployeeHTML.js
Created November 27, 2018 09:19
Changed listMajors function
function outputEmployeeHTML(no, name, title, email) {
// If encoding(second parameter) is not specified, readFile outputs Buffer
fs.readFile('./email-template.html', "utf8", (err, html) => {
if(err) console.log(err);
let employeeHTML = html;
const employeeData = {
'{NAME}': name,
'{TITLE}': title,
'{EMAIL}': email
using UnityEngine;
public class CubeMovement : MonoBehaviour {
public float speed = 10f;
// Update is called once per frame
void Update () {
float horizontalMovement = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
float verticalMovement = Input.GetAxis("Vertical") * Time.deltaTime * speed;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraControl : MonoBehaviour {
[SerializeField]
private GameObject player;
[SerializeField]
@MrSimsek
MrSimsek / login.feature
Last active March 20, 2019 15:32
Cucumber feature for BDD Testing
Feature: login
In order to use the site
As a user
I want to login
Background:
Given a user exists with username "denizsimsek93" and password "123456789"
And I am on the "login" page
Scenario: Login (with username)