Erdal TAŞKESEN Erdal TAŞKESEN

BLOG

git (4) python (4) devops (3)

How to fix wrong Git Tag date

07 December 2018

You can add git tag to a previous commit using git tag TAG_NAME COMMIT_HASH, but it will ammend current date to that tag which can screw your repository by making out of chronological order. Don’t worry, You may fix this using the code below.

git tag -l | while read -r tag ; do COMMIT_HASH=$(git rev-list -1 $tag) && GIT_COMMITTER_DATE="$(git show $COMMIT_HASH --format=%aD | head -1)" git tag -a -f $tag -m"$(git show $COMMIT_HASH --format=%s | head -1)" $COMMIT_HASH ; done && git push --tags --force

Moving from Flask to Hugo

01 December 2018

I have been planning to rejuvenate my personal website / blog with a new backend for a long time. I have finally moved to Hugo after messing with different kind of tech stacks over the time.

I have moved every single feature to Hugo successfully, but There are a few things that don’t fully work yet, but for the moment, I’m happy with my new site.

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"

Upgrading Ubuntu Server LTS from 16.04 to 18.04

13 May 2018

Ubuntu 18.04, aka Bionic Beaver, was released on 26 April 2018. In this post, I will try to explain how do I upgrade my Ubuntu server. I will also inform you about how I overcome the obstacles related python hosting.

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. This tutorial aims to build a small and simple app. The entire app fits in a single file.

Saving the local changes temporarily in Git

08 March 2018

Imagine that you’re 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()