--- title: Notes --- # Git ## Rebase The use of -Xtheirs and -Xours appear to be somewhat counterintuitive, so think of it as telling git which branch code to favor when resolving rebase conflicts. For example, when doing: ``` bash git rebase -Xtheirs branch-b ``` Xtheirs favors your current branch-a code when overwriting merge conflicts, and vice versa -Xours overwrites merge conflicts with the code in branch-b. Similar options exist in git merge command as well, but the meaning of -Xtheirs and -Xours is reversed due to the differences on how git rebase and git merge operate and what they consider ours vs. theirs: ``` bash git rebase -Xtheirs branch-b # <- ours: branch-b, theirs: branch-a git merge -Xtheirs branch-b # <- ours: branch-a, theirs: branch-b ``` Thus, if you are merging changes from origin/master and would like git to favor your current branch code during merge conflicts, you’d need to do this: ``` bash git merge -Xours origin/master ``` - https://nitaym.github.io/ourstheirs/ - https://dev.to/cloudx/resolving-git-conflicts-in-package-lockjson-using-a-merge-driver-2ipk - https://ten0s.github.io/blog/2020/04/19/git-difftool-and-binary-files - https://gist.github.com/pascaliske/53648334378d592c0c2cc62b989a027e # Shell tips ## Recursively remove execute permissions ``` bash chmod -R a-x+X,u-x+rwX,go-wx+rX Study/ ``` ## SED debugger - sedsed - https://aurelio.net/projects/sedsed/ # System related ## Htop explained - https://peteris.rocks/blog/htop/ ## Using perf - `perf top -t ` shows the performance counters ## rsync ``` bash rsync -a username@remote_host:/home/username/dir1 place_to_sync_on_local_machine ``` Like ~cp~ and similar tools, the source is always the first argument and the destination is always the second. ## Nginx hosting setup - [Understanding DNS record types](https://www.name.com/support/articles/205516858-Understanding-DNS-record-types) - [linuxize: Secure Nginx with letsencrypt on Ubuntu 20.04](https://linuxize.com/post/secure-nginx-with-let-s-encrypt-on-ubuntu-20-04/) - [DigitalOcean: Secure Nginx with letsencrypt on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04) - [Self hosting git](https://peppe.rs/posts/self-hosting_git/) The below is used to generate the certificates. To add more sub-domains, just call the command again, adding the sub domain. ```bash certbot certonly --agree-tos --email sanchayan@sanchayanmaity.net --webroot -w /var/lib/letsencrypt/ -d sanchayanmaity.net -d www.sanchayanmaity.net -d git.sanchayanmaity.net -d monitor.sanchayanmaity.net certbot certonly --agree-tos --email sanchayan@sanchayanmaity.com --webroot -w /var/lib/letsencrypt/ -d sanchayanmaity.com -d www.sanchayanmaity.com -d git.sanchayanmaity.com -d monitor.sanchayanmaity.com ``` - [Serving static content](https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/) ## Setting up a kernel debugging environment - https://pwning.systems/posts/setting-up-a-kernel-debugging-environment/ ## Javascript - https://javascript.info/ - http://superherojs.com/ # C [Caching integer overflows in C](https://www.fefe.de/intof.html) # Where to find good bread in Bangalore - http://www.thevinebangalore.com/where-to-get-good-bread-in-bangalore/ # Wayland [A better way to read Wayland documentation](https://wayland.app/protocols/) # Distributed systems PI calculus # Yocto Yocto/openembedded builds never work on Arch and even on something old like Ubuntu 16.04, one runs into problems like this - https://git.yoctoproject.org/cgit/cgit.cgi/poky/patch/meta/recipes-devtools/m4?id=95ca077ab871ceff46c2052f324f879a1d624ff4. docker is a blessing for such things. ``` bash docker run --rm -it -v {$PWD}:/oe-core crops/poky:debian-9 --workdir=/oe-core ``` # Pulseaudio - https://endless.ersoft.org/pulseaudio-loopback/ # Keyboard websites for split ergonomic keyboards - *ergomech.store* - *keebmaker.com* - *boardsource.xyz* - *littlekeyboards.com* - *splitkb.com* - *rectangles.store* - *bastardkb.com* - *keeb.io* - - *stackskb.com* # Fish - https://github.com/jorgebucaran/cookbook.fish#how-do-i-redirect-stdout-or-stderr-to-a-file-in-fish - https://developerlife.com/2021/01/19/fish-scripting-manual/#how-to-write-functions # GPG - https://emailselfdefense.fsf.org/en/index.html - https://oguya.ch/posts/2016-04-01-gpg-subkeys/ - https://gitlab.com/muttmua/mutt/-/wikis/MuttGuide/UseGPG - https://riseup.net/en/security/message-security/openpgp/best-practices - https://m7i.org/tips/mutt-pgp-sign-attachment/ - https://thoughtbot.com/blog/pgp-and-you - https://code.dblock.org/2021/04/16/adding-work-email-to-a-gpg-key-and-signing-git-commits.html