In the middle of the desert you can say anything you want

18 Mar 2020

Day 443

Githubusing keys instead of passphrase

This is very nice and concise: Setup SSH keys for use with GitHub/GitLab/BitBucket etc, along with this series: Generating a new SSH key and adding it to the ssh-agent - GitHub Help

TL;DR generate a key, add it to Github, add it to the ssh-agent as

$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add ~/.ssh/id_rsa

Test the results as

→ ssh -T                     
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

If the key is in a non-default location, Host HostName User jaeaess IdentityFile ~/.ssh/id_rsa_github_jaeaess is needed in the ~/.ssh/config file.

To push without being asked for passwords, the remote needs to be changed from HTTPS to SSH:

$ git remote remove origin
$ git remote add origin

Since it doesn’t seem to be persistent, the unsafe way (even though it’s considered unsafe in general) is to add ssh-add -q ~/.ssh/id_rsa_github to startup.

Intellij Idea copy absolute path

To copy absolute path of a file, Ctrl+Shift+C works.

Transformer Keras load a trained model and do some changes

Very interesting discussion: Loading a trained model, popping the last two layers, and then saving it · Issue #8772 · keras-team/keras

For the Sequential model, model.pop() also exists but not for the Functional one.

For a Functional model, after getting a model from an .h5 file, we can do things such as: new_model = Model(model.inputs, model.layers[-3].output)

Nel mezzo del deserto posso dire tutto quello che voglio.