Skip to content

Instantly share code, notes, and snippets.

View semihozkoroglu's full-sized avatar

Semih Özköroğlu semihozkoroglu

View GitHub Profile
@semihozkoroglu
semihozkoroglu / metinbicimleme.cs
Created May 17, 2011 17:46
html veriyi düz metin yapmak için (belirli karakterler için tanımlı)
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MetinBicimleme
{
public class OkumaYazma
{
@semihozkoroglu
semihozkoroglu / KelimeAgaci.cs
Created May 23, 2011 23:51
Agac yapısı özyineli olarak kullanılarak sözlük veri yapısı tasarlanmıştır.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Agac
{
public class KelimeAgaci
{
string kelime;
@semihozkoroglu
semihozkoroglu / kullan.sh
Last active September 25, 2015 23:07
gerekli kod parçacıkları
rename 's/eski/yeni/' * #bulundugumuz dizinde dosya ismi değiştirmek için.
echo '/tmp/foo/bar/baz.jpeg' | sed -ne 's/\(.*\)\.\(.*\)$/dosya:\1\nuzanti:\2\n/p' # p parametresini kaldırırsak sed'in sesiz kalmasını `-n` paremetresini kaldırmalıyız. `-ne` olmalı `-en` olamıyor
echo '<a href="http:www.google.com">' | sed -ne 's/\(.*\)\:\(.*\)">$/link:\2/p'
echo '10-12-2011' | sed -e 's/\(\d\{2\}\)-\(\d\{2\}\)-\(\d\{4\}\)/\3-\2-\1/'
echo '10-12-2011' | sed -e 's/\([^-]*\)-\(\([^-]*\)-\(.*\)\)$/\4-\3-\1/'
@semihozkoroglu
semihozkoroglu / Daq-tek-kanal.m
Created June 19, 2011 23:24
Tek kanal üzerinde ses sinyalini gönderme.
% 1) Analogoutput nesnesi olusturma
AO = analogoutput('nidaq','Dev1');
% 2) Kanal ekleme
chan = addchannel(AO,0);
@semihozkoroglu
semihozkoroglu / rehber.py
Created August 14, 2011 18:54
to vcard
#!/usr/bin/python
# -*- coding: utf-8 -*-
import xlrd
sayf1 = xlrd.open_workbook("Rehber.xls")
sh = sayf1.sheet_by_index(0)
for i in range(sh.nrows):
@semihozkoroglu
semihozkoroglu / mp4tomp3
Created October 8, 2011 13:46
mp4 to mp3
#! /bin/bash
#
# Mevcut dizindeki tüm mp4 uzantılı dosyaları mp3'e dönüştürür..
#
for f in *.mp4; do
newname=`echo $f | tr ' ' '_' `
mv "$f" $newname
f=$newname
mplayer $f -ao pcm:file=tmp.wav
lame -b 128 -q 2 tmp.wav ${f/.mp4/.mp3}
@semihozkoroglu
semihozkoroglu / mysqldump.sh
Created November 25, 2011 20:07
veritabanı yedekleme..
#!/bin/bash
if [ $# -eq 0 ]; then
echo "kullanimi: '<user> <dbname> <dbpass>' "
echo "Yedekleme dizini belirtmek istiyorsaniz: '<user> <dbname> <dbpass> <path>' "
fi
date=$(date +"%d-%m-%Y")
if [ $# -eq 4 ]; then
@semihozkoroglu
semihozkoroglu / xmlparser.rb
Created January 14, 2012 22:23
xml2pdf #eksik
require 'rexml/document'
include REXML
UTF8 = "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/></head>"
file = File.new( "yazılar.xml" )
doc = REXML::Document.new file
doc.elements.each("*/channel/item/") do |f|
garbage = File.new('foo.html',"w")
garbage.write(UTF8 + f.elements['title'].text + f.elements['content:encoded'].text)
garbage.close
@semihozkoroglu
semihozkoroglu / different.m
Created February 1, 2012 19:45
Görüntü lab final son soru cevabı..
function renk_sayisi=different()
I = imread('autumn.tif');
J = {};
[R C L] = size(I);
for r=1:R
for c=1:C
if ( bul(J,I(r,c,1),I(r,c,2),I(r,c,3)))
J{length(J)+1} = [I(r,c,1),I(r,c,2),I(r,c,3)];
for f in *jpg
do
convert -resize 10% $f $f
done