Skip to content

Instantly share code, notes, and snippets.

Code review practices

The following is meant to be a set of guidelines, not dogma. Use your best judgement. The goal is threefold, to have a practice for engineers to learn about what we collectively care about. To maintain quality of the code base as well as knowledge sharing about our systems.

Role of the author

  • Create PR, make sure to include JIRA ticket if such exists in the description or title of PR
  • Assign 2 developers as minimum but can include the whole team if the author feels it's needed.
  • Answer any questions the reviewer has.
  • Push changes after review is done as a new commit and make sure reviewer and yourself are satisfied with the change.
func selfConnect(fd *netFD, err error) bool {
// If the connect failed, we clearly didn't connect to ourselves.
if err != nil {
return false
}
// The socket constructor can return an fd with raddr nil under certain
// unknown conditions. The errors in the calls there to Getpeername
// are discarded, but we can't catch the problem there because those
// calls are sometimes legally erroneous with a "socket not connected".
@sata
sata / gist:242c9e2b49defdcbe373f8813ae358b1
Created December 17, 2019 15:42
debugging active resource entries
ActiveSupport::Notifications.subscribe('request.active_resource') do |name, start, finish, id, payload|
p "#{payload[:method]} #{payload[:request_uri]} => #{payload[:result].class.name}"
end
➜ ~ echo | openssl s_client -showcerts -servername aftonbladet.se -connect aftonbladet.se:443 2>/dev/null | openssl x509 -inform pem -noout -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
04:cf:a7:c1:b8:a5:41:59:ad:5b:f3:4b:74:44:c7:bb
Signature Algorithm: sha256WithRSAEncryption
Issuer: C = US, O = DigiCert Inc, OU = www.digicert.com, CN = GeoTrust TLS RSA CA G1
Validity
Not Before: May 22 00:00:00 2018 GMT
#!/usr/bin/env bash
# Quick hack to replace iptables rules NordVPN inserts (prepends) for
# INPUT chain. Instead of accepting connection in any states, only allow RELATED and ESTABLISHED.
# i.e -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# For what ever reason, NordVPN thinks it's good that they can reach your machine and you would be ok with that.
# It doesn't clean up iptables rules if you reconnect several times to NordVPN
set -euo pipefail
function ifs {