Cherry pick files from a commit in a repository

In git there is the command git cherry-pick that allows to “apply the changes introduced by some existing commits”. This is nice if you want to reorder entire commits or things like that.

I often have the use case that I want to see individual files side-by-side to compare them or overwrite files with a previous version, your might have more precise use cases in mind. At the beginning I thought git cherry-pick is the command I was looking for but I sound found out, it is not. So I went back, often to the GitHub web interface and just browsed the history and then the file tree to view the file at a certain state.

But since git has a very nice object storage I found out, that I can get any object with git show ${object_id} resp. git show --format=raw ${object_id}. An object can be a commit, a tree (directory), or a blob (file). So I needed to get the object id of the blob that I want to see. This can be done with git ls-tree command resp. to just get the specific id of the file I’m looking for: git ls-tree --object-only -r ${commit} ${file}.

All to gather I have put this into these lines, which you can find at https://github.com/white-gecko/git-cherry-file:

#!/bin/sh
## Done by Natanael 2023-01-31
# see also: https://stackoverflow.com/a/42623347/414075
commit=$1
file=$2
target_file=${3:-${file}.cherry}
echo "Pick ${file} from commit ${commit}"
file_id=$( git ls-tree --object-only -r ${commit} ${file} )
echo "It has the object id ${file_id}"
git show --format=raw ${file_id} > ${target_file}
echo "Written to ${target_file}"

Just make it executable and put it into your path, e.g. ~/.local/bin/git-cherry-file and call it with:

$ git-cherry-file HEAD~2 README.md

It will create a new file README.md.cherry. If you want to specify the target path you can add it as an additional argument, e.g. to overwrite the current file:

$ git-cherry-file HEAD~2 README.md README.md

I hope you like it.

(read on …)

Animate the History of your Git Repository

I was looking for a way to get an impression of the temporal development of my git repository. So I chose to check for ways to animate the history of a git repository.

I found some DIY approach that should provide very nice results, but it requires some more effort. Basically you iterate through all of your commits, execute a command to visualize this commit, what ever that means to you, and then merge all of these visualizations as frames together as a movie file. The exect steps are here: http://eptcomic.com/ept1movie.htm.

