Skip to content

Instantly share code, notes, and snippets.

View huseyin's full-sized avatar

Hüseyin Tekinaslan huseyin

View GitHub Profile
@huseyin
huseyin / fractions.py
Last active November 14, 2015 10:32
Veri yapıları - Ödev (Egzersiz-3)
# -*- coding: utf-8 -*-
""" Kesirli sayılar uzayı
from: Hüseyin Tekinaslan <[email protected]>
subject: Veri Yapıları - Egzersizler-3
"""
import fractions as fr
@huseyin
huseyin / colorize.py
Last active November 14, 2015 20:07
ıvır zıvır işler
import re
import __builtin__
class ColorizeString(str):
def colorize(self, color=None, **kwcolors):
if color is not None:
kwcolors = None
# Renk argüman olarak alınırken bir dict değil ise mutlak suretle
# string tipli olmalıdır.
if not isinstance(color, basestring):
/* Java Örneği-1
* Ivır-zıvır örneklerden - Hesap makinesi
*/
public class Calculator {
public static void main(String[] argv) {
if (argv.length != 3) {
System.err.println("calculator: " +
"Usage: java Calculator <number1> <operator> <number2>");
System.exit(1);
}
// echo - java
public class echo {
public static void main(String[] argv) {
for (int i=0; i < argv.length; i++)
System.out.println(argv[i]);
}
}
@huseyin
huseyin / cat.java
Created November 23, 2015 23:37
Java'da cat komutu. Bu işler böyle.
import java.util.Scanner;
public class cat {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while (s.hasNext()) {
System.out.println(s.next());
}
}
}
@huseyin
huseyin / Main.java
Last active November 25, 2015 23:27
Java vize sorusu
/*
* Java-I Vize sınav sorusu - Dört parçadan oluşan bir yapı tasarımı.
*
* Kısaltmak amacıyla üç dersin notunun ortalamasına göre hesaplandı.
* Her ders için notlar 3'er kez istenmedi.
*/
import java.util.Scanner;
public class Main {
@huseyin
huseyin / foo.c
Created November 25, 2015 11:58
Java sınav sorusunun C'leştirilmiş hali
#include <stdio.h>
#include <stdlib.h>
struct pdata
{
char* student;
int mathematics;
int sciences;
int linguistics;
};
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
int
main(int argc, char* argv[])
{
GHashTable* hash = g_hash_table_new(g_int_hash, g_int_equal);
guint32* key = (guint32*)malloc(sizeof(guint32));
@huseyin
huseyin / exercise.c
Created December 24, 2015 22:59
Öylesine bir alıştırma
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MORE_LIMIT 16
#define LEAST_LIMIT 1
#define max(x, y) (x > y ? x : y)
static const int basket[] = {
// Veri Yapıları Çalışma - Ertis Shell Dinamik Yönetim için
// bir-iki deneme.
#include <stdio.h>
#include <stdlib.h>
#define STACK_MAX_LENGTH 256 // 1 << 8