Skip to content

Instantly share code, notes, and snippets.

@rahulrajaram
rahulrajaram / .txt
Created April 24, 2020 17:20
A note on my stance on squashing
There are situations where squashing commits is not favourable and is an anti-pattern.
Squashing is necessary when a series of commits represents an atomic unit of work, where an atomic unit of work is any work which if broken into two or more independent commits would render either or both of them functionally incomplete. as an extreme example, changing a single global variable name across two commits would likely break the first commit and so the two commits should be squashed. They should also be squashed because the two commits are thematically one (although thematic unity can be relative), but I view this as a less important reason. At any point, one should be able to go back to a given commit on master and ensure all tests pass.
Squashing should be avoided in situations where each commit in a given series is atomic, even if the commits deliver a feature in combination (unless, as alluded to above, some commits break the codebase in isolation). Incremental commits often represent the logical sequence o
@rahulrajaram
rahulrajaram / .zsh
Created October 19, 2020 00:51
Git Aliases
alias gbr="git branch"
alias gap="git add -p"
alias gca="git commit --amend"
alias gco="git checkout"
alias gcp="git cherry-pick"
alias gcom="git checkout master"
alias gdc="git diff --cached"
alias gmv="git mv"
alias gpo="git pull origin"
alias gpl="git pull"
@rahulrajaram
rahulrajaram / .py
Created January 21, 2022 19:14
Printing distribution of floats over 1 second intervals
"""
This scripts loads a file that contains stringified floats expected
to be seconds since epoch listed in a comma-separated fashion as
follows:
"1638201720.793","1638201720.778","1638201720.770","1638201719.866","1638201710.152","1638201710.140","1638201709.727","1638201707.715","1638201704.069","1638201702.769","1638201702.757","1638201699.529","1638201699.363","1638201699.362","1638201689.308","1638201688.406","1638201686.458","1638201686.097","1638201685.893","1638201685.620","1638201685.350","1638201685.035","1638201684.650","1638201682.229","1638201679.695","1638201678.098","1638201677.825","1638201676.972","1638201676.640","1638201675.442","1638201674.020","1638201672.890","1638201672.862","1638201669.458","1638201669.364","1638201665.908","1638201665.606","1638201665.271","1638201665.138","1638201664.315","1638201664.298","1638201663.204","1638201662.234","1638201661.479","1638201661.368","1638201660.295","1638201660.256","1638201660.108","1638201660.097","1638201660.010","1638201659.797","163820165