Another tool is Gource (https://gource.io/). It renders your repository in a 3D animation, that looks quite fancy. A good startingpoint is:

$ apt install gource
$ gource -c 4.0 -s 1 -a 1 .

The major difference between the two tools and their results is, that with the first on you can visualize the content of the repository as it evolves, while the Gource mainly visualizes the file structure and the collaboration process on it.

(This post was originally started on 2020-10-18)

(read on …)

Backup done right … and what about config?

From time to time it is important to create a backup of your data. There are some tools that help one to copy files in some sophisticated ways onto a different medium. I chose restic for this job.

But this only works well for the data you are working on, we call it user data, but not for your configuration. Some backup articles suggest to just backup the complete users home directory which stores the user configuration, but this will not include the system configuration. On top of this for me a backup is not a raw copy of the current system I’m working on, but just the actually relevant data and configuration. This can also come along with an additional use case for a backup, that I want to use it to setup a clean new system where I only want to take over the data that I actually need.

So far I have not found any system, that covers the aspects mentioned, which leads me to the point that I’ve started to write down a concept for a configuration backup system. You are welcome to send any hints and suggestions.

(read on …)

Dissertation: “Distributed Collaboration on Versioned Decentralized RDF Knowledge Bases”

If you are looking for a good read for the holiday season or even a geeky present check this out. My dissertation “Distributed Collaboration on Versioned Decentralized RDF Knowledge Bases” is now published at the Open Access University Press Leipzig (Open-Access-Hochschulverlag Leipzig) which is situated at the Leipzig University of Applied Sciences (HTWK Leipzig). It is available online as Open Access (DOI 10.33968/9783966270205-00) and at your favorite book shop (isbn: 978-3-96627-019-9).

(read on …)
@white_gecko
2020-10-14 16.05

If you are doing #SoftwareDevelopment resp. #SoftwareEngineering an looking for a #LaTeX/#TikZ version of a simple agile development #cycle check out my page ;-) https://natanael.arndt.xyz/notes/agile #SCRUM #agile

@white_gecko
2019-11-19 11.52

If you want to read my papers but you are to lazy to download them and open them with your favorite PDF reader you now get the service to read them all directly on my web page. Some as #HTML some as embedded #PDF. https://natanael.arndt.xyz/publications #OpenResearch #OpenAccess

@white_gecko
2019-08-06 15.03

If you are working on #SemanticWeb an looking for a #LaTeX/#TikZ version of the #LayerCake and the #LODCycle check out my page ;-) https://natanael.arndt.xyz/notes/semantic-web-layer-cake and https://natanael.arndt.xyz/notes/lod-cycle #LOD

@white_gecko
2018-11-27 17.26

Just released #JekyllRDF 3.1.0! The cool new feature is that you can now build pages from a #SPARQL endpoint. Checkout the CHANGELOG and README for details. We hope you like it. https://rubygems.org/gems/jekyll-rdf https://github.com/white-gecko/jekyll-rdf @akswgroup (https://mobile.twitter.com/white_gecko/status/1067452594954661889)

@white_gecko
2018-10-20 17.26

Now you can find my paper “A Method for Distributed and Collaborative Curation of RDF Datasets Utilizing the Quit Stack” 10.18420/in2017_187 with the full text published as HTML and #OpenAccess #OpenResearch on my #JekyllRDF blog https://natanael.arndt.xyz/bib/arndt-n-2017–quitstack

My Bibliography with Jekyll RDF

From now on the list of my publications is rendered using Jekyll-RDF. I’ve used the bibtex2rdf script together with a customized mapping to convert my bibtex file to RDF. This file is consumed by JekyllRDF and rendered together with the rest of my blog using the publications template for the lost of all publications and an additional template to render a page for each individual publication resource.

(read on …)

Jekyll RDF Tutorial Screencast

Today I’ve released my #jekyllrdf Tutorial Screencast on Vimeo. It teaches you all the basics necessary to create a simple Jekyll page from an RDF knowledgebase. I hope that you enjoy it and that it is helpful for you!

(read on …)

Generate a QR Code to Recover Your OTP Secret

Bitcoin.de as some other pages is using a One-Time-Pad (OTP) as two-factor authentication method, actually it is a Time-based One-Time Password algorithm (TOTP). The Passwords are generated based on a shared secret as specified in RFC6238. When activating the two-factor authentication on bitcoin.de the page shows a QR code which is used by OTP apps, such as andOTP (github), Google Authenticator, or OTP Authenticator (github), to transfer the shared secret to the phone. Additionally the page shows the shared secret as a string of letters and numbers, which one should write down and deposit in a safe place.

But what happens, if due to some circumstances you have to bring this shared secret back into the app?

(read on …)
@white_gecko
2018-01-02 13.03

Ein neues Rezept ist online: Kartoffelsalat mit Räuchertofu.

@white_gecko
2017-11-04 17.44

Now I’m able to write status posts from my mobile using #FastHub-Libre :nerd:

JekyllRDF 2.3.0

Today we’ve released #jekyllrdf 2.3.0 at rubygems https://rubygems.org/gems/jekyll-rdf. The documentation & changelog can be found as always at GitHub: https://github.com/white-gecko/jekyll-rdf/. We are very happy about all contributors, from the past and the presence, but would also like to welcome you as a future contributor ;-) As of today this should be the last version of the 2.x branch, since we are already working hard on the next major release 3.0.0. If you are interested in what is coming next, have a look at the 3.0.0-milestone.

(read on …)

#DigitalisierungFirstBedenkenSecond

Als ich den Beitrag ZDF „volle kanne“: „Heimliche Videoüberwachung im Supermarkt“ Beitrag vom 21.09.2017 gesehen habe war eine meiner ersten Assoziationen das Wahlkampf-Motto der FDP im Bundestagswahlkampf: „Digitalisierung first Bedenken second“. Ich denk, dass vor der Installation oder Akzeptanz von dem was digital Möglich ist durchaus Bedenken hinsichtlich der gesellschaftlichen Auswirkungen angebracht sind: Müssen wir es tatsächlich in Kauf nehmen ungefragt dazu beizutragen unsere Freiheit einzuschränken? Wenn der Kunde zwar nicht im Einzelnen aber als Gesamtheit auf diese Art und Weise gläsern wird, wird ihm sein Stimme in der liberalen Marktwirtschaft genommen?

(read on …)
@white_gecko
2017-09-27 14.13

.@SoerenAuer from @TIBHannover is showing some old computing stuff, recipies, functions, and chinese pots at his keynote at #informatik2017

https://twitter.com/white_gecko/status/913043822178963456

@white_gecko
2017-09-27 09.45

Richard Stallman is speaking at the GI INFORMATIK 2017. In his talk he is using “Person” and the pronouns “per”, and “per’s” which work like “her” and “her’s” but for any gender. This post was purely created with free software (vim, git, jekyll) and is licensed under CC BY-ND.

@white_gecko
2017-09-12 15.15

Von Christen und Muslimen https://correctiv.org/echtjetzt/artikel/2017/09/12/muslime-christen-leipzig/ via @correctiv_org Ob Christen oder Muslime? Auch das ist nicht entscheidend …

https://twitter.com/white_gecko/status/907623764971704320

@white_gecko
2017-09-08 13.23

Bilanz vom heutigen Arbeitsweg @stadtradeln durch #Leipzig: 2× zugeparkter Radweg, 1× aufdringliches Auto in Fahrbahnverengung #BlankeNerven

https://twitter.com/white_gecko/status/906146014435954688

@white_gecko
2017-07-21 09.25

.@Poliauwei was macht man denn mit falsch geparkten Schildern auf dem #Fahrradweg auf der Prager Straße in @StadtLeipzig?

https://twitter.com/white_gecko/status/888325725811613696

@white_gecko
2017-07-20 09.04

Yesterday we’ve released #jekyllrdf 2.1.0 at #rubygems https://rubygems.org/gems/jekyll-rdf, #docu & #changelog: https://github.com/white-gecko/jekyll-rdf/ #ruby #jekyllrb

https://twitter.com/white_gecko/status/887961476970971136

@white_gecko
2017-07-20 08.47

From now on my blog also has a page for File Not Found Errors (aka. Error 404)

@white_gecko
2017-07-14 14.23

From now on pre-releases of #jeykllrdf are automatically deployed to #rubygems https://rubygems.org/gems/jekyll-rdf #ruby #jekyllrb (Waiting for 2.1.0 …)

https://twitter.com/white_gecko/status/885867427015405568

@white_gecko
2017-07-12 16.40

On my way through the Web today I realized the #NetNeutrality campaign. This is important! https://natanael.arndt.xyz/2017/07/12/Netzneutralität

https://twitter.com/white_gecko/status/885177047588323329

Netzneutralität

Gerade auf meinem Weg durch das Netz bin ich bei StackOverflow vorbeigeschlendert. Eigentlich war ich dienstlich unterwegs, dabei wurde ich durch einen schwarzen Balken ganz oben auf der Seite abgelenkt.

Join Stack Overflow in Standing Up for Net Neutrality
(read on …)
@white_gecko
2017-07-11 13.12

I could reduce the image size of DockerJekyllPages (DJP) 0.3.2 by 11.5% compared to the last release which already saved 12% #docker #jekyll

https://twitter.com/white_gecko/status/884762382844743680

@white_gecko
2017-07-10 10.12

I was tired of checking #docker inspect for a containers local IP https://hub.docker.com/r/mgood/resolvable/ makes container.docker available straight away

https://twitter.com/white_gecko/status/884354730981543936

@white_gecko
2017-07-07 13.00

RT: Gemeinsame Erklärung von Kardinal Marx und @landesbischof Bedford-Strohm zu #G20HH2017: https://www.ekd.de/ekd_de/ds_doc/170704_pm_108_Anlage_Erklaerung_zum_bevorstehenden_G20-Gipfel.pdf … #G20

https://twitter.com/EKD/status/883309633615548416

@white_gecko
2017-06-25 19.46

“Peter Schaar: Der Staat ist ein feiger Leviathan” @heise zum Thema #staatstrojaner durch die Hintertür http://www.heise.de/newsticker/meldung/Peter-Schaar-Der-Staat-ist-ein-feiger-Leviathan-3755246.html

https://twitter.com/white_gecko/status/879063349039955969

@white_gecko
2017-06-23 13.44

Today I’ve released version 0.3.0 of the DockerJekyllPages (DJP) image with support for private #git repos #docker #jekyll #githubpages

https://twitter.com/white_gecko/status/878247453845319681

Forward SSH-Authentication to a Docker Container

For my work on the dockerjekyllpages image (docker hub, GitHub) I came across the issue that I also want to be able to build from private git repositories and thus want to authenticate using a private SSH key. During my research on this topic I came across this stackoverflow post by Aistis which proposes forwarding the SSH authentication socket (or authorization, not sure about that) which allows the container to communicate with your hosts SSH authentication method. I think this is a very clean solution and thus I’ve implemented it as follows.

(read on …)
@white_gecko
2017-06-22 12.33

Some updates on the style regarding the status posts

@white_gecko
2017-06-21 15.50

What is the best way to load private SSH keys into a #docker container for cloning e.g. private #git repositories?

https://twitter.com/white_gecko/status/877554442605924352

@white_gecko
2017-06-21 15.43

I’ve just released my first version (0.2.0) of the DockerJekyllPages (DJP) image https://natanael.arndt.xyz/2017/06/21/DockerJekyllPages0.2.0 … #docker #jekyll #githubpages

https://twitter.com/white_gecko/status/877552688531218432

@white_gecko
2017-06-21 15.39

Now I could even fix the timezone issue by adding timezone: Europe/Berlin to _config.yml :-)

