Jekyll2019-08-17T06:33:00+02:00https://blog.codecut.de/feed.xmlKerem’s TechblogMy personal blog about various technical topics. For feedback or questions feel contact me through email.Kerem SeyhanHow to fix menu artifacts of Eclipse on Fedora 30 or how to skip specific versions of packages with dnf2019-07-10T00:00:00+02:002019-07-10T00:00:00+02:00https://blog.codecut.de/2019/07/10/How-To-Fix-Eclipse-Artifacts-Or-How-To-Skip-Specific-Versions-Of-Packages-With-Dnf<p>If you’re on a bleeding edge linux distribution like Fedora 30 or Arch you may encounter some ugly artifacts in your programs right now like i do with Eclipse which looks something like this:</p>
<p><img src="/assets/img/posts/2019-07-10/eclipse.png" alt="screenshot eclipse with overlapping artifacts in the project explorer" width="400px" /></p>
<p>Doing some research leads us to following Bug entry in the Eclipse Bugtracker.</p>
<p><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=548629">https://bugs.eclipse.org/bugs/show_bug.cgi?id=548629</a></p>
<p>Where we can find out that its a problem with the <strong><em>gtk version 3.24.9</em></strong> and that the devs are working on some fixes for it.</p>
<p><a href="https://gitlab.gnome.org/GNOME/gtk/issues/1977">https://gitlab.gnome.org/GNOME/gtk/issues/1977</a></p>
<p>So how to fix this now?</p>
<p>My solution to fix this problem is as follows.</p>
<ul>
<li>
<p>Downgrade the gtk version to 3.24.8</p>
</li>
<li>
<p>And skip the current version of gtk3 from your updates until the next version 3.24.10 will show up.</p>
</li>
</ul>
<p>So lets go..</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">sudo </span>dnf downgrade gtk3-3.24.8</code></pre></figure>
<p>So far so good we should have working menus in eclipse again:</p>
<p><img src="/assets/img/posts/2019-07-10/eclipse-fixed.png" alt="screenshot eclipse fixed view" width="200px" /></p>
<p>but after we run <code class="highlighter-rouge">dnf update</code> the next time gtk3 will automaticly update again.</p>
<p>To deal with this problem we have different solutions like running dnf update with the exclude flag as follows <code class="highlighter-rouge">dnf update -x gtk3</code> or exlcude gtk completely from the package manager or we make it proper by just installing a dnf plugin which will allow us to <strong><em>skip a specific version</em></strong> of gtk until a new version shows up.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">sudo </span>dnf <span class="nb">install </span>python3-dnf-plugin-versionlock</code></pre></figure>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">sudo </span>dnf versionlock exclude gtk3-3.24.9-<span class="k">*</span>.fc30</code></pre></figure>
<p>Here we go. We should be able to use dnf like we’re used to and the fixed version of Gtk3 should show up as soon as its available through the package manager for us.</p>Kerem SeyhanIf you’re on a bleeding edge linux distribution like Fedora 30 or Arch you may encounter some ugly artifacts in your programs right now like i do with Eclipse which looks something like this:Setup a Coreboot Buildroot with Vagrant2019-07-09T00:00:00+02:002019-07-09T00:00:00+02:00https://blog.codecut.de/2019/07/09/Coreboot-Buildroot-With-Vagrant<p>Ive struggled a bit arround getting the buildroot to sucessfully compile on my linux distribution because my gcc version is a little bit newer then the one that gets installed by default on an ubuntu system. So there are two options. You start hacking arround your main os and downgrade what not to get the buildroot running and hope that it will workout somehow or you simply setup yourself a Ubuntu vm with all the needed dependencies.</p>
<p>With this short Vagrant file you should be up and running in a breeze without having any headaches.</p>
<p>Create a Folder and put this <code class="highlighter-rouge">Vagrantfile</code> into it.</p>
<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="c1"># -*- mode: ruby -*-</span>
<span class="c1"># vi: set ft=ruby :</span>
<span class="no">Vagrant</span><span class="p">.</span><span class="nf">configure</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">config</span><span class="o">|</span>
<span class="n">config</span><span class="p">.</span><span class="nf">vm</span><span class="p">.</span><span class="nf">box</span> <span class="o">=</span> <span class="s2">"ubuntu/bionic64"</span>
<span class="n">config</span><span class="p">.</span><span class="nf">vm</span><span class="p">.</span><span class="nf">provider</span> <span class="s2">"virtualbox"</span> <span class="k">do</span> <span class="o">|</span><span class="n">vb</span><span class="o">|</span>
<span class="n">vb</span><span class="p">.</span><span class="nf">gui</span> <span class="o">=</span> <span class="kp">true</span>
<span class="n">vb</span><span class="p">.</span><span class="nf">memory</span> <span class="o">=</span> <span class="s2">"8192"</span>
<span class="k">end</span>
<span class="n">config</span><span class="p">.</span><span class="nf">vm</span><span class="p">.</span><span class="nf">provision</span> <span class="s2">"shell"</span><span class="p">,</span> <span class="ss">inline: </span><span class="o"><<-</span><span class="no">SHELL</span><span class="sh">
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python bison build-essential curl flex git gnat libncurses5-dev m4 zlib1g-dev
git clone https://review.coreboot.org/coreboot ~/coreboot
</span><span class="no"> SHELL</span>
<span class="k">end</span></code></pre></figure>
<p>After running the command <code class="highlighter-rouge">vagrant up</code> in the folder a VirtualBox Ubuntu Bionic 64 VM should get created and you will be able to access your buildroot by sshing to the virtual machine by using the command <code class="highlighter-rouge">vagrant ssh</code>.</p>
<p>Happy hacking!</p>
<p>09.07.2019 Update.</p>
<p>The article just got updated to move the source away from the shared folder, since i found out the hard way that it will give you a lot of compile errors otherwise.</p>Kerem SeyhanIve struggled a bit arround getting the buildroot to sucessfully compile on my linux distribution because my gcc version is a little bit newer then the one that gets installed by default on an ubuntu system. So there are two options. You start hacking arround your main os and downgrade what not to get the buildroot running and hope that it will workout somehow or you simply setup yourself a Ubuntu vm with all the needed dependencies.Setup a blog using Jekyll2019-06-11T00:00:00+02:002019-06-11T00:00:00+02:00https://blog.codecut.de/2019/06/11/how-to-setup-a-blog-using-jekyll<p>Today i’m going to show you how ive setup this blog. I decided to go with the default theme <a href="https://github.com/jekyll/minima">Minima</a> that you get when creating a new <a href="https://jekyllrb.com/">Jekyll</a> site and customize it to my needs.</p>
<h2 id="quickstart">Quickstart</h2>
<p>taken from following url: <a href="https://jekyllrb.com/docs/">https://jekyllrb.com/docs/</a></p>
<ol>
<li>
<p>Install Ruby for your distribution</p>
</li>
<li>
<p>Install Jekyll and bundler gems</p>
<p><code class="highlighter-rouge">gem install jekyll bundler</code></p>
</li>
<li>
<p>Create a new Jekyll site at ./myblog</p>
<p><code class="highlighter-rouge">jekyll new myblog</code></p>
</li>
<li>
<p>Change into your new directory</p>
<p><code class="highlighter-rouge">cd myblog</code></p>
</li>
<li>
<p>Build the site and make it available on a local server</p>
<p><code class="highlighter-rouge">bundle exec jekyll serve</code></p>
</li>
<li>
<p>Now browse to <a href="http://localhost:4000">http://localhost:4000</a></p>
</li>
</ol>
<p>Great.. We’re now up and running and can dive into the customizations i wanted this blog to have.</p>
<h2 id="sorted-navigation">Sorted navigation</h2>
<p>To control the order or the navigation links of the default theme you simply just have to include a <code class="highlighter-rouge">header_pages</code> section into your <code class="highlighter-rouge">_config.xml</code>. Like doumented on the github page of the theme.</p>
<p>So on my blog the section looks like this:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>header_pages:
- categories.md
- tags.md
- privacy.md
- imprint.md
</code></pre></div></div>
<h3 id="excerpts-on-the-home-page">Excerpts on the Home Page</h3>
<p>To show some excerpt of the posts on the overview page we simply just follow the documentation of the minima theme again and add a <strong>show_excerpts</strong> attribute to our <code class="highlighter-rouge">_config.yml</code>.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>show_excerpts: true
</code></pre></div></div>
<p>Now to the tricky part. Since I wanted to have some kinda indicator on the overview page that makes sure that this is just an excerpt and you have to click on the post to read the full article i had modify the theme a little bit.</p>
<p>But nothing easier then that. Lets go.</p>
<p>If we look into the sourcecode of the theme we’re going to find the affected component in the <code class="highlighter-rouge">_layouts</code> folder called <code class="highlighter-rouge">home.html</code>.</p>
<p>So we simply just create a <code class="highlighter-rouge">_layouts</code> folder in our blog aswell. Copy over the affected layout <code class="highlighter-rouge">home.html</code> from the default theme and modify the post.excerpt part in the source like so:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{%- if site.show_excerpts -%}
{{ post.excerpt }}
<a class="excerpt-post-link" href="{{ post.url | relative_url }}">Continue reading →</a>
{%- endif -%}
</code></pre></div></div>
<p>We have now successfully overwritten the home.html of the default theme and should have a nice looking overview page with excerpts and an indicator.</p>
<p><img src="/assets/img/posts/2019-06-11/excerpt.png" alt="screenshot home layout with excerpt" height="100px" /></p>
<p>Lets get trickier..</p>
<h3 id="adding-liquid-tags-and-categories-to-your-page">Adding Liquid Tags and Categories to your page</h3>
<p>There are different ways to add categories and tags to your layout.</p>
<p>For a simple overview page you can follow along the tutorial on the <a href="https://jekyllrb.com/docs/posts/">jekyll site</a> and create a markdown file that will list all those tags and categories on one page but that wasnt realy what i wanted. I wanted those overview pages to be sorted, maybe searchable in a future version and have a bit more structure to all of this.</p>
<p><img src="/assets/img/posts/2019-06-11/categories_and_tags_tree.png" alt="screenshot home layout with excerpt" width="300px" /></p>
<p>And there is a way to archive that by using <code class="highlighter-rouge">generators</code> that jekyll provides which allow you to get a little bit deeper into the materia.</p>
<p>You can read up more about generators following this link <a href="https://jekyllrb.com/docs/plugins/generators/">Jekyll Generators</a>.</p>
<p>Unfortunately i dont find the source of evil where i copied most of the code from right now. If you know it feel free to send me an email and i’ll update this page.</p>
<p>Nevertheless lets dive into the funky world of Jekyll generators now.</p>
<p>Generators are placed into a folder called <code class="highlighter-rouge">_plugins</code> which are ruby files that get executed pretty early in the build process and wont be picked up by any of the watch and reload methods the build and serve methods provide. So keep in mind to manualy restart a build when working with plugins.</p>
<p>Now to the code.</p>
<p>We create a folder called ‘_plugins’ like stated before and create a file called _cat_gen.rb in that folder.</p>
<p><code class="highlighter-rouge">_cat_gen.rb</code></p>
<figure class="highlight"><pre><code class="language-ruby" data-lang="ruby"><span class="k">module</span> <span class="nn">Jekyll</span>
<span class="k">class</span> <span class="nc">CatIndex</span> <span class="o"><</span> <span class="no">Page</span>
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">site</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">dir</span><span class="p">,</span> <span class="n">cat</span><span class="p">)</span>
<span class="vi">@site</span> <span class="o">=</span> <span class="n">site</span>
<span class="vi">@base</span> <span class="o">=</span> <span class="n">base</span>
<span class="vi">@dir</span> <span class="o">=</span> <span class="n">dir</span>
<span class="vi">@name</span> <span class="o">=</span> <span class="s1">'index.html'</span>
<span class="nb">self</span><span class="p">.</span><span class="nf">process</span><span class="p">(</span><span class="vi">@name</span><span class="p">)</span>
<span class="nb">self</span><span class="p">.</span><span class="nf">read_yaml</span><span class="p">(</span><span class="no">File</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="n">base</span><span class="p">,</span> <span class="s1">'_layouts'</span><span class="p">),</span> <span class="s1">'cat_index.html'</span><span class="p">)</span>
<span class="nb">self</span><span class="p">.</span><span class="nf">data</span><span class="p">[</span><span class="s1">'cat'</span><span class="p">]</span> <span class="o">=</span> <span class="n">cat</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">class</span> <span class="nc">CatGenerator</span> <span class="o"><</span> <span class="no">Generator</span>
<span class="n">safe</span> <span class="kp">true</span>
<span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
<span class="k">if</span> <span class="n">site</span><span class="p">.</span><span class="nf">layouts</span><span class="p">.</span><span class="nf">key?</span> <span class="s1">'cat_index'</span>
<span class="n">dir</span> <span class="o">=</span> <span class="s1">'categories'</span>
<span class="n">site</span><span class="p">.</span><span class="nf">categories</span><span class="p">.</span><span class="nf">keys</span><span class="p">.</span><span class="nf">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">cat</span><span class="o">|</span>
<span class="n">write_cat_index</span><span class="p">(</span><span class="n">site</span><span class="p">,</span> <span class="no">File</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="n">dir</span><span class="p">,</span> <span class="n">cat</span><span class="p">),</span> <span class="n">cat</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">write_cat_index</span><span class="p">(</span><span class="n">site</span><span class="p">,</span> <span class="n">dir</span><span class="p">,</span> <span class="n">cat</span><span class="p">)</span>
<span class="n">index</span> <span class="o">=</span> <span class="no">CatIndex</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">site</span><span class="p">,</span> <span class="n">site</span><span class="p">.</span><span class="nf">source</span><span class="p">,</span> <span class="n">dir</span><span class="p">,</span> <span class="n">cat</span><span class="p">)</span>
<span class="n">index</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="n">site</span><span class="p">.</span><span class="nf">layouts</span><span class="p">,</span> <span class="n">site</span><span class="p">.</span><span class="nf">site_payload</span><span class="p">)</span>
<span class="n">index</span><span class="p">.</span><span class="nf">write</span><span class="p">(</span><span class="n">site</span><span class="p">.</span><span class="nf">dest</span><span class="p">)</span>
<span class="n">site</span><span class="p">.</span><span class="nf">pages</span> <span class="o"><<</span> <span class="n">index</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span></code></pre></figure>
<p>If you read carefully you’ll see that we need to provide a layout file called cat_index into which our categories will get generated.</p>
<p>So lets go and create this file in the <code class="highlighter-rouge">_layouts</code> folder.</p>
<p><code class="highlighter-rouge">cat_index.html</code></p>
<figure class="highlight"><pre><code class="language-html" data-lang="html"> <span class="nt"><div</span> <span class="na">class=</span><span class="s">"category"</span><span class="nt">></span>
<span class="c"><!-- <a class="tag__back" href="/">&lt;-- back</a> --></span>
<span class="nt"><h1</span> <span class="na">class=</span><span class="s">"post-list-heading"</span><span class="nt">></span>{{ page.cat }}<span class="nt"></h1></span>
<span class="nt"><div></span>
{% if site.categories[page.cat] %}
<span class="nt"><ul</span> <span class="na">class=</span><span class="s">"post-list"</span><span class="nt">></span>
{% for post in site.categories[page.cat] %}
<span class="nt"><li></span>
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y"
-%}
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"post-meta"</span><span class="nt">></span>{{ post.date | date: date_format }}<span class="nt"></span></span>
<span class="nt"><h3></span>
<span class="nt"><a</span> <span class="na">class=</span><span class="s">"post-link"</span> <span class="na">href=</span><span class="s">"{{ post.url | relative_url }}"</span><span class="nt">></span>
{{ post.title | escape }}
<span class="nt"></a></span>
<span class="nt"></h3></span>
{%- if site.show_excerpts -%}
{{ post.excerpt }}
<span class="nt"><a</span> <span class="na">class=</span><span class="s">"excerpt-post-link"</span> <span class="na">href=</span><span class="s">"{{ post.url | relative_url }}"</span><span class="nt">></span>
Continue reading →
<span class="nt"></a></span>
{%- endif -%}
<span class="nt"></li></span>
{% endfor %}
<span class="nt"></ul></span>
{% else %}
<span class="nt"><p></span>There is no posts for this category.<span class="nt"></p></span>
{% endif %}
<span class="nt"></div></span>
<span class="nt"></div></span></code></pre></figure>
<p>If we now manually retrigger a build process we should have a structured folder called categories with all sub-categories and their belonging index.html files.</p>
<p>Besides of that i wanted to have a Category and Tags link in the Navigation bar aswell which links to this folder.
For this we simply just create a file called <code class="highlighter-rouge">categories.md</code> in the root of our project with the following source.</p>
<figure class="highlight"><pre><code class="language-html" data-lang="html">---
layout: page
title: Categories
permalink: /categories/
---
{% assign categories = site.categories | sort %}
{% for category in categories %}
<span class="nt"><li</span> <span class="na">class=</span><span class="s">"post-list"</span> <span class="na">style=</span><span class="s">"font-size: {{ category | last | size | times: 400 | divided_by: categories.size }}%"</span><span class="nt">></span>
<span class="nt"><a</span> <span class="na">href=</span><span class="s">"/categories/{{ category | first | slugize }}/"</span><span class="nt">></span>
{{ category | first }} ({{ category | last | size }})
<span class="nt"></a></span>
<span class="nt"></li></span>
{% endfor %}</code></pre></figure>
<p>To get the tags working you can simply reuse all of the above and make sure that you exchange the site.categories variable with site.tags or simply copy and paste the code from my <a href="https://github.com/kseyhan/kseyhan.github.io">github source</a> of truth.</p>
<p>If done right there should be a category_overview page now looking something like this:</p>
<p><img src="/assets/img/posts/2019-06-11/categories_overview.png" alt="screenshot categories overview" width="300px" /></p>
<p>Now the only thing missing is that we show those categories and tags under each post aswell so the user can click on them and browse along.</p>
<p>So lets go..</p>
<p>We copy the <code class="highlighter-rouge">post.html</code> from the minima source into our <code class="highlighter-rouge">_layouts</code> folder.</p>
<p>and we paste folling code to the end of that page</p>
<figure class="highlight"><pre><code class="language-html" data-lang="html"> <span class="nt"><a</span> <span class="na">class=</span><span class="s">"u-url"</span> <span class="na">href=</span><span class="s">"{{ page.url | relative_url }}"</span> <span class="na">hidden</span><span class="nt">></a></span>
{% if page.categories %}
<span class="nt"><span></span> Posted in: <span class="nt"></span></span>
{% for category in page.categories %}
<span class="nt"><span></span>
<span class="nt"><a</span> <span class="na">href=</span><span class="s">"/categories/{{ category }}"</span><span class="nt">></span>{{ category }}<span class="nt"></a</span>
<span class="nt">></span>{% if forloop.last==false %}, {% endif %}
<span class="nt"></span></span>
{% endfor %} {% endif %}
<span class="nt"><br</span> <span class="nt">/></span>
{% if page.tags %}
<span class="nt"><span></span> Tagged: <span class="nt"></span></span>
{% for tag in page.tags %}
<span class="nt"><span></span>
<span class="nt"><a</span> <span class="na">href=</span><span class="s">"/tags/{{ tag }}"</span><span class="nt">></span>{{ tag }}<span class="nt"></a</span>
<span class="nt">></span>{% if forloop.last==false %}, {% endif %}
<span class="nt"></span></span>
{% endfor %} {% endif %}
<span class="nt"></article></span> </code></pre></figure>
<p>I hope you enjoyed the ride.</p>Kerem SeyhanToday i’m going to show you how ive setup this blog. I decided to go with the default theme Minima that you get when creating a new Jekyll site and customize it to my needs.Introduction2019-06-10T00:00:00+02:002019-06-10T00:00:00+02:00https://blog.codecut.de/2019/06/10/Hello-There<p>Hello there,
i finally decided to become a little bit more public by using a blog to document the various things i’m working at.</p>
<p>In the future youre hopefully going to find a lot of different tutorials, maybe a couple of rants and other things about various technologies over here.</p>
<p>I hope you enjoy the blog. Incase there are any questions or feedback feel free to use the email you find on the imprint of this blog.</p>
<p>dears,</p>
<p>Kerem</p>Kerem SeyhanHello there, i finally decided to become a little bit more public by using a blog to document the various things i’m working at.