Serhat Teker

Serhat Teker is the software engineer who wrote these articles.

I created this Tech Blog to help me remember the things I’ve learned in the past, so my future-self doesn’t have to re-learn them in the future.

            

How to Delete All Files Except Diretories

2020-04-23 — 2 minutes
#linux 
Case I want to delete all files inside the $ROOT of working directory except directories themselves. I faced this challange when I started a new GoHugo project and wanted to iterate/play around typical exampleSite content. Example content for a new GoHugo project: user@host:~$ ls -la total 52K -rw-r–r– 1 user user 1.3K Jul 9 17:44 . -rw-r–r– 1 user user 1.3K Jul 9 17:44 .. -rw-r–r– 1 user user 1.3K Jul 9 17:44 config.

How to Search Packages from Terminal

2020-04-16 — 2 minutes
#linux  #ubuntu  #cli 
There are 2 ways to search available packages from cli on Ubuntu

Auto Source vimrc When Saved

2020-04-09 — One minute
#vim 
If you find yourself always executing :so after every vimrc change, put this in your .vimrc. autocmd! bufwritepost .vimrc source %This causes Vim to automatically source and apply your changes to your vimrc when the buffer is saved. Improvements One It will be better option to use variable, since your .vimrc file may be different: For instance if you use NeoVim your rc file is init.vim. " Automatically source vimrc on save.

Check a String is Palindrome in Python

2020-04-02 — 2 minutes
#python 
A palindrome is any number or string which remains unaltered when reversed. The most pythonic way to determine if a given string is a palindrome would be: def is_palindrome(string): return string == string[::-1] [::-1] slice reverses the string. It is equal to: ‘'.join(list(reversed(string))). With == we compare the equality, then returning True or False. Yes it is so simple and elegant in python. Type Check Actually for a better program before that method we should check that the given value is string type or not:

Clear Search Highlight in Vim

2020-03-24 — One minute
#vim 
After searching in Vim with / all occurences highlighted and this stays for a while. It may be a unwanted or even annoying thing. There are many methods to disable it; 0: Temporarily Disable To turn off highlight until next search, in exe mode: :noh1: Persistent Disable If you want to disable it completely: 1.0: For existing session/buffer: In exe mode: :set nohlsearch1.1: For all sessions/buffers: Put this in your .