Skip to content

Instantly share code, notes, and snippets.

View molcay's full-sized avatar
:octocat:

M. Olcay Tercanlı molcay

:octocat:
View GitHub Profile
import random # başlangıç noktası her seferinde rasgele olarak seçilecek.
N = 8 # satranc tahtasının büyüklüğü. 5 den büyük olmalı
move_list = [] # satranç tahtası üzerinde hangi noktalara basıldığını tutacak
def gen_pos_moves(x,y): # bu fonksiyon olası hareket listesini döndürecek
offset = [-1, -2, 1, 2]
# possible = [ (x+a, y+b) for (a,b) in [ (-2,1), (-1,2), (1,2), (2,1), (2,-1), (1,-2), (-1, -2), (-2, -1)] ]
possible = [ (x+a, y+b) for a in offset for b in offset if abs(a) != abs(b)]
return [ (a,b) for (a,b) in possible if 0<=a<N and 0<=b<N and (a,b) not in move_list]
@molcay
molcay / NQueen.java
Created July 2, 2015 01:57
N Queen Problem
public class NQueen {
public static int[] olustur(int N) {
int kalan = N % 12;
System.out.println(kalan);
int[] yeniDizi = new int[N];
int indeks = 0;//yeni dizinin indeks ine pointer olacak.
int baslangic = (kalan != 3 && kalan != 9) ? 2 : 4;
for (int i = baslangic; i <= N; i += 2) {
@molcay
molcay / ReadAsTextFileWriteAsJson.py
Last active March 7, 2017 12:26
24 Bin Haber [from: http://www.kemik.yildiz.edu.tr/?id=28] için dosya içeriğini json olarak veren script
# -*- coding: utf-8 -*-
import os
import json
import io
__basedir__ = os.getcwd()
categories = os.listdir(__basedir__)
files_content = []
@molcay
molcay / Format Sonrası.md
Last active November 21, 2016 09:15
Format Sonrası Yapılacak Listesi

Installation and Settings after new setup of Linux installation (Linux Mint 17 - 18)

  • Update & Upgrade from GUI:
sudo apt-get update
sudo apt-get upgrade
  • Install Boot-Repair for GRUB:
@molcay
molcay / get_file_list.py
Last active November 21, 2016 08:23
This script can list all files and subfolders. Actually, 'du -h' command do the jobs the other part includes timestamp to the text file.
#!/usr/bin/python
import datetime
import os
import sys
now = datetime.datetime.now()
# print now.year, now.month, now.day, now.hour, now.minute, now.second
filename = "{}-{}-{}-{}-{}-{}".format(now.year, now.month, now.day, now.hour, now.minute, now.second)
suffix = "FileList"
@molcay
molcay / Network Notları.txt
Last active October 13, 2021 06:40
Computer Network Course: Cisco Packet Tracer
Network Setup !!!!! kaydetmek için -> copy running-config startup-config -> komutunu yazmayý unutma !!!!!
Router> -> exec modunu temsil eder
Router>enable
Router# -> privilage_exec modunu temsil eder
Router# configure terminal
Router(config)# -> global configure modunu temsil eder
Router(config)#hostname R1 -> router in adýný deðiþtirmeye yarar
R1(config)#line vty 0 4 -> bu satýr telnet de maksimum 5 baðlantýya izin verir
R1(config-line)#password YENI_PAROLA -> YENI_PAROLA diye bi parola belirlemeye yarar. (telnet connection için)
R1(config-line)#login -> login olma yeteneði kazandýrmak için
@molcay
molcay / Assignment4.md
Last active November 13, 2016 22:22
CENG 4541 Advanced Computer Network Course Assignment 4 Codes
  • Topology drawn
  • Subnetting

to set up VTP Server and Clients

  • In SW2 (vtp server):
     enable
     conf t
     vtp mode server
    
@molcay
molcay / Python Notes.md
Last active November 21, 2016 09:12
Python Notes

This gist is about Python perpective from Programming Language Consept.

@molcay
molcay / Javascript Notes.md
Last active November 21, 2016 09:13
Javascript Notes

This gist is about Javascript perpective from Programming Language Consept.

@molcay
molcay / Linux CLI Commands.md
Last active March 1, 2019 04:37
Linux Commands
  • cat: concatenate files and print on the standard output
    • cat > a.txt: start a file creation
    • cat a.txt: show file content
    • cat a.txt b.txt: show files content respectively
    • cat a.txt b.txt > c.txt: create a file which contains a.txt and b.txt
  • chmod: change file mode bits
    • chmod +x a.txt: All users and groups have the execute permission
    • chmod $u$g$o a.txt: Give specific user permission
      • $u -> current user permission number
      • $g -> current user's group permission number