Fork me on GitHub

Things I Look Up

February 14, 2020

tags: reference

cheatsheets

vpn route issue

sudo route flush

traceroute

traceroute -T -p 80 -n 10.0.5.4

ansible: add authorized key(s) to host(s)

ANSIBLE_HOST_KEY_CHECKING=false ansible all -b -u ec2-user -i 10.23.1.41,10.23.1.108,10.23.1.175, -m authorized_key -a "key=https://github.com/tphummel.keys user=ec2-user"

CIDR

ref

Chrome Screenshot of entire window 

(including below the vertical scroll - not all pages will work. SPAs which do clever viewport optimizations sometimes don’t work)

command+option+j. command+shift+p # then type "Capture full size screenshot"

sed global find/replace

sed -i -e 's/few/asd/g' hello.txt

useful curl flags

start ssh agent

eval "$(ssh-agent -s)"

add key to ssh agent

ssh-add -K ~/.ssh/id_rsa

remove host from known hosts

ssh-keygen -R <hostname>
ssh-keygen -R myhost.mydomain.com

find things listening on 8800

netstat -anp | grep -i 8800
ps -ef | grep -i 8800

systemd

systemctl stop docker
journalctl -f -u docker --since=1hr

find files by size

find / -size +1G

find files by name

find . -name test.png

recursively search files for a word

grep -nir "ldap" .

combine stdout, stderr

2>&1

awk print field space delimited

awk '{print $5}'

Tar, untar

https://tarball.guru/

create tarball of single file

tar -zcvf date-range-osx64.tar.gz date-range-osx64

Show merged pull requests between two SHAs

git log --oneline  8da11b6c32..ad5d336f1 | grep Merg
git log --oneline  8da11b6c32..HEAD | grep Merg

git delete remote branch

git push -d origin my-branc

git delete local branch

git branch -D my-branc

mac osx keyboard commands

apple+f2 # focus apple menu

set macosx wifi without a mouse

networksetup -listallhardwareports
networksetup -setairportnetwork en1 SSID password
networksetup -getairportnwor

list all consul services

curl -k -L host:8500/v1/catalog/services | jq
curl -k -L host:8500/v1/agent/services | jq

deregister consul service

curl -k -L -X PUT host:8500/v1/agent/services | jq

heredoc cat to file

cat > outfile.txt <<EOF
>some text
>to save
>EOF
cat > main.tf <<EOF
provider "oci" {
  tenancy_ocid = "ocid1.tenancy.oc1..aaaaaaaayzxt7lzjz34ttvgs7a7ht6ouzidp4c7y7kycd6corklhi46hl6ta"
  user_ocid = "<<replace with your OCID from web console>>"
  fingerprint = "<<replace with your key fingerprint - can find in web console>>"
  private_key_path = "~/.oci/oci_api_key.pem"
  region = "us-ashburn-1"
}
EOF
cat > hello.txt <<EOF
hello
EOF

signaling

sudo kill -SIGUSR1 <pid>

data normalization

Sql join reference. Venn diagrams: https://twitter.com/davidcrawshaw/status/976525292096446464/photo/1

restart mcafee endpoint protection

for i in $(ps aux | grep "[M]cAfee" | awk '{print $2}'); do sudo kill -9 $i; done

more links

Discussion, links, and tweets

a small avatar image of Tom

I am a software developer in Los Angeles.