Blog

Facebook: Shortcut to unliking Pages

I wanted to clean up my News Feed from no longer relatable Pages. I tried the “go-to-page-unlike” cycle, but it took waaay too long. So I found this trick:

  1. Go to https://www.facebook.com/<your-user-name>/allactivity
  2. Go to “Likes”
  3. Go to “Pages and Interests”
  4. Click the “Edit” icon and “Unlike”

Or, you can go to: https://www.facebook.com/<your-user-name>/allactivity?privacy_source=activity_log&log_filter=likedinterests

Hope this helps. \m/

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)

My Understanding of the CAP Theorem

With the technical landscape being distributed, you will have heard of the CAP Theorem, as it related to the systems that you work on to be 99.99999% up. These are my $0.02 on my understanding of the CAP Theorem.

* Consistency – read/write guarantee between nodes
* Availability – nodes respond and do no error out
* Partition Tolerance – system still functions when network goes berserk

Let’s face it: networks are unreliable. Period. So, the theorem states that you can only really guarantee 2 out of the 3 above, specifically:

CP – consistency and partition tolerance
AP – availability and partition tolerance

The difference is which one to to choose, and it all depends on your business requirements.

* CP when requirements dictate atomic read and writes
* AP when data consistency is flexible around data synchronization