Posts

Showing posts from October, 2021

aggreate data in mongodb

db.targetUsers.aggregate([ { "$sort" : { "userId" : 1 } } , { "$group" : { "_id" : "$mid" , "mid" : { "$first" : "$mid" } , "userId" : { "$first" : "$userId" } , "gender" : { "$first" : "$gender" } , "paidTime" : { "$first" : "$paidTime" } , "isFollowing" : { "$first" : "$isFollowing" } , "updatedAt" : { "$first" : "$updatedAt" } } } , { "$match" : { "userId" : { "$gte" : 2098 , "$lte" : 2110 } } } ])

Understanding chmod and chown in Linux with a Real-World Analogy

In Linux, the commands chmod and chown are used to manage file permissions and ownership. To help understand how these work, let's use an analogy with a house . chmod (Change Mode) - Setting Permissions for the House Imagine you have a house (which represents a file) and you want to decide how different groups of people can interact with it. chmod is used to set those rules. R (Read) : Group 1 can look at the house, see its contents, and understand what's inside. This is equivalent to the read permission. W (Write) : Group 2 can buy and move items into the house, arrange the furniture , and decorate the house. They can also delete items. This corresponds to the write permission. X (Execute) : Group 3 can use the house itself, meaning they can enter and interact with the environment in the house (e.g., open doors, use utilities). This represents the execute permission. There are three main groups for setting permissions: User (u) : The owner of the house (file). Gr...

Install Vagrant and VirtualBox

Virtual box để tạo máy ảo Ubuntu hoặc Debian hoặc Centos Vagrant dùng để làm công cụ kết nối ssh và testing