Homebrew: “Permission denied @ rb_file_s_symlink…”

In case you encounter this error below when doing brew update:


==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
Updated 1 tap (homebrew/core).
No changes to formulae.
Error: Failed to link all completions, docs and manpages:
  Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)
?  tfm git:(master) ? sudo chown -R $(whoami) $(brew --prefix)/*

Copy-and-paste the following in your terminal:

sudo chown -R $(whoami) $(brew --prefix)/*

My Jacoco Maven Plugin POM config

Adding it here so I can refer to it in the future.


<jacoco.version>0.8.2</jacoco.version>
        <min.branch.coverage>0.95</min.branch.coverage>
        <min.line.coverage>0.95</min.line.coverage>


<plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>default-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule implementation="org.jacoco.maven.RuleConfiguration">
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${min.branch.coverage}</minimum>
                                        </limit>
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${min.line.coverage}</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Git: Syncing fork repo against upstream repo

In case you need to make sure your forked repo is up-to-date with the original repo (i.e. /git/original/HelloWorld vs /git/anton/HelloWorld), here’s what you need to do in your terminal:


$ git remote -v
$ git remote add upstream git@git.url.io:original/HelloWorld.git
$ git remote -v
$ git fetch upstream
$ git checkout master
$ git merge upstream/master
$ git merge upstream/master
Updating ad3aeb1c..3f5ef884
Fast-forward
pom.xml | 5 +-
26 files changed, 139 insertions(+), 578 deletions(-)

Ref: https://help.github.com/articles/syncing-a-fork/

DynamoDb Notes

DynamoDb is a NoSQL database, which to me means it’s schema-less, scales horizontally, and has incredible performance when accessing data via K/V pairs.  I’m adding this here as writing about it helps me remember.

  • Two types of primary key
    • Partition key
      • same as a primary key
      • must be unique scalar attribute
      • internally also known as a hash attribute, because of the internal hash function (e.g. EmployeeId)
      • tells what “partition” the item will be stored at
    • Parition key and Sort key
      • same as a composite primary key
      • the partition key is not unique, but becomes unique when combined with the sort key (e.g. Artist & Song)
      • sort key is internally also known as a range attribute
      • partition tells where it is and sort key sorts the item
  • Secondary index
    • use when you want to query using an alternate key in addition to the partition key
    • creating an index “projects” your chosen attributes, from the base table, into a data structure
    • Two types of secondary index
      • Global secondary index
        • an index of either (1) a partition key only or (2) a composite (partition & sort), that can be different than the table’s
        • spans all partitions
        • can only have 5 indexes
        • no size restriction of all indexed
        • eventual consistency
        • can be added/deleted even after table creation
      • Local secondary index
        • same partition key as the table’s, but with a different sort key
        • spans only one table based on the partition key of the table
        • can only have 5 indexes
        • 10 GB or less in size for all indexed
        • eventual or strong consistency
        • cannot be added/deleted after table creation
  • DynamoDb Streams
    • perfect for DB cross-replication
    • must be turned on for a table
    • each event is a stream record
    • TTL of 24 hours
    • can be used with AWS Lamdba to create trigger (e.g. send “Welcome” email when new stream record is received, via a new item write)