This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hanoi(n, a='A', b='B', c='C'): | |
""" | |
move n discs from a to c using b as middle | |
""" | |
if n == 0: | |
return | |
hanoi(n-1, a, c, b) | |
print a, '->', c | |
hanoi(n-1, b, a, c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newpath | |
270 360 moveto | |
0 72 rlineto | |
72 0 rlineto | |
0 -72 rlineto | |
closepath | |
fill | |
showpage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# graphics.py | |
"""Simple object oriented graphics library | |
The library is designed to make it very easy for novice programmers to | |
experiment with computer graphics in an object oriented fashion. It is | |
written by John Zelle for use with the book "Python Programming: An | |
Introduction to Computer Science" (Franklin, Beedle & Associates). | |
LICENSE: This is open-source software released under the terms of the | |
GPL (http://www.gnu.org/licenses/gpl.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from graphics import * | |
def main(): | |
win = GraphWin("My Circle", 100, 100) | |
c = Circle(Point(50,50), 10) | |
c.draw(win) | |
win.getMouse() # Pause to view result | |
win.close() # Close window when done | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from graphics import * | |
def sierpinskiT(points,level,win): | |
colormap = ['blue','red','green','white','yellow','violet','orange'] | |
p = Polygon(points) | |
p.setFill(colormap[level]) | |
p.draw(win) | |
if level > 0: | |
sierpinskiT([points[0],getMid(points[0],points[1]),getMid(points[0],points[2])],level-1,win) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
host,port = ARGV | |
begin | |
STDOUT.print "Connecting..." | |
STDOUT.flush | |
s = TCPSocket.open(host,port) | |
STDOUT.puts "done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
class ChatServer | |
def initialize(port) | |
@descriptors = [] | |
@serverSocket = TCPServer.new('',port) | |
@serverSocket.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR , 1 ) | |
puts "server started on port #{port}" | |
@descriptors << @serverSocket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# coding: utf-8 | |
# Video To Mp3 --> vtm.rb | |
# | |
# Amaç | |
# --- | |
# | |
# hedef klasördeki belirtilen uzantılara sahip tüm vidyoları mp3'e çevirme... | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# markdown ile yazılan dosyalardan pdf üret. | |
# Örnek: <betik> ~/examples.md | |
PATH=/var/lib/gems/1.8/bin:$PATH | |
[ $# -gt 0 ] || { | |
echo >&2 "Kullanım: $0 < markdown dosyası>" | |
echo >&2 "Örnek: $0 ~/examples.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
# aşağıdaki biçimde gelen bir csv dosyadan lwat'a yüklenebilecek | |
# biçimde bir csv dosya oluştur: | |
# | |
# öğrenci no,ad soyad | |
# | |
# orijinal hali https://gist.github.com/3d690cbdfd6055b8a05b | |
BEGIN { |
OlderNewer