Skip to content

Instantly share code, notes, and snippets.

View Daviderikmollberg's full-sized avatar

Daviderikmollberg

View GitHub Profile
@Daviderikmollberg
Daviderikmollberg / branch-fu.md
Created June 3, 2022 11:39 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
Get desired version from https://github.com/bazelbuild/bazelisk/releases
Steps for Bazelisk Linux Install
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.8.1/bazelisk-linux-amd64
chmod +x bazelisk-linux-amd64
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel
# make sure you get the binary available in $PATH
which bazel
@Daviderikmollberg
Daviderikmollberg / install-gcc-9.sh
Created March 10, 2022 14:26 — forked from alexandreelise/README.md
Install gcc 9 on Ubuntu LTS 12.04,14.04,16.04 and 18.04
#!/usr/bin/env sh
sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update -y && \
sudo apt-get install gcc-9 g++-9 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
# Bash best practices and style-guide
Just simple methods to keep the code clean.
Inspired by [progrium/bashstyle](https://github.com/progrium/bashstyle) and [Kfir Lavi post](http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/).
## Quick big rules
* All code goes in a function
* Always double quote variables