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 Convert Markdown to PDF/docx
There are a lof options out there but I would suggest to use pandoc to convert your markdown files to PDF, docx etc..
From Ubuntu pandoc manpage:
Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library. It can read Markdown, CommonMark, PHP Markdown Extra, GitHub-Flavored Markdown, MultiMarkdown, and (subsets of) Textile, reStructuredText, HTML, LaTeX, MediaWiki markup, TWiki markup, Haddock markup, OPML, Emacs Org mode, DocBook, txt2tags, EPUB, ODT and Word docx; and it can write plain text, Markdown, CommonMark, PHP Markdown Extra, GitHub-Flavored Markdown, MultiMarkdown, reStructuredText, XHTML, HTML5, LaTeX (including beamer slide shows), ConTeXt, RTF, OPML, DocBook, OpenDocument, ODT, Word docx, GNU Texinfo, MediaWiki markup, DokuWiki markup, ZimWiki markup, Haddock markup, EPUB (v2 or v3), FictionBook2, Textile, groff man pages, Emacs Org mode, AsciiDoc, InDesign ICML, TEI Simple, and Slidy, Slideous, DZSlides, reveal.
Django Class-Based View - TypeError
Error : Django 2.X Error: init() takes 1 positional argument but 2 were given
It took me significant amount of time to fix this issue. For future reference and possible-need of someone I would like to share the root cause and solution;
When you look at the console output you will the see traceback of the error like below:
Traceback (most recent call last): File "/home/user/projects/django-cbv/.venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner response = get_response(request) File "/home/user/projects/django-cbv/.
Install Fonts in Linux
There may be different directories on different systems/distributions to install your fonts.
To get the list of font files and paths that your OS uses:
$ fc-list -f '%{file}\n' | sort If we take Ubuntu as an example, paths will be like:
~/.local/share/fonts/ — fonts for particular user, local user /usr/local/share/fonts/ — fonts for all users, systemwide Copy your fonts under one of the directories above and reboot the system.
Most Used Commands in Your Shell
I don’t remember where I encountered shell history (bash, zsh etc.), commands but I’d like to share them with you as well:
$ history | awk '{print $2}' | sort | uniq -c | sort -nr | head -10 What these commands do, let’s look at them each:
The awk ‘{print $2}’ prints first fields from the history The famous | transfers or make one command’s output to the input of the next.
Vim - Delete Lines with Regex
Global The ex command :g -global command, is very useful for acting on lines that match a pattern.
Usually it works like this:
:[range]g/pattern/cmdDelete contains To delete all lines that contain “price” you can use:
:g/price/dIf you want to use multiple pattern you can use ‘or’ |:
:g/price|customer|secret/dDelete not contains To delete lines that does NOT contain “price” you can use:
:g!/price/d~Some extras Delete all empty lines :g/^$/dOr deleting all lines that are empty or that contain only whitespace: