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)

Bash script to check health checks of multiple servers

I had to check over 20 servers to verify they were updated with a new build. The servers had a health check page that had this information along with whether the server was up-and-running. I wrote this quick-and-dirty bash script to do just that. 

for i in jetson1 jetson4; do for j in {1..10}; do curl -igX GET "http://app$j.tpa.$i.coresys.tmcs:8080/health/heartbeat"; done; done | grep -E '1.4.37' | grep -E "Overall Status: Success" | wc -l<br>

Hope this helps someone. Cheers!