Skip to content

Instantly share code, notes, and snippets.

View buddyp1952's full-sized avatar
๐Ÿ™‚
Working from home

Buddy Palumbo buddyp1952

๐Ÿ™‚
Working from home
View GitHub Profile
@buddyp1952
buddyp1952 / git-diff.md
Created March 20, 2020 14:43
Understanding git diff
  • git diff View difference between Stage and Working Directory

  • git diff --staged View difference between HEAD and Stage

  • git diff HEAD View difference between HEAD and Working Directory

  • origin refers to the source repository from where it was cloned.

  • HEAD is a reference to the last commit in the currently checked-out branch.

  • Staged and index both are same

  • Unstaged changes exist in our Working Directory, but Git hasnโ€™t recorded them into its version history yet.

  • Staged changes are a lot like unstaged changes, except that theyโ€™ve been marked to be committed the next time you run git commit

@buddyp1952
buddyp1952 / not-rebase.sh
Created February 28, 2020 21:45
How to avoid rebasing
git checkout master
git pull
git checkout 666-my-evil-branch
git checkout master
git merge --squash 666-my-evil-branch
git commit -nv
git checkout -b 666-my-evil-branch-clean
git push -u origin 666-my-evil-branch-clean
@buddyp1952
buddyp1952 / revert-file.sh
Created February 28, 2020 21:44
revert a unwanted change to a file
git checkout master file
git status
git add file
git commit -m "reverted file"
@buddyp1952
buddyp1952 / sync-with-master.sh
Created February 28, 2020 21:42
How to merge feature branch with master
git checkout master
git pull
git checkout 666-my-evil-branch
# are you really on the right branch?
git branch
# is everything in the right state?
git status
# do it
git merge master
# fix problems
@buddyp1952
buddyp1952 / list-ca-cert.sh
Last active February 28, 2020 18:40
list all the certs in a .pem cert bundle
openssl crl2pkcs7 -nocrl -certfile /usr/lib/ssl/certs/ca-certificates.crt \
| openssl pkcs7 -print_certs -text -noout
@buddyp1952
buddyp1952 / death-to-systemd-resolved.sh
Last active February 25, 2020 20:20
get rid of systemd-resolved
scp /etc/resolv.conf host:/tmp
ssh -t host "sudo mv /tmp/resolv.conf /etc \
&& sudo systemctl disable systemd-resolved \
&& sudo systemctl stop systemd-resolved \
&& host google.com"
@buddyp1952
buddyp1952 / install-snmpd.sh
Last active February 25, 2020 19:55
Install snmpd on ubuntu 18.04
#!/bin/bash -x
# install packages
sudo apt install snmp snmpd snmp-mibs-downloader -y -qq
# create config file
cat > /tmp/snmpd.conf << EOF
# Listen for connections on all interfaces (IPv4 only)
agentAddress udp:161