Random notes

Terminal

Change the number of rows/columns if it was detected wrong: stty rows N; stty columns N.

Git

  • Create and switch to a feature branch git checkout -b FEATURE-1
  • Review changes git status; git diff src/controllers/v1/comments.js; git add src/controllers/v1/comments.js
  • Create and push a commit git commit; git push origin FEATURE-1
  • Prepare a pull request description git log --pretty='%h: %B' --first-parent --no-merges --reverse
  • Fix up history after a review git rebase --interactive master git push origin FEATURE-1 --force
  • Delete the feature branch git checkout master; git pull origin master; git branch -D FEATURE-1

Testing a connection through a socks5 proxy with authentication

curl -x socks5h://login:password@host:port https://ya.ru

Overriding a configuration file in someone else’s package

If installing your own package needs to replace a file from another package, you can do it like this:

#!/bin/sh

set -e
if test "$1" = install; then

  cp /etc/collectd/collectd.conf /etc/collectd/collectd.conf.original

  dpkg-divert --quiet --package my-awesome-package --divert /etc/collectd/collectd.conf.original --rename /etc/collectd/collectd.conf

  rm -f /etc/collectd/collectd.conf

fi

exit 0

and put it into debian/my-awesome-package.preinst

P.S. yes, the script doesn’t handle cases other than install, and there’s no postrm example either.