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.
Remotely Edit Files in Vim
If you want to edit files on a remote server with your current lovely vim configs there are 2 options:
One is to copy your .vimrc to all servers. Which is not efficent and denying one of the main software development principle - DRY ,
Another one is instead of bringing .vimrcto each server you need to work on, edit the remote files from your local vim:
Start vim like this:
sudo vim
You need to edit your file as root. Maybe you need to change default keyboard layout from “en” to “de” with editing /etc/default/keyboard.
OK, you opened the file with your favorite text editor -aka. vim, started to edit but realised that something’s wrong. Your mappings not working. Even your alias not working for neovim -eg. alias vi=nvim, it opened the file “legacy” vim.
You may come up a solution with another alias like:
pytest Exceptions - Part I
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries.
One of the advantages of pytest over the unittest module is that we don’t need to use different assert methods on different data structures. So I’d rather use pytest.
A good test suite should test the expected behaviour both when the input is correct and also when the input triggers some exception.
Git Which Ignores
You just started a new project that a team has working on for a while and like to add your code into the codebase. Or you want to use a well-known webapp template for your new project.
You wrote the code, made your tests and then added your “piece of magic” text but it doesn’t show up in version control. git status not showing your file or directory. Also you can’t check manually .
Python Debug Decorators
Sometimes when debugging we like to print/log out all the inputs and outputs of a method: name, args, kwargs, dict etc.
We would have some IDE debug features for this purpose but sometimes we need manual debugging.
And while manual debugging I don’t want to write logger.debug(<messsage>) to every one of two lines of a module.
The solution : Python Decorators
First configure a logger. In this post I will implement a default basic configuration.