Saturday, February 15, 2020

Linux Diff Tools for Python and how to use them with Git

The differencer in git gui / gitk is usually good enough for me, but occasionally
a commit diff can be really confusing, in which case

git difftool 

will start up a graphical differ.

Note that the syntax for looking at the last commit, which is often what you want not least because git gui won't show that, is:

git difftool HEAD~1

(Here's a nice explanation of what the ~ and ^ mean http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde)

With python xxdiff can get confused by indentation changes. If this happens go to Options and tell it to ignore whitespace.

That makes the comparison work better, (although at that point it won't highlight the whitespace changes, but you can still see them).


-----------------------

Other diff tools

For me the graphical differ is always xxdiff, which I love, because it's fast and does the business.


That appears to be set in my git config, which I can look at with:
git config -l

the relevant line is:

merge.tool=xxdiff

Sometimes, a commit can be particularly confusing, at which point I feel the need to try out different diff tools.

This is a pointless but fun merry-go round, I always end up going back to xxdiff.

However, this is how to do it.

Install them all:

sudo apt install colordiff wdiff kompare meld kdiff3 xxdiff diffuse tkdiff

Try them out:


git difftool --extcmd=kdiff3 HEAD~1  #shows whitespace by default, isn't confused by it
git difftool --extcmd=xxdiff HEAD~1 
git difftool --extcmd=diffuse HEAD~1 #shows whitespace by default, isn't confused by it, syntax colouring! This would be the best one, except that the very syntax colouring makes it hard to see what's going on

git difftool --extcmd=meld HEAD~1 #really beautiful, has same whitespace problems as xxdiff, and solution is the same, but it's a persistent preference which I don't like (state!!)


git difftool --extcmd=colordiff HEAD~1 # same as git diff HEAD~1

git difftool --extcmd=tkdiff HEAD~1       #noisy display, hard to read

git difftool --extcmd=diff HEAD~1         # like git diff HEAD^, but no colours
git difftool --extcmd=wdiff HEAD~1       # no colours, can't work out what it's doing

Thursday, January 23, 2020

Is a Package Installed?

Is cryptsetup installed?

Most generally useful is:

apt search cryptsetup

Or to concentrate on cryptsetup exactly:

apt list cryptsetup

To get all the details of the package

apt show cryptsetup

There are various other ways in which we can interrogate both dpkg and apt


dpkg --status cryptsetup

apt-cache policy cryptsetup

apt-cache search cryptsetup

Which Package Provides a File?

Which package will give me a java compiler?

apt search java


gives endless output

apt-file search "javac"

falls over in various ways:



Fail Better:

sudo apt update ; sudo apt install apt-file; sudo apt update

apt-file search "javac "

Sunday, January 19, 2020

To Manually Install get_iplayer on Debian (version 9.9)

Instructions found here:

https://github.com/get-iplayer/get_iplayer




But all I needed to do was:

sudo apt-get install libwww-perl liblwp-protocol-https-perl libmojolicious-perl libxml-libxml-perl libcgi-pm-perl atomicparsley ffmpeg

wget https://raw.githubusercontent.com/get-iplayer/get_iplayer/master/get_iplayer

sudo install -m 755 ./get_iplayer /usr/local/bin






Test with:

get_iplayer --release-check

get_iplayer ".*"

To actually fetch something(s)

get_iplayer --get ".*Example.*"