Monday, 4 February 2019

venv

brew install python3

mkdir -p ~/bin/python3
python3 -m venv ~/bin/python3
source ~/bin/python3/bin/activate

enjoy!

Wednesday, 23 January 2019

common git

- git grep ‘pattern’: search the repo for a string
- git commit --amend: rewrite the last commit message (must do this before pushing otherwise you’re push will be rejected)
- git rebase -i master: does an interactive rebase on your local master branch. handy for cleaning up your branch before opening a merge request. this is how i squash commits and rewrite commit messages
- git rebase -i HEAD^^: does an interactive rebase with just the last two commits. I use this if i want to combine the two most recent commits together
- git diff <branch> — <path/to/file> : diffs between current branch and another branch, but only the file (or files) you specify
- git checkout <branch> — <path/to/file>: replaces (or adds) a version of a file from another branch. handy for reverting
- git commit -m ‘message’: quickly commit with a commit message
- git commit -C HEAD: commit with the same exact commit message as the last commit.

Tuesday, 18 December 2018

Quickly ssh into repeatly new Linux instances with same IP without host key check

WARNING: this is extremely dangerous on networks not completely TRUSTED

Host 10.10.* *.mycompany.org
  User myuser
  IdentityFile /home/myuser/.ssh/my_ssh_key
  StrictHostKeyChecking no
  UserKnownHostsFile=/dev/null

Monday, 26 November 2018

Total n00b’s guide to Big O, Big Ω, & Big θ

Crazy brillant!

https://medium.com/@.RT/total-n00bs-guide-to-big-o-big-%CF%89-big-%CE%B8-aa259ae8a1c2

Total n00b’s guide to Big O, Big Ω, & Big θ

Tuesday, 11 September 2018

tcpdump -nnXSs

Taken: https://www.askbjoernhansen.com/2007/07/12/how_to_dump_packets_with_tcpdump.html

I always forget the parameters for this and have to look them up in the man page, so enough of that:

 tcpdump -nnXSs 0 port 80


  • "-nn" makes it not lookup hostnames in DNS and service names (in /etc/services) for respectively faster and cleaner output. 
  • "-X" makes it print each packet in hex and ascii; that's really the useful bit for tracking headers and such 
  • "-S" print absolute rather than relative TCP sequence numbers - If I remember right this is so you can compare tcpdump outputs from multiple users doing this at once 
  • "-s 0" by default tcpdump will only capture the beginning of each packet, using 0 here will make it capture the full packets. We are debugging, right? 

Sunday, 9 September 2018

<description>[\w\s\n&\.\-,;]*</description>

Monday, 27 August 2018

perl cli regex

perl -pe 's/^(.+)\/([^\s]+)\-([v0-9.]+)\-*([Final|GA|M2|rc|beta|R5]*).jar$/$2\t$3\t$4/'

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...