30 Nisan 2019 Salı

Recursive olarak bir kullanıcıya 777 vermek

setfacl -R -m u:colleague:rwX .

18 Mart 2019 Pazartesi

Python2 - Replace Turkish characters with ascii look-alikes

#!/usr/bin/python -tt
# -*- coding: utf-8 -*-

import codecs
import sys
from base64 import b64encode#reload()
#sys.setdefaultencoding("utf-8")

UTF8Writer = codecs.getwriter('utf8')
sys.stdout = UTF8Writer(sys.stdout)

def TRreplacer(mmm):
   my_dict = dict({u'ğ':"g", u'ş':"s", u'ç':"c", u'ü':"u", u'ı':"i", u'ö':"o", u'Ö':"O", u'Ğ':"G", u'Ş':"S", u'Ç':"C", u'Ü':"U", u'İ':"I"})

   for items in my_dict:
       mmm=mmm.replace(items,my_dict[items])
   return mmm

print TRreplacer(u'YİĞİT ÖZEN')

29 Kasım 2018 Perşembe

Oracle - Tablo ya da Kolon ismiyle arama

SELECT owner, table_name, column_name
FROM all_tab_columns
WHERE column_name like '%YOUR_COLUMN_NAME%'
AND OWNER in ('YOUR_SCHEMA_NAME');

SQL Server Tablo ya da Kolon ismiyle arama

SELECT Table_Name, Column_Name
FROM  INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = 'YOUR_DATABASE'
AND   COLUMN_NAME LIKE '%YOUR_COLUMN%'

Linux - Dinlenen portlar

netstat -tupln | grep ':5000'

Linux port açma

iptables -I INPUT -p tcp --dport 5000 -j ACCEPT

10 Nisan 2018 Salı

Şifrede @ kullanmak

@'leri %40 ile değiştirmek yetiyor.

12 Mart 2018 Pazartesi

Bash - Değişkenin bir kısmını yazdırmak

variable="bu sozcuk Turkce"

echo ${variable%sozcuk*}
bu (sozcuk'ten öncesi)

echo ${variable#*sozcuk}

Turkce (sozcuk'ten sonrası)

8 Mart 2018 Perşembe

Regex - karaktere kadar match

/[^;]*/
(Karakter = ;) 

20 Kasım 2017 Pazartesi

Batch - Değişkenler ile Replace

@echo off
setlocal enabledelayedexpansion
set string=Uzun bir cumle
set find=Uzun
set replace=Kisa
call set string=%%string:!find!=!replace!%%
echo %string%

Output = Kisa bir cumle

Batch - String'den silme

@echo off
set string=Uzun bir cumle
set string=%string:Uzun=%
echo %string%

Output = bir cumle

Batch - Dosya ismindeki uzantıyı silmek

@echo off
    for /R "C:\Path" %%f in (*.txt) do (
    echo %%~nf
)
pause

Bash - Dosyanın her satırına string prepend etmek

for /f "tokens=*" %a in (input.txt) do (echo oncul_metin.%a) >> output.txt

13 Kasım 2017 Pazartesi

set a=5
set /a c=%a%*16

10 Kasım 2017 Cuma

Batch - Komut satırı argümanlarını kullanmak

echo off

set arg1=%1
set arg2=%2

echo arguman1: %arg1%
echo arguman2: %arg2%

Batch - Replace

@echo off
set string=This is my string.
set string=%string:my=your%
echo %string%

Bash - Dosyanın satırlarını döngüye input etmek


while read r; do
        git clone $r
done <repo_list.txt

Git - Repoya commit edenlerin listesi

git shortlog -sn | cut -f2

Bash - Komut çıktısını değişkene atamak

dir=$(pwd)

Bash - Url parse etmek

echo https://repository/COLLECTION/app/_git/repo  | cut -d/ -f7-