Erdal TAŞKESEN Erdal TAŞKESEN

BLOG

How to change a commit timestamp

20 September 2018

You may need to change the DateTime of a commit in some situations. For example, some countries use daylight saving time period and because of it, some of the commits can have the wrong timestamp.


$ git commit --amend --date "Thu Feb 15 22:37:31 2018 +0300"

How to remove all packages installed by pip

29 March 2018

Sometimes you want to get rid of from all python packages. There is a quick and easy way to do this. The command below will also remove the packages installed via VCS.


$ pip freeze | grep -v "^-e" | xargs pip uninstall -y

Ignoring the .gitignore file

23 March 2018

Today I have a small disagreement with GIT and git ignore rules. When you add a file to a GIT repository, it is tracked by GIT. Then adding it to '.gitignore' won't make GIT forget about that file.

In this post, I will explain how to stop GIT from tracking a file that is already tracked.

Building a Flask REST API without using 3rd party extension

17 March 2018

In this tutorial, I'm going to show you how to create a simple REST API by using Flask framework. I will not bother you with any sort of advanced topic. Probably you won't use this tutorial for any kind of production level product. I just want to show how easy can be to create a REST API with Flask.

Saving the local changes temporarily in Git

08 March 2018

Imagine that you'are working on a big feature in your app. Then you get a critical bug ticket that should be resolved immediately. You don't want to commit the messy code. You just want to save your dirty working environment, do urgent things and go back it. For this, you can use `git stash` command.

How I do backup my server using Dropbox headless

28 February 2018

I have experienced a disaster on my web server a few days ago. While trying to remove one of my dev databases, I have removed the production database accidentally. I was extremely lucky because I duplicated production database to the local one to test a python script and I have all my web app's content in the GIT history which you shouldn't. Because it is not the best practice to put web app's content to the VCS.

How to generate secrets in Python 3.6 and later

23 February 2018

There are a lot of ways to generate random values. But some of them are not suitable for secret keys. There is a new module named secrets in version 3.6 and later. You can use the code below to generate cryptographically strong random values.


import secrets
secrets.token_hex()

How to remove __pycache__ folders and .pyc files

20 February 2018

These folder and files are generated by python. You should add these to your VCS's ignore file. But if you need to clean these manually, you can do with the command below:


find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf

How to block search engines in the nginx

19 February 2018

If you have three layered development structure (local dev, remote staging, remote production) like me, you want to search engines index your staging server. It is easy to prevent search engines from indexing your nginx web server.


add_header  X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";

A journey of a thousand miles begins with a single step

18 February 2018

Some of you may have noticed that I've been building my website/blog for a long time. Even some of those have been pestering me about it.

In 2008, I bought my domain to make my personal website. Since then, I have built this website using different kinds of tech stacks, from static to drupal. Well, it took me over 10 years, but finally, I'm here with a flask website. You may find details of my stack below.