All Categories

  • Upload to AWS S3 By Using Node.js

    1/16/2021 -
    S3 is a cloud serverless object storage solution provided by AWS. That means you can store any files to S3 without maintaining the backend machine, and how to manager these servers are AWS's responsibility. Also it is very cheap, you can reference the pricing for each region you'll be using for the S3. For example, at the moment 2020 when I check the US East Ohio, the standard s3 first 50TB/month is $0.023 per GB, it also depends on how frequently you'll use that file the price will be changed. If you just want to store some files in S3 for a long time for archive purposes, you can use the S3 Glacier Deep Archive which is $0.00099 per GB.  So, what am I doing on this blog is to show some sample code that how to upload files to AWS by Node.js. Setup IAM User with S3 permission The first thing that needs to do before writing the Node.js code is, you have to set up a user with S3 permissions to access your S3 Bucket.
  • Few Useful Command for Git Log Commit

    1/12/2021 -
    Here a few commands if you want to get a list of git commit information. This will list all the commits by the contributor. git log --author="Contributor's name" Get commit from 19 April 2020. git shortlog -s -n --since="19 April 2020" Get commit for the contributor since 19 April 2020. git log --author="Your contributor" --oneline --since="19 April 2020" Same commit log but make it pretty print.  git log --pretty="%C(Yellow)%h %C(reset)%ad (%C(Green)%cr%C(reset))%x09 %C(Cyan)%an: %C(reset)%s" --author="contributor" --since="19 May 2020 12:00:00 AM" Quit the command line by :q.
  • How to Squash All Git Commits into One

    1/11/2021 -
    A quick note to show how to squash all git local commits into one.  A scenario will be, you've been check-in in lots of commits into your own local branch when you ready to push them to the origin branch. You don't want to check-in so many commits, e.g. depending on the developer, you might have 100 commits. Here is a quick note for doing that in the command line. First, make sure you are in the correct branch.  git checkout YourBranch Then, use the soft reset to the origin branch. git reset --soft origin/YourBranch Now, at this moment, all your commit should become one, you just need to check-in that commit. If you use Visual Studio 2019, it already has a feature that you can squash all local commits to one, however, if you still use Visual Studio 2015, you will have to do that in the command line.