Skip to content

Latest commit

 

History

History
92 lines (59 loc) · 2.75 KB

tools-and-tricks.md

File metadata and controls

92 lines (59 loc) · 2.75 KB

Git

Using meld as git difftool

Following the advice in Git Tip of the Day – viewing diffs graphically with meld

$ git config --global diff.tool meld
$ git config --global alias.dt 'difftool -d'

Meld is in Debian testing, so I just have to install it... and enable syntax highlighting, for more comfort (in Meld preferences).

Then, you can view differences easily:

$ git dt master..e84744de8949f20

Atom

Setting fonts for HiDPI

I already have Gnome scaled for my HiDPI screen. Atom 1.0.11, as installed, shows a reasonable font for text in the editor, and for menus (a bit small, but well, readable enough). But for example, for Settings, the font is way too small. To fix that, it is enough to include the following lines in .atom/styles.less:

html {
  zoom: 2;
}

After this, Settings are displayed in a reasonable font. But text in the editor is too large. Therefore, in Settings, I just change the default font to 18 (instead of 34, which was what I saw there).

HTTPS

I wanted to use a one liner for serving HTTPS from localhost, for testing purposes. I found out that openssl provides a very convenient HTTPS server. It can be used like this (for serving in https://localhost:4443 ) :

$ openssl req -x509 -newkey rsa:4096 -nodes -sha256 -keyout key.pem -out cert.pem -days 365
$ openssl s_server -key key.pem -cert cert.pem -accept 4443 -WWW

The first line is for creating the keys and certificates, and needs to be run only once.

The second line is the server, which you can run as many times as you want (but have in mind that -key and -cert expect the filename where key and certificate are stored: don't forget to use the right directory.

The last option for the 's_server' web server means "export all files in this directory", which also means thate there is no mapping for /. So, in the request, ensure you include a filename valid in the directory.

The first line can also be substituted by valid certificates. For example, certificates generated by Let´s Encrypt, via https://zerossl.com/

Image manipulation

Manipulating images is easy with convert, a tool that comes with ImageMagick:

sudo apt-get install imagemagick
  • Convert format:
convert img.jpg img.png
  • Resize (horizontal pixels x vertical pixels):
convert img.jpg -resize 400x300! img.jpg
convert img.jpg -resize 400 dest.jpg
convert img.jpg -resize x300 dest.jpg
  • Rotate:
convert img.jpg -rotate 90 img.jpg
  • Effects:
convert img.jpg -charcoal 3 img.jpg 

More details on convert.

Convert JPG to PDF

img2pdf *.jpg --imgsize A4 --pagesize A4 --output doc.pdf