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 | |
# ----------------------------------------------- | |
# dosya ve dizin izinlerini ayarlayan bash script | |
# ----------------------------------------------- | |
# directory (dizin) | |
find -type d -print0 | xargs -0 chmod 755 | |
# file (dosya) |
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
array = [3, 2, 4, 6, 8, 9] | |
n = 3 | |
# 1.9.2 öncesi | |
array = array.sort {|a, b| rand <=> rand }.slice(0..n - 1) | |
p array | |
# 1.9.2 | |
array = array.shuffle.slice(0..n - 1) |
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/python import sys print sys.argv[1] |
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 'fastercsv' | |
require 'csv' | |
def csv_export table, split_char=",", columns | |
_datas = eval table.capitalize + ".all" | |
csvlib = CSV.const_defined?(:Reader) ? FasterCSV : CSV | |
_csv_out = csvlib.generate(:col_sep => split_char) do |csv| | |
csv << columns | |
_datas.each do |row| | |
csv << columns.collect { |column| row.attributes[column] } |
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
select u.id, concat(u.name, ' ', u.surname) as fullname, | |
sum(if( g.id = 1, 1, 0 )) AS 1nolu, | |
sum(if( g.id = 2, 1, 0 )) AS 2nolu, | |
sum(if( g.id = 3, 1, 0 )) AS 3nolu, | |
sum(if( g.id = 4, 1, 0 )) AS 4nolu | |
from users u, groups g, member m | |
where | |
m.user_id = u.id and | |
m.group_id = g.id | |
group by u.id; |
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
select u.tc, u.name, u.surname, u.password, u.email, t.name as type | |
from users u, utype t | |
where | |
u.utype = t.utype_id; | |
# bu kisa ama utype_id de geliyor performans yer, cok kullanicida | |
select u.*, t.name as type |
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
server { | |
listen 80; | |
server_name localhost; | |
root /var/www; | |
index index.html index.htm index.php; | |
rewrite ^/*$ /a/ redirect; | |
set $service ""; |
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
function is_tc(tc) { | |
var tc, on, onbir; | |
if (tc.length != 11 || tc == 0) return false; | |
on = | |
((((Number(tc[0]))+Number(tc[2])+Number(tc[4])+Number(tc[6])+Number(tc[8]))*7) | |
-(Number(tc[1])+Number(tc[3])+Number(tc[5])+Number(tc[7])))%10; | |
onbir = | |
(Number(tc[0])+Number(tc[1])+Number(tc[2])+Number(tc[3])+Number(tc[4])+ | |
Number(tc[5])+Number(tc[6])+Number(tc[7])+Number(tc[8])+Number(tc[9]))%10; |
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
gdemir@hummer:~/bin$ git push | |
^C | |
gdemir@hummer:~/bin$ git push -vf | |
Pushing to [email protected]:gdemir/x | |
Read from socket failed: Connection reset by peer | |
fatal: The remote end hung up unexpectedly |
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
# Test kodlarını üret. | |
# Kullanım: | |
# make # üret | |
# make clean # temizle | |
PROGS := $(patsubst %.c,%,$(wildcard *.c)) | |
# pthread kitaplığını ekle. | |
CFLAGS += -Wall -lpthread |