git https://tech.feedyourhead.at/tags/git en Now is a good time to backup our github-repos https://tech.feedyourhead.at/content/now-is-a-good-time-to-backup-our-github-repos <span class="field field--name-title field--type-string field--label-hidden">Now is a good time to backup our github-repos</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Many people are scared because <a href="https://news.microsoft.com/2018/06/04/microsoft-to-acquire-github-for-7-5-billion/">Microsoft bought GitHub</a>. I wonder why people are so shocked now. Github is just another cloud-thingy and cloud means: "it's just the computer of someone else". If "someone else" will shutdown or wipe his computer, then we better have backups. Having this in our minds I would say that it's time to make (auto)backups. I wrote this little ruby-script that clones all public repositories of a user into a directory. If the repositories already exist locally, then this script will just make a "git-pull".</p> <div class="geshifilter"><pre class="ruby geshifilter-ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby</span> &nbsp; <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'net/http'</span> <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'json'</span> <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'fileutils'</span> &nbsp; directory = <span style="color:#996600;">&quot;./&quot;</span> &nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> help warn <span style="color:#996600;">&quot;usage: #{$PROGRAM_NAME} &lt;github-user&gt; [ &lt;dst-directory&gt; ]&quot;</span> <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">1</span> <span style="color:#9966CC; font-weight:bold;">end</span> &nbsp; <span style="color:#008000; font-style:italic;"># got this function from stackoverflow.com: </span> <span style="color:#008000; font-style:italic;"># stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby</span> <span style="color:#9966CC; font-weight:bold;">def</span> which<span style="color:#006600; font-weight:bold;">&#40;</span>cmd<span style="color:#006600; font-weight:bold;">&#41;</span> exts = ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PATHEXT'</span><span style="color:#006600; font-weight:bold;">&#93;</span> ? ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PATHEXT'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">';'</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#93;</span> ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PATH'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>::PATH_SEPARATOR<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>path<span style="color:#006600; font-weight:bold;">|</span> exts.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>ext<span style="color:#006600; font-weight:bold;">|</span> exe = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span>path, <span style="color:#996600;">&quot;#{cmd}#{ext}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF; font-weight:bold;">return</span> exe <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">executable</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>exe<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> !<span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">directory</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>exe<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">nil</span> <span style="color:#9966CC; font-weight:bold;">end</span> &nbsp; gitbin = which<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;git&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> gitbin.<span style="color:#0000FF; font-weight:bold;">nil</span>? warn <span style="color:#996600;">&quot;git-binary not found&quot;</span> <span style="color:#CC0066; font-weight:bold;">exit</span> <span style="color:#006666;">1</span> <span style="color:#9966CC; font-weight:bold;">end</span> &nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> ARGV.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#006666;">1</span> <span style="color:#006600; font-weight:bold;">||</span> ARGV.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">2</span> help <span style="color:#9966CC; font-weight:bold;">end</span> &nbsp; gituser = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> directory = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#9966CC; font-weight:bold;">if</span> ARGV.<span style="color:#9900CC;">length</span> == <span style="color:#006666;">2</span> &nbsp; <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">directory</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>directory<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#CC00FF; font-weight:bold;">FileUtils</span>::mkdir_p directory <span style="color:#9966CC; font-weight:bold;">end</span> &nbsp; uri = <span style="color:#CC00FF; font-weight:bold;">URI</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;https://api.github.com/users/#{gituser}/repos&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp; resp = <span style="color:#6666ff; font-weight:bold;">Net::HTTP</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>uri<span style="color:#006600; font-weight:bold;">&#41;</span> parsed = JSON.<span style="color:#9900CC;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span>resp<span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp; parsed.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span><span style="color:#CC0066; font-weight:bold;">p</span><span style="color:#006600; font-weight:bold;">|</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">directory</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{directory}/#{p['name']}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#CC0066; font-weight:bold;">system</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;cd #{directory}/#{p['name']} &amp;&amp; #{gitbin} pull&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">else</span> <span style="color:#CC0066; font-weight:bold;">system</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{gitbin} clone https://github.com/#{p['full_name']} #{directory}/#{p['name']}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#9966CC; font-weight:bold;">end</span></pre></div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Jun 07 2018</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/ruby" hreflang="en">Ruby</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/taxonomy/term/103" hreflang="en">Open-Source</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/backup" hreflang="en">Backup</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/tricks" hreflang="en">Tricks</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/shell" hreflang="en">Shell</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/sysadmin" hreflang="en">Sysadmin</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=267&amp;2=comment&amp;3=comment" token="oPcbvqzYUcugBxbk0j0w2JLHdMWOfeGFn5WU98XCfbI"></drupal-render-placeholder> </section> Thu, 07 Jun 2018 10:41:24 +0000 Hoti 267 at https://tech.feedyourhead.at Writing a scientific work in a cool way https://tech.feedyourhead.at/content/Writing-a-scientific-work-in-a-cool-way <span class="field field--name-title field--type-string field--label-hidden">Writing a scientific work in a cool way</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>I am not good at writing. So writing a scientific work is a bit challenging for me. That's why I pimped up the task by choosing the right tools and made it more exciting for me.</p> <p>First of all, I decided to use <a href="http://www.latex-project.org/">Latex.</a> I always wanted to learn how to write documents in Latex and it's fun. It's a little bit like programming a document. I found the right Latex-Template where I am studying, so I don't have to mess around with all the details like font-size and so on. After compiling it, I had a fantastic and well formatted PDF.</p> <p>Next I built the document but I ran into a problem: Sometimes I had to compile the document more than once to have a complete one. I googled and found <a href="https://launchpad.net/rubber">rubber</a>. A handy tool to build Latex-Documents.</p> <p>I am a programmer. So of course I used a simple <a href="https://www.gnu.org/software/make/manual/make.html">Makefile</a> to compile and clean.</p> <p>I used <a href="http://www.jabref.org/">JabRef</a> to organize all my references. It saves the references in BibTeX-format which is the standard LaTeX bibliography format.</p> <p>Finally I realized that with Latex I don't have any compressed xml-file(like in LibreOffice) but simple text-files. So I can easily keep track of my versions using <a href="https://git-scm.com/">git</a>. I pushed the Repository on my server and was able to work alternating on my laptop or on my workstation. When I finished my work, I gave access to my friends who reviewed it.</p> <p> </p></div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Feb 10 2017</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/tricks" hreflang="en">Tricks</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=229&amp;2=comment&amp;3=comment" token="C43p92Bt5m7CFdMRvCsvPItqH_YfOA1mJFMfueZna3U"></drupal-render-placeholder> </section> Fri, 10 Feb 2017 21:20:56 +0000 Hoti 229 at https://tech.feedyourhead.at Testing ansible-roles automatically on every git-push https://tech.feedyourhead.at/content/testing-ansible-roles-automatically-on-every-git-push <span class="field field--name-title field--type-string field--label-hidden">Testing ansible-roles automatically on every git-push</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><img alt="ansible" data-entity-type="file" data-entity-uuid="42485588-89f9-4e0e-bf7b-0cae9a7b373c" src="/sites/default/files/inline-images/ansible.png" /></p> <p><a href="https://www.ansible.com/">Ansible</a> is a powerful configuration management tool. For developing and distributing ansible-roles we use <a href="https://about.gitlab.com/">Gitlab</a> at <a href="http://www.toscom.at">Toscom</a>. In this article I'll describe how to automatically test ansible-roles for different Linux-Distributions in <a href="https://www.docker.com/">Docker-Container</a> using Gitlab-Runner whenever someone pushes changes into our Gitlab-Repository.</p> <h3>Creating a Ansible-Debian-Docker-Image</h3> <p>First I created the following Dockerfile:</p> <pre> <code> # This Dockerfile was tested with debian jessie # # Build with: docker build -t ansible/debian_jessie . # FROM debian MAINTAINER hoti ENV DEBIAN_FRONTEND noninteractive RUN echo "deb http://ftp.debian.org/debian jessie-backports main" &gt; /etc/apt/sources.list.d/backports.list RUN apt-get update &amp;&amp; apt-get upgrade -y RUN apt-get install -y build-essential git python python-dev libffi-dev libssl-dev python-pip libyaml-dev libgmp-dev libgmp10 libyaml-0-2 apt-utils RUN apt-get install -y -t jessie-backports python-pyasn1 python-setuptools RUN git clone https://github.com/ansible/ansible.git /usr/local/src/ansible RUN cd /usr/local/src/ansible &amp;&amp; git checkout v2.1.2.0-1 &amp;&amp; git submodule update --init --recursive &amp;&amp; make &amp;&amp; make install USER root WORKDIR /var/tmp </code></pre> <p>This Dockerfile is easily built by calling the follwing command</p> <pre> <code> docker build -tansible/debian_jessie . </code></pre> <h3>Configuring the Gitlab-Repository</h3> <p>It's very important to install the Gitlab-Runner and Docker on the same host. The Gitlab-Runner can easily installed using <a href="https://docs.gitlab.com/runner/install/linux-repository.html">this instructions</a>.</p> <p>Now we can create the gitlab-runer-control-file(.gitlab-ci.yml) in our Gitlab-Repository of our ansible-role(let's call it "fancy-ansible-role"):</p> <pre> <code> debian:jessie: image: ansible/debian_jessie before_script: - mkdir -p roles/fancy-ansible-role - rsync -ar --exclude=.git --exclude=roles . roles/fancy-ansible-role script: - ansible-playbook .playbook.yml </code></pre> <p>And for our tests we create in our fancy-ansible-role-repository a file called .playbook.yml:</p> <pre> <code> - hosts: localhost roles: - fancy-ansible-role </code></pre> <p>To complete our ansible-role I'll create a simple task and add it to the fancy-ansible-role. This simple code I'll place at tasks/main.yml:</p> <pre> <code> --- - name: Fancy Ansible Role Debug debug: msg="HELLO WORLD" </code></pre> <p>This role simply prints out "HELLO WORLD".</p> <h3>Our Result</h3> <p>Finally we can push any changes in our repository and we can monitor the output of our tests in Gitlab:</p> <p><img alt="Ansible-Build" data-entity-type="file" data-entity-uuid="42c2718c-43fe-497b-9509-e31cf2a399de" height="545" src="/sites/default/files/inline-images/2016-12-07-19%3A09%3A17.jpg" width="1169" /></p> <h3>Conclusio</h3> <p>In this article I just created a playbook for one Linux-Distribution but it could be easily extended to perform those tests on multiple Distributions. This clearly shows that <a href="https://en.wikipedia.org/wiki/Continuous_integration">Continous Integration</a>-Tools can be very handy for Systemadministrators too.</p> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Dec 07 2016</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/ansible" hreflang="en">Ansible</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/tricks" hreflang="en">Tricks</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/sysadmin" hreflang="en">Sysadmin</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Programming" hreflang="en">Programming</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=217&amp;2=comment&amp;3=comment" token="a6k5_ZBG2Xoz36bsGQAsCBwAp8QVdd8-9G5xejvhl4c"></drupal-render-placeholder> </section> Wed, 07 Dec 2016 17:41:04 +0000 Hoti 217 at https://tech.feedyourhead.at Suricata Ruby-Gem https://tech.feedyourhead.at/content/suricata-ruby-gem <span class="field field--name-title field--type-string field--label-hidden">Suricata Ruby-Gem</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>I wrote a <a href="https://github.com/whotwagner/suricata">Ruby-Gem</a> for suricata. It offers classes to parse suricata-logs and ships with a nagios-plugin</p> <h2>Installation</h2> <p>Just call:</p> <pre> <code> gem install suricata </code></pre> <h2>Usage</h2> <p>The nagios-plugin searches for specific strings in the description-part of a logfile-entry. It's possible to create a whitelist of search hits which should be excluded.</p> <pre> <code> Usage: check_suricata [ -a alertfile ] [ -w whitelistfile ] -e searchstring -h, --help This help screen -a, --alertfile ALERTFILE alertfile(default: /var/log/suricata/fast.log) -w, --whitelist WHITELISTFILE whitelistfile -e, --search STRING searchstring -i, --interactive interactive -k, --ackfile ACKFILE ackfile(default: /tmp/surack.lst) </code></pre> <p>It is possible to interactively acknowlege search hits so that they will not occur on the next search:</p> <pre> <code> check_suricata -i -e "ET CHAT" Acknowlege the following entry: 10/04/2016-13:39:45.498785 [**] [1:2001595:10] ET CHAT Skype VOIP Checking Version (Startup) [**] [Classification: Potential Corporate Privacy Violation] [Priority: 1] {TCP} 192.168.0.1:40460 -&gt; 15.14.13.12:80 Acknowlege(y|n): y Acknowlege the following entry: 10/05/2016-09:25:01.186862 [**] [1:2001595:10] ET CHAT Skype VOIP Checking Version (Startup) [**] [Classification: Potential Corporate Privacy Violation] [Priority: 1] {TCP} 192.168.0.1:49491 -&gt; 100.254.198.10:80 Acknowlege(y|n): n </code></pre> <h2>Download the Sources</h2> <p>The sources can be found on my <a href="https://github.com/whotwagner/">github-account</a> and can be downloaded using git:</p> <pre> <code> git clone https://github.com/whotwagner/suricata </code></pre> <h2>Future Work</h2> <p>I currently work on a logfile-analyzer for Suricata. It will be included in the furure versions of this gem.</p> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Oct 11 2016</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Programming" hreflang="en">Programming</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/downloads" hreflang="en">Downloads</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/ruby" hreflang="en">Ruby</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/taxonomy/term/97" hreflang="en">Toscom</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=209&amp;2=comment&amp;3=comment" token="OxMQl9MNyO5Ozx66YFYnJzt2HiZEoOsLthrf6eJoXdE"></drupal-render-placeholder> </section> Tue, 11 Oct 2016 14:09:28 +0000 Hoti 209 at https://tech.feedyourhead.at Git: Comparing a local branch with a remote branch https://tech.feedyourhead.at/node/179 <span class="field field--name-title field--type-string field--label-hidden">Git: Comparing a local branch with a remote branch</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Sometimes we want to review the differences between the remote repository and the local one.</p> <h2>Fetch</h2> <p>First we have to fetch the code:</p> <pre> <code> git fetch </code></pre> <h2>Show diff</h2> <p>Using diff it is possible to compare the local master with the remote master(origin):</p> <pre> <code> git diff </code></pre> <h2>Merge</h2> <p>Finally we can merge the changes</p> <pre> <code> git merge </code></pre> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">May 04 2016</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=179&amp;2=comment&amp;3=comment" token="E-aELUgNrv44tHVGOLERv7XUsGLhTEzr6UFQJASIXyQ"></drupal-render-placeholder> </section> Wed, 04 May 2016 11:20:12 +0000 Hoti 179 at https://tech.feedyourhead.at Git: Using Git for building the Linux-Kernel from sources https://tech.feedyourhead.at/node/148 <span class="field field--name-title field--type-string field--label-hidden">Git: Using Git for building the Linux-Kernel from sources</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><a href="http://git-scm.com/">Git</a> was invented by Linus Thorvalds for managing the <a href="kernel.org">Linux-kernel-sources</a>. So it's pretty clear that it is the best tool for managing our own kernel-builds too. I love to use Docker. That's why I also need the <a href="http://aufs.sourceforge.net/">AUFS-Support</a> which is not included in the Linux-Tree. Git can also help us to easily include external kernel-patches. In this article I will clone the linux tree and create an own branch with my prefered kernel-version(and my customized kernel-config). I will pull the AUFS-Patches directly into this branch and compile this kernel afterwards.</p> <p>&nbsp;</p> <h3>Cloning the Linux-Kernel:</h3> <pre> <code>git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git</code></pre> <h3>List all Tags:</h3> <pre> <code>git tag ... ... v4.3 v4.3-rc1 v4.3-rc2 v4.3-rc3 v4.3-rc4 v4.3-rc5 v4.3-rc6 v4.3-rc7 v4.4 v4.4-rc1 v4.4-rc2 v4.4-rc3 v4.4-rc4 v4.4-rc5 v4.4-rc6 v4.4-rc7 v4.4-rc8 </code></pre> <h3>Add AUFS-Remote:</h3> <pre> <code>git remote add aufs4 git://github.com/sfjro/aufs4-linux.git</code></pre> <h3>Fetch AUFS:</h3> <pre> <code>git fetch aufs4</code></pre> <h3>Create a new branch with kernel v4.4:</h3> <pre> <code>git checkout -b own4.4 v4.4</code></pre> <h3>Pull AUFS into our new branch:</h3> <pre> <code> git pull aufs4 aufs4.4 </code></pre> <h3>Configure the kernel:</h3> <pre> <code> make menuconfig </code></pre> <h3>Compile the kernel(using 8 cpu-cores) and create a Debian-package</h3> <pre> <code> make-kpkg -j 8 --initrd kernel_image modules modules_image kernel_headers </code></pre> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Jan 19 2016</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/sysadmin" hreflang="en">Sysadmin</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/kernel" hreflang="en">Kernel</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=148&amp;2=comment&amp;3=comment" token="vmyEvyDHkO205FAqZmhHSW9Hd66MZmekRfQSoDC8gk0"></drupal-render-placeholder> </section> Tue, 19 Jan 2016 07:48:22 +0000 Hoti 148 at https://tech.feedyourhead.at Git - Best Practices https://tech.feedyourhead.at/content/git-best-practices <span class="field field--name-title field--type-string field--label-hidden">Git - Best Practices </span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><img alt="" src="/sites/tech.feedyourhead.at/files/pictures/Git-logo.svg.png" style="width: 512px; height: 214px;" /></p> <p>I found very profound <a href="http://sethrobertson.github.io/GitBestPractices/">best practices</a> for git on github. Well done!</p> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Nov 05 2015</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/external" hreflang="en">External</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=128&amp;2=comment&amp;3=comment" token="5zdu7cGWMMYUU3E0FV9j4O_EFkQCyRm19H3kHVkTH2w"></drupal-render-placeholder> </section> Thu, 05 Nov 2015 21:55:42 +0000 Hoti 128 at https://tech.feedyourhead.at git: keeping track of configurations with etckeeper https://tech.feedyourhead.at/content/git-keeping-track-configurations-etckeeper <span class="field field--name-title field--type-string field--label-hidden">git: keeping track of configurations with etckeeper</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><img alt="" src="http://tech.feedyourhead.at/sites/tech.feedyourhead.at/files/pictures/Git-logo.svg.png" /></p> <p>&nbsp;</p> <p>We all know it:&nbsp; days after "someone" did changes on a system, somebody finds out that anything doesn't work properly.&nbsp; And then we have to figure out who has made those changes. "was it me? was it my colleague? was it one of the developers?" and so on... Keeping track of all the changes in the configurations-files would be very nice. We could see the differences of the configurations and we could just rollback to an old state. Beside this we also&nbsp;have more opportunities to find out who has made those changes. <strong>V</strong>ersion<strong>C</strong>ontrol<strong>S</strong>ystems is what we need in those cases and <a href="https://github.com/joeyh/etckeeper">etckeeper</a> is a very nice wrapper for well known versioncontrolsystems.</p> <h4>Common VCS can handle this alone. why do we need etckeeper?</h4> <ol> <li>Etckeeper simplifies the tasks(installation, commits, etc..)</li> <li>Most VCS don't care much about file-permissions. Etckeeper does.</li> <li>It's very simple to roll out etckeeper on many machines(puppet,ansible, etc..)</li> <li>It uses git defaultly, but it supports many different VCS</li> <li>Nobody needs special know how about the VCS for making commits.</li> </ol> <h4>How to install etckeeper?</h4> <p>On debian-systems:</p> <pre> <code> dr@tardis: apt-get install etckeeper </code></pre> <p>The debian-package automatically calls "etckeeper init" after the installation and initialises in that way our (git)repository. It also creates a "/etc/.gitignore" for some files. A very important file is /etc/.etckeeper which keeps track of the filepermissions!</p> <h4>How to use it?</h4> <p>Once it is installed, it commits automagically all the changes once a day(cron.daily). So it works out of the box. If we want to commit any changes manually we can use the following command:</p> <pre> <code> dr@tardis: etckeeper commit </code></pre> <p>Of course we have the full power of git and we can use all our well known git commands. I will not explain them here because they have a really good documentation on their website http://git-scm.com/.</p> <h4>Reminding all admins to comment and commit</h4> <p>I would like to make commits at least every time whenever an administrator is logging out, because in that way every admin can supply some comments and his initials. So I add the following oneliner in my /root/.bash_logout:</p> <pre> <code> etckeeper commit </code></pre> <h4>Something very important from the README-File</h4> <p>One thing i really wanna quote from the <a href="https://github.com/joeyh/etckeeper">README-File</a>:</p> <blockquote> <p>You can use any git commands you like, but do keep in mind that, if you check out a different branch or an old version, git is operating directly on your system's /etc. If you do decide to check out a branch or tag, make sure you run "etckeeper init" again, to get any metadata changes:</p> git checkout april_first_joke_etc etckeeper init</blockquote> <h4>Conclusion</h4> <p>For me etckeeper is a nice little tool. It's a great extension to our well known versioncontrolsystems. We can track changes, open testing-branches or just have an eye on differences between some changes. And it simplifies our daily tasks.</p> <h4>Sources:</h4> <ul> <li><a href="https://github.com/joeyh/etckeeper">https://github.com/joeyh/etckeeper</a></li> </ul> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Sep 23 2015</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/sysadmin" hreflang="en">Sysadmin</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/tricks" hreflang="en">Tricks</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=110&amp;2=comment&amp;3=comment" token="WllTRRhus_Ol7kog9Kee0uUBh9Vha7Wk411BMVryhsc"></drupal-render-placeholder> </section> Wed, 23 Sep 2015 06:50:58 +0000 Hoti 110 at https://tech.feedyourhead.at Bup: A git-based backup-system https://tech.feedyourhead.at/content/bup-git-based-backup-system <span class="field field--name-title field--type-string field--label-hidden">Bup: A git-based backup-system</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"></div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Jun 30 2015</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/backup" hreflang="en">Backup</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/sysadmin" hreflang="en">Sysadmin</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=96&amp;2=comment&amp;3=comment" token="hqAObdmz1JIx2F4qvSI2mMi09fjYe_8U6ypp8EdTQ-A"></drupal-render-placeholder> </section> Tue, 30 Jun 2015 17:28:32 +0000 Hoti 96 at https://tech.feedyourhead.at Git: A Git-Game, for learning and fun https://tech.feedyourhead.at/content/git-git-game-learning-and-fun <span class="field field--name-title field--type-string field--label-hidden">Git: A Git-Game, for learning and fun</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><a href="http://git-scm.com"><img alt="" src="http://git-scm.com/images/logo@2x.png" /></a></p> <p>There is a nice git-game on github: <a href="https://github.com/hgarc014/git-game">https://github.com/hgarc014/git-game</a></p> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Mar 14 2015</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/git" hreflang="en">git</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=63&amp;2=comment&amp;3=comment" token="I8U0H3dHC1kAnHhPauCiHJzjYWgMb3J-1wmN1K6PEZM"></drupal-render-placeholder> </section> Sat, 14 Mar 2015 00:05:22 +0000 Hoti 63 at https://tech.feedyourhead.at