Docker Jekyll Pages Release 0.2.0

Since I’ve forked the dockerjekyllpages from DonMcNamara/dockerfiles just over a year ago to run my blog I’ve done some changes – improvements in my eyes. To make them usable for others I frequently built the image on the docker hub and now even tagged release 0.2.0 on GitHub as well as on the docker hub.

(read on …)
@white_gecko
2017-06-20 08.48

There is still some issue with the timezone …

@white_gecko
2017-06-20 08.39

From now on I can publish simple status messages as you know it from #twitter #pumpio or #gnusocial. Just not linked so far.

Sicherheitstest für meine Seite

D +

Bei meiner heutigen Presseschau bin ich auf die beiden golem und heise/ix Artikel zu einem neuen Sicherheitstest von Mozilla für Webseites gestoßen. Den Test erläutert die Entwicklerin April King ebenfalls in einem Eintrag in ihrem eigenen Blog. Über die Seite https://observatory.mozilla.org/ kann man mit wenig Aufwand die eigene Seite überprüfen.

(read on …)

Schwarz Weiß Fotos mit Gimp

Heute habe ich mal wieder ein biometrisches Passbild gebraucht. Dabei sind die Farben allerdings nicht besonders gut gelungen und ich finde eh Schwarz/Weiß-Bilder auf Pässen hübscher. Auf Grund dessen habe ich kurz nach Anleitungen zur Konvertierung von Farbbildern in Schwarz/Weiß-Bilder mit GIMP gesucht. Die simpelste Möglichkeit ist über das Menü „Bild“ > „Modus“ > „Graustufen“ das Bild in Graustufen umzuwandeln, das Ergebnis sieht aber nicht immer zufriedenstellend aus. Darüber hinaus gibt es verschiedene Möglichkeiten den Eindruck der Kontraste in Schwarz Weiß zu verstärken. Einen einfachen Überblick über die Möglichkeiten bietet das Tutorial „Converting Color Images to B&W“ und hat mir schnell zur Referenz geholfen. Das Tutorial „Digital B&W Conversion“ erklärt die einzelnen Effekte die bei der Konvertierung auftreten noch etwas genauer und ermöglichen ein tieferes Verständnis.

