Miscellaneous tips and tricks

Posted by Michał ‘mina86’ Nazarewicz on 14th of December 2014

Don’t you hate when you need to do something you had done before, but cannot remember how exactly? I’ve been in that situation several times and sometimes looking up for a correct method turned out considerably harder than it should. To alleviate the need for future Googling, here’s a bag of notes I can reference easily:

Looking for Python stuff? Those are now in separate post:

Getting past Chrome certificate error

Chrome does not let people go to websites with invalid certificates. Proper web browsers usually have an ‘I know, get me there anyway’ button, but Chrome makes this option a little more hidden. If you ever find a need to visit a site without valid certificate, on the Chrome error message screen type ‘proceed’ or if that does not work type ‘danger’. Which word needs to by typed depends on kind of error I think. Whatever, just try both.

‘Compressing’ git repository

By now everyone should know that the --aggressive flag of git gc is not to be used. In general git should handle pack file effectively, but what if you really want to try and squeeze every byte out of it?

git repack -a -d --depth=1000 --window=1000

The numbers are arguably an overkill (and back in 2007 Linus Torvalds suggested 250 for both instead) but today’s machines are usually fast enough to handle them. The flip side is that past few hundreds you’re reaching diminishing returns.

Changing commit author

On the topic of git, to change author of a commit simply run:

git commit --amend --author "Jane Doe <jane@doe.com>"

(Yeah, I know, this is obvious, but I keep forgetting that --author option exists).

How to start a letter in English

This one is hard to find because the Internet is filled with pages that give too much information where all I need to know is proper salutation and valediction. Here it is: If you do not know the name of the person you are writing to:

Dear Sir or Madam,

I am writing to inform you of a fire that has broken out on the premises of 123 Cavendon Road…

Yours faithfully,
John Smith

If you know the name of the person you are writing to:

Dear Ms. Doe,

I am writing to inform you of a fire that has broken out on the premises of 123 Cavendon Road…

Yours sincerely,
John Smith

Polish speakers might note that — since English has a nonsensical typography and orthography rules — the salutation finishes with a comma even though the next paragraph starts with a capital letter. In languages which make more sense (e.g. Polish), the salutation is closed with a period.

Summing numbers in a column in Emacs

Select column containing the numbers to sum and simply invoke C-u C-x * :.