Skip to content

Instantly share code, notes, and snippets.

View gceylan's full-sized avatar
🏠
Working from home

Gökhan CEYLAN gceylan

🏠
Working from home
View GitHub Profile
@gceylan
gceylan / referans.py
Created May 24, 2011 14:52
class örnek
class Nokta:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
class Dikdortgen:
pass
def noktayi_yaz(p):
print '(%s, %s)' % (str(p.x), str(p.y))
def row_times_column(m1, row, m2, column):
"""
>>> row_times_column([[1, 2], [3, 4]], 0, [[5, 6], [7, 8]], 0)
19
>>> row_times_column([[1, 2], [3, 4]], 0, [[5, 6], [7, 8]], 1)
22
>>> row_times_column([[1, 2], [3, 4]], 1, [[5, 6], [7, 8]], 0)
43
>>> row_times_column([[1, 2], [3, 4]], 1, [[5, 6], [7, 8]], 1)
50
def liste_matris(m=matris, boyut=5):
matris = {(0, 3): 1, (2, 1): 2, (4, 3): 3}
matris2 = []
n = 0
while n != boyut:
matris2.append([0] * boyut)
n += 1
for tup in matris:
matris2[tup[0]][tup[1]] = matris[tup]
return matris2
@gceylan
gceylan / rot_13.py
Created May 25, 2011 09:41
rot 13 şifreleme
#!/usr/bin/env python
#-*- coding: utf-8 -*-
def sifreLe(sifrelenecek_dosya, sifreli_dosya):
dosya = open(sifrelenecek_dosya, 'r')
sifreli = open(sifreli_dosya, 'w')
while True:
sifre = dosya.readline(50)
for i in sifre:
@gceylan
gceylan / bos_betik_v2.py
Created June 7, 2011 13:49
sıraya göre isim vererek boş .py uzantısı oluşturmaya yarayan program
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Tkinter import *
import os
pencere = Tk()
pencere.geometry("200x75+75+50")
pencere.title("Gökhan CEYLAN")
@gceylan
gceylan / asal_sayi_mi.php
Created July 3, 2011 10:42
bir sayının asallığı
<html>
<head>
</head>
<style>
html { background-color: #656565;}
body {margin:auto; width:400; height:400; margin-top:30px; background-color:grey; padding:20px}
</style>
<title>Asal Sayı mı?</title>
<?php
echo "Sizce 727271 sayısı asal sayı mıdır? Merak mı ettiniz?<br>";
@gceylan
gceylan / text_to_bin_tikinter.py
Created July 31, 2011 22:53
text - binary converter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Tkinter import *
import sys
def temizle():
kutu1.delete(1.0, END)
kutu2.delete(1.0, END)
@gceylan
gceylan / deneme.html
Created October 7, 2011 10:38
aslında bu iş görür
<html>
<head>
<meta charset="UTF-8" />
<title>deneme 1-2-3</title>
</head>
<body>
<section>
<div>
<canvas id="canvas" width="400" height="300"></canvas>
@gceylan
gceylan / poli.py
Created October 14, 2011 18:17
polinom
# -*- coding: utf-8 -*-
def eleman_sayilarini_esitle(liste1, liste2, yer, eleman):
n = len(liste1)
m = len(liste2)
while n != m:
if n > m:
liste2.insert(yer, eleman)
m += 1
else:
liste1.insert(yer, eleman)
@gceylan
gceylan / cozumler.py
Created March 27, 2012 15:06
sinav sorularinin cozumleri
#-*- coding: utf-8 -*-
def en_buyuk_ardil_toplam(dizi):
dizi2 = [0] * len(dizi)
en_buyuk = 0
for ind, i in enumerate(dizi):
if ind == 0:
dizi2[ind] = dizi[ind]