Tuesday, January 15, 2019

checking whether ports are being listened to

Git

current revision

# 
git rev-parse HEAD

commit diffs

git diff HEAD^ HEAD

see a file from 4 revisions ago
git show HEAD~4:src/main.c

List of remote branches

git ls-remote --heads origin

remove remote branch

git push origin --delete feature/xxx

Commits which are only in one branch :
git cherry -v develop mybranch

Files modified on a branch
git diff --name-only develop

Code review

git cherry -v develop feature/foo | gawk '{print $2}' | xargs git show

SSL

Displaying a certificate, example the one of gnupg.org
echo | openssl s_client -showcerts -servername gnupg.org -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -text

External ip address

curl ipinfo.io/ip

File permissions

On FreeBSD octal file permissions 
stat -f "%0Lp" /foo/bar
On ubuntu
stat -c "%a %n" *

Restarting audio on apple

sudo launchctl stop com.apple.audio.coreaudiod

GPG

getting keygrip information for a particular homedir

gpg --homedir /home/blake/bla --fingerprint --with-keygrip blake@cyb.org

exporting a secret key

gpg --export-secret-keys --armor john@example.com > john-privkey.asc

exporting a public key

gpg --armor --export you@example.com > mykey.asc

encrypting a document using a key

gpg --output doc.gpg --encrypt --recipient blake@cyb.org doc

decrypting the document using a key


gpg --output doc --decrypt doc.gpg