Eine weitere interessante Sache ist die „B/W Film Simulation“ GIMP Script-Fu Erweiterung von Serge Mankovski. Ein Danke gilt an der Stelle Pierre Vlček, welche in seinem Blogbeitrag „Digitale Schwarzweißfotografie mit GIMP“ die Erweiterung wieder ausgegraben hat. Eine Anleitung zu Installation von GIMP Script-Fu Erweiterungen gibt es in der GIMP Dokumentation.

(read on …)

Biometrische Passbilder Herstellen

Vor längerer Zeit habe ich mich damit beschäftigt, wie man selbst biometrische Passbilder erstellen kann, da ich keine Lust hatte für ein einziges Foto 10 € auszugeben. Meine Übungen konnte ich seit dem letzten Jahr auch mehrfach einsetzen, um Passbilder für Flüchtlinge zu machen, die sie an verschiedenen Stellen, z.B. bei einem bewilligten Asylantrag benötigen.

Die entsprechenden Regeln, die man beachten muss sind als „Passbild-Schablone für Personen ab einem Alter von 10 Jahren“ bei der Bundesdruckerei verfügbar. Außer einer vernünftigen Kamera und einem Bildbearbeitungsprogramm (ich verwende GIMP) ist so mit einem Fotodrucker und Fotopapier oder den Foto-Druckangeboten in einigen Drogerien die Herstellung eines biometrische Passbilds für unter einem Euro möglich.

Für meine eigene Dokumentation und, um anderen eine hoffentlich hilfreiche Anleitung zu geben, habe ich eine entsprechende Notiz angelegt: Biometrische Passbilder Herstellen

(read on …)

My New Webpage

Welcome to my new web page and blog. This time I’ve built the page using jekyll and using a custom theme, based on bootstrap, by taking some inspirations and HTML/CSS snippets from bootstrap’s blog and carousel examples. For the typography I’m using Open Sans and Lato and Font Awesome for the icons. The Publications section was implemented using Exhibit and taking my publications from bibsonomy.

The web page has four sections, this one is the “Blog”, where I’m publishing several things which pop into my head. The “Notes” section should be some kind of an open idea management system resp. personal Wiki. In the section “Project” I present some project, which I’m working on and finally my “Publications”.

The source code for my homepage is published on github. On the server side I’m making use of docker, especially a setup of jwilder’s reverse proxy and the dockerjekyllpages image by Don McNamara to rebuild the blog, triggered by pushes to my git repository. In addition to the jwilder container, I’m using the Let’s Encrypt companion by Yves Blusseau, to make the site available via HTTPS.

My webpage is bi-lingual, which means in this case, that I’m sometimes writing text in German and sometimes in English. I’m if you have problems understanding a text but think, it might be interesting, don’t hesitate to ask me for a translation (but I can’t guarantee anything). Currently this page has not too much content, but I’m planning to gradually integrate some interesting posts form my old blog and also build a live integration of my twitter stream.

(read on …)