Useful shortcuts for vi editor

Thursday, 15 September 2016

How to gain root access without entering root password on Linux?

Add the line into the end of /etc/sudoers file as root
vi /etc/sudoers
alper ALL=(ALL) NOPASSWD: ALL

Test your connection
ssh alper@10.10.10.10
$ sudo su -
(executes all /etc/profile, .profile and .bashrc files)
# ifconfig
$ sudo su
(executes only .bashrc file)
# ifconfig

References:

Tuesday, 13 September 2016

How to define new db link?

Add a new connection node into tnsnames.ora file.
vi $ORACLE_HOME/network/admin/tnsnames.ora
e.g.
ALPER_DB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = XE )
    ))

Check remote host via tnsping
$ tnsping ALPER_DB

Define a new db link
For specific user:
SQL> CREATE DATABASE LINK "ALPER_DATABASE"
 CONNECT TO hr
 IDENTIFIED BY hr
 USING 'ALPER_DB';

If you desire all users use this link you should add "public" into create statement
For All users (public):
SQL> CREATE PUBLIC DATABASE LINK "ALPER_DATABASE"
 CONNECT TO hr
 IDENTIFIED BY hr
 USING 'ALPER_DB';

Alternative option: define a new db link
For specific user:
SQL> CREATE DATABASE LINK "ALPER_DATABASE"
 CONNECT TO hr
 IDENTIFIED BY hr
 USING '(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = XE )
    ))';

Observe the new link and check it
For specific users:
SQL> select * from user_db_links where db_link = 'ALPER_DATABASE';
SQL> select * from employees@ALPER_DATABASE
For All users (public):
SQL> select * from all_db_links where db_link = 'ALPER_DATABASE';
SQL> select * from employees@ALPER_DATABASE

Extra
Connect without db link:
$ sqlplus "hr@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=10.10.10.10)(Port=1521))(CONNECT_DATA=(SID=XE)))"
or
CMD> sqlplus hr@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=10.10.10.10)(Port=1521))(CONNECT_DATA=(SID=XE)))

Monday, 22 August 2016

How to run a command remotely?

e.g.
psExec \\10.10.10.10 cmd /c calc.exe
psExec \\10.10.10.10 cmd.exe /c msg * 'merhaba'

Note: You can take psExec tool from microsoft site

Wednesday, 17 August 2016

How to run a command as different Windows user?

e.g.
Press "Windows button" -> Type "cmd" -> shift key + right mouse click -> click "Run as different user"

Tuesday, 2 August 2016

How to mount devices at startup by /etc/fstab and /etc/rc.d/rc.local for RedHat distro?

-> define uuid for connected devices
ls -l /dev/disk/by-uuid/

-> add related info into /etc/fstab
e.g.
UUID=1111 /alper/sdb1 ext3 defaults,nobootwait 0 0

-> if this cannot mount the path, you may deal with network issues. To fix it, you should add following command into /etc/rc.d/rc.local config file.
mount -a

extra info: -> If you use 1 1 instead of 0 0 for priority option, you may encounter "maintenance mode" problem. To fix it, run this command
mount -o rw, remount /

Tuesday, 26 July 2016

What are the differences between SAN, NAS and DAS?

SAN(Storage Area Network);
SAN is used for applications to access BLOCK storage over an optical FC network using the SCSI protocol. (e.g. FibreChannel, iSCSI, FoE)

NAS(Network Attached System);

NAS is used for access to FILE storage over TCP/IP on an Ethernet network using either the CIFS (for Windows) or NFS (for Unix) protocol. (e.g. NFS, CIFS, AFS)

DAS(Direct Attached Storage);
DAS is a block device from a disk which is physically [directly] attached to the host machine. (e.g. IDE, SCSI, SATA)

Source: 

http://searchstorage.techtarget.com/tip/SAN-vs-NAS-Which-do-you-need
http://serverfault.com/questions/81723/what-is-the-difference-between-san-nas-and-das

Sunday, 3 July 2016

How to play classical Atari 2600 games on PC?

Everyone misses Atari games of childhood but we are able to play them on our new PCs now.

At first, we need to install Atari emulator on PC which will be Stella. To download it, please click below link. http://stella.sourceforge.net/downloads.php

Subsequently, we should download ROMs of our desired games. To download them, please click one of these links. 
Finally, we are ready to play. 
  • Run Stella
  • Select your favorite ROM (.bin)
  • Enjoy! :)

Friday, 10 June 2016

How to use sqlcl?

Recently, Oracle announced that we have a new SQL Plus command line anymore! Its name is sqlcl that seems to very useful and powerful tool. So, let's take a look at it at below.

First, we need to download it from Oracle site. After that we may extract the file under C:\ directory then add setup path to "Path" environment variable to reach it from CMD. (e.g. C:\sqlcl-4.2.0.16.131.1023-no-jre\sqlcl)

Now we are able to connect our database by sqlcl.

Here are the commands:
sql hr@//localhost:1521/xe
show all
host cls
select last_name, job_id, salary from employees order by salary desc fetch first 10 rows only; 
set sqlformat ansiconsole
set sqlformat csv
history
history 100


Happy coding! :)

Tuesday, 19 April 2016

How to use "wall" and "write" commands?

$ wall
-> press "ctrl+d" to send the message

$ echo "Hello World!" | wall

$ sudo wall message.txt
-> send content of message.txt file

$ write alper
-> press "crlt+c" to quit

$ write alper pts/0
-> run "who" to see terminal names like pts/0

Monday, 18 April 2016

Excel'de nesne ekleme nasıl yapılır?

[Ekle] -> [Nesne] -> [Dosyadan Oluştur] -> [Gözat] -> [Tamam]

Thursday, 7 April 2016

What are hard link and soft link in Linux?

Hard link; it may used for backup (replica) purpose. (seems to RAID 1)
e.g.
$ ln original_file.txt hd_file.txt
$ ln original_file2.txt /home/alper/hd_file2.txt

Soft link; it may used as shortcut like in Windows OS.
e.g.
$ ln -s original_file soft_file.txt
$ ln -s original_file /home/alper/soft_file2.txt

to list the links;
$ ls -l 
(l; list)
or 
$ ls -i
(i; inode number)
then find the files by same inode number
$ find . -inum <inode_number>

e.g.
$ find . -inum 10000

tcpdump examples

tcpdump -D
-> Display all available interfaces for tcpdump

$ tcpdump -i 1 | more
-> Listen (interface 1) with more command

$ tcpdump -i any
-> Listen all actived interfaces

$ tcpdump -i eth1
-> Listen eth1 interface

$ tcpdump -i eth0 port 22
-> Listen eth0 interface on port 22

$ tcpdump -i eth2 port 23 -w example.pcap
-> Listen eth2 interface on port 23 and save as desired file name

Saturday, 2 April 2016

Kelime havuzu

mazur görmek vs mağrur olmak
-> mazur görmek: mazeretli görmek
-> mağrur olmak: gururlu, kibirli olmak 

tahrif etmek, tahkir etmek, tahrik etmek
-> tahrif etmek: bozmak, değiştirmek
-> tahkir etmek: aşağılamak, onur kırmak
-> tahrik etmek: kışkırtmak

Kaynak: TDK

How to capture packages with adb shell?

e.g. 
CMD> adb shell 
# tcpdump -vv -i any -s 0 -w /data/01.pcap
(-v; verbose, -i; interface, -s 0;capture all bytes of data within the packet)

to take the pcap file from the phone;
CMD> adb pull /data/01.pcap

Wednesday, 23 March 2016

How to install adb shell?

Please follow the steps:
  1. Download adb kits from here
  2. Unzip zip file under C:\ directory as "adb"
  3. Add these variables into system variables
    Path -> C:\adb
    ANDROID_ADB_SERVER_PORT -> 7030
  4. Now, open new cmd screen and see that you are able to use adb :)
If you do not know how to use adb, please go there


Tuesday, 22 March 2016

How to set HTTP_PROXY and HTTPS_PROXY via CMD?

CMD> set http_proxy=http://username:password@proxy.com:8080
CMD> set https_proxy=https://username:password@proxy.com:8080

Saturday, 19 March 2016

GA-965P-S3 Post Olmama Sorunu ve DDR2 800 BIOS Ayarı

Merhaba,

Malzemelerimiz:

AnakartGigabyte GA-965P-S3
İşlemci: Intel Core2 Duo E8500
RAM: 1 GB DDR2-800 (x4)

RAM (4 adet 1 GB PC6400) ve CPU (E8500) değiştirdikten sonra beni 2 hafta uğraştıran bu anakart ile ilgili deneyimi paylaşmak istiyorum. 

Gigabyte GA-965P-S3 anakartının E8500 işlemcisini resmi olarak desteklemediğini ek bilgi olarak paylaşmam gerekiyor.

Soruna gelirsek; eğer bilgisayar başlarken POST işlemini geçemiyorsa BIOS ayarlarından aşağıdaki değişikleri yaparak deneyebilirsiniz. İnternetten yaptığım araştırmaya göre; CPU FSB hızı (333 MHz), Rated FSB hızı (1333 MHz) ile RAM DRAM hızı (400 MHz) uyuşmadığından bu problem meydana geliyor. Bu oranın (FSB/DRAM) 1/1 olması gerekiyor.


Seçenek 1: (Önerdiğim)
3-3-3-9 -> 400 MHz RAM - 200 MHz DRAM - 200 MHz Bus Speed
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> CPU Host Clock Control -> [Enabled]
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> CPU Host Frequency(MHz) -> [200]
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> System Memory Multiplier (SPD) -> [2.00]
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> High Speed DRAM DLL Settings -> [Option 2]

F10 -> Y -> [ENTER]

Seçenek 2: 
5-5-5-15 -> 667 MHz RAM - 333 MHz DRAM - 333 MHz Bus Speed
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> CPU Host Clock Control -> [Enabled]
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> CPU Host Frequency(MHz) -> [333]
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> System Memory Multiplier (SPD) -> [2.00]
[DEL] -> MB Intelligent Tweaker (M.I.T.) -> High Speed DRAM DLL Settings -> [Option 2]
F10 -> Y -> [ENTER]

Bu ayarlarla ben sorunu çözdüm umarım sizin de işinizi görür. :)

Sunday, 13 March 2016

How to wrap text in notepad++?

You may see the text according to your screen width. To do that;

Go to "View" -> Activate "Word wrap" -> That's all. :)


How to run cmd from current path?

Go to specific windows path -> Press "Shift+Right Mouse click" -> Click "Open command window here" -> Input your command as you desire


Friday, 11 March 2016

Çöken Windows diskten dosya kurtarma

Bu yazıda sizlere artık geri dönüşü olmadığını düşündüğümüz dosyalarımızı nasıl geri kurtarabiliriz onu anlatmaya çalışacağım.

Çöken İşletim Sistemi: Windows (XP, Vista, 7, 8 veya 10 farketmez)
Kullanılan Linux LiveCD: SystemRescueCd

Boot sırasını BIOS'dan CD/DVD sürücüsü olarak ayarladıktan sonra arayüz ekranında olduğumuzu varsayıyorum ve aşağıdaki komutları teker teker çalıştırıyoruz. (SystemRescueCD nasıl hazırlanır diyorsanız şu yazı işinize yarayabilir)
  • fsarchiver probe simple
    veya

    fdisk -l
  • mkdir /mnt/mybadwindows
    linux-a dosyalarımızı bu dizine göstereceğiz
  • mount –t ntfs-3g  -o –ro /dev/sda2 /mnt/mybadwindows
    /dev/sda2 partisyonunda windows-un kurulu olduğunu varsaydım
  • cd /mnt/mybadwindows
    kurtarılmayı bekleyen dosyalarımızın olduğu dizine gidiyoruz
  • ls -l
    bir baktık neyimiz kalmış diye :)
  • ifconfig
    ftp client ile bağlanmadan önce IP adresimizi öğreniyoruz
  • passwd
    ftp ile dosyalarımızı alırken kullanacağımız şifremizi belirliyoruz
Son tahlilde; WinSCP aracıyla dosyalarımızı artık kurtarabiliriz.

Örnek;
Hostname: 10.10.10.10
Port: 22
Username: root
Password: abc
Default local directory: /mnt/mybadwindows

Sağlıcakla kalın :)

Kaynak:
https://www.youtube.com/watch?v=NPicwN2ZOoQ