Saturday, August 22, 2020

Nếu con xem sex

 Hôm nay bố viết cho con lá thư đầu tiên vì muốn có một cuộc nói chuyện giữa những người đàn ông với nhau.


Đầu tiên xin chúc mừng con trai, con đã lớn và không còn là cậu bé như bố vẫn hình dung nữa. Mặc dù trước đó bố luôn nghĩ con vẫn còn là một đứa trẻ, nhưng thực sự con đã bước vào tuổi dậy thì và tò mò về một số điều chưa biết. Điều này khiến bố vừa vui mừng, vừa lo lắng.


Mừng vì con đã lớn rồi. Tuổi mới lớn tò mò nam nữ là chuyện thường, không tò mò mới là bất thường.


Nhưng lo là liệu con có thể vượt qua giai đoạn tăng trưởng này một cách an toàn và khỏe mạnh không? Đừng xấu hổ, bố cũng từng trải qua thời kỳ như con, vì vậy bố có thể hiểu con rất nhiều.


Mọi người khi bước vào tuổi dậy thì, do sự phát triển thể chất sẽ tò mò tìm hiểu kiến thức giới tính, đây là phản ứng tâm lý bình thường.


Tuy nhiên không nên vào các trang web khiêu dâm để lấy kiến thức tình dục. Một là khả năng nhận thức và phán đoán của con vẫn chưa phát triển hoàn thiện. Con dễ bị đánh lừa bởi những thông tin sai lệch, điều này sẽ gây ra áp lực tâm lý nhất định.


Con phải biết rằng kiến thức về tình dục trên các trang web khiêu dâm là không khoa học. Nó chứa đựng một mức phóng đại và xuyên tạc nhất định. Điều này sẽ khiến con hiểu lầm.


Thứ hai, khả năng tự chủ của con sẽ không được đảm bảo. Một khi đã nghiện trải nghiệm khoái cảm của tình dục, con sẽ sa đà vào nó khiến tâm trí đầy mâu thuẫn và đau đớn.


Một số người tìm những video này để giải tỏa tâm lý trống trải hoặc trút bỏ áp lực học tập. Tuy nhiên sau khi giải tỏa được, họ sẽ hối hận, thậm chí tự trách về hành động của mình.


Những điều này rất bất lợi cho sự phát triển thể chất và tinh thần của con. Vì vậy khi bối rối về tình dục, con có thể tìm một số kênh tham khảo hợp lý. Ví dụ hãy hỏi bố. Bố là một người đàn ông và là người đáng để con tin tưởng.


Ví dụ khác, hãy tìm câu trả lời từ những cuốn sách liên quan. Những cuốn sách về tâm sinh lý tuổi dậy thì mà bố tặng con trước đây là một kho báu rất tốt đó!


Bố muốn nói với con một vài điểm như sau:


1. Tình dục giống như ăn và thở, cũng không phải là thứ bẩn thỉu, đó là bản năng của con người và không đáng để tò mò quá mức.


Bố cũng đến từ thời niên thiếu, cũng từng tò mò về kiến thức giới tính. Thời điểm đó chưa có internet, bố bí mật vào phòng xem phim khiêu dâm với các bạn nam khác.


Lần đầu được xem, bố cũng rất phấn khích và không kìm được... Tuy nhiên sau khi xem vài lần, bố cảm thấy vô nghĩa và buồn tẻ.


Học lực của bố sa sút trông thấy. Sau này bố đã kịp thời điều chỉnh bản thân, dồn hết tâm trí vào việc học và không bao giờ nghĩ đến những hình ảnh đó nữa.


Nhưng không phải ai cũng như bố. Một bạn nam trong lớp, người cùng xem những bộ phim khiêu dâm đó đã "ăn trái cấm" với một bạn nữ. Và sau đó cô gái có thai.


Hai người họ cuối cùng đều bỏ học vì xấu hổ và cô gái được đưa đến bệnh viện để phá thai.


Vì sự thiếu hiểu biết và mê muội về tình dục, hai đứa trẻ đã phạm phải những sai lầm khiến họ phải ân hận suốt đời.


Tò mò nhất thời, đánh mất tương lai, rối tung cả đời.


Con có nghĩ rằng đó là giá trị của việc xem phim khiêu dâm?


2. Quan hệ nam nữ là bình thường, nhưng không được quan hệ tình dục với trẻ em gái vị thành niên.

Vì lúc này tâm sinh lý, kinh nghiệm xã hội, điều kiện kinh tế... của các con còn non nớt, chưa thể gánh chịu hậu quả của việc quan hệ tình dục.

Khi cảm thấy mình có xung động tình dục, con nên chuyển hướng chú ý ngay lập tức như chơi bóng, nghe nhạc, đọc sách, ... để các xung động vật lý được chuyển tải và giải phóng.

Hãy nhớ rằng quan hệ nam nữ chỉ nên xảy ra khi họ đã trên 18 tuổi.

3. Hạnh phúc thực sự dựa trên một cuộc sống ổn định và tình yêu tận tâm.

Các con còn nhỏ tuổi nên chưa thích hợp để yêu như người lớn.

Yêu sớm có hại, vì vậy con phải học cách bảo vệ mình và người khác, từ chối những lời dụ dỗ xấu và đối xử khôn ngoan.

4. Con à, tuổi mới lớn là thời kỳ trưởng thành quan trọng của con người. Trong thời kỳ này, tâm lý con người phải hoàn thành một bước chuyển biến rất lớn từ thời thơ ấu đến khi trưởng thành.

Trong lúc đó phải đề cao cảnh giác và kiềm chế, đề phòng tình dục mê muội. Đừng bao giờ sa đà, kẻo làm chuyện phiếm khiến cả đời ân hận.

Con cần có tầm nhìn dài hạn, thời học sinh phải xác định rõ mục tiêu của mình, tập trung nhiều hơn vào việc học, trau dồi năng lực và phẩm chất toàn diện của bản thân, vào các hoạt động tập thể khác nhau.

Khi con trưởng thành, có khả năng giải quyết các vấn đề cá nhân, con có thể chuẩn bị cho việc lựa chọn vợ trong tương lai và kết hôn.

Con à, cuối cùng bố muốn nói "Bố xin lỗi con", bố đã dùng cớ "bận" để bỏ qua sự trưởng thành của con và không hoàn thành trách nhiệm giáo dục.

Trong tương lai, bố sẽ đồng hành cùng con nhiều hơn và cùng con đối mặt với những khó khăn mới.

Bố cũng tin rằng con trai bố có thể sống tốt qua giai đoạn khủng hoảng này.

Hãy nhớ rằng, bảo vệ bản thân và tôn trọng phụ nữ sẽ là một chủ đề mới trong cuộc sống của con.

Chúc con sớm trưởng thành!

Yêu con".







https://vnexpress.net/12h-dem-phat-hien-con-trai-xem-phim-khieu-dam-4148458.html

Wednesday, July 29, 2020

Linux Sticky Bit Concept Explained with Examples

Linux permissions are a concept that every user becomes intimately familiar with early on in their development. We need to execute scripts, modify files, and run processes in order to administer systems effectively, but what happens when we see Permission denied? Do you know why we see this message? If you know the cause of the problem, do you know how to implement the solution?

I will give a quick explanation of the various ways to calculate permissions, and then we will focus on the special permissions within Linux. If you want an in-depth look at the chmod command, check out this article from Sudoer Shashank Hegde, Linux permissions: An introduction to chmod.

The TL;DR is that there are two main ways of assigning permissions.

Symbolic method

The symbolic method uses the following syntax:

[tcarrigan@server ~]$ chmod WhoWhatWhich file | directory

Where:

  • Who - represents identities: u,g,o,a (user, group, other, all)
  • What - represents actions: +, -, = (add, remove, set exact)
  • Which - represents access levels: r, w, x (read, write, execute)

An example of this is if I want to add the read and write permissions to a file named test.txt for user and group, I use the following command:

[tcarrigan@server ~]$ chmod ug+rw test.txt

Full disclosure, this is not my preferred method of assigning permissions, and if you would like more information around this method, I recommend your nearest search engine.

Numeric method

The numeric method is, in my experience, the best way to learn and practice permissions. It is based on the following syntax:

[tcarrigan@server ~]$ chmod ### file | directory

Here, from left to right, the character # represents an access level. There are three access levels—user, group, and others. To determine what each digit is, we use the following:

  • Start at 0
  • If the read permission should be set, add 4
  • If the write permission should be set, add 2
  • If the execute permission should be set, add 1

This is calculated on a per access level basis. Let's interpret this permissions example:

-rw-r-x---

The permissions are represented as 650. How did I arrive at those numbers?

  • The user's permissions are: rw- or 4+2=6
  • The group's permissions are: r-x or 4+1=5
  • The others's permissions are: --- or 0

To put this into the command syntax, it looks like this:

[tcarrigan@server ~]$ chmod 650 test.txt

Now that you understand the basics of permission calculation in Linux, let's look at the special permissions included in the OS.

Special permission explained

Special permissions make up a fourth access level in addition to user, group, and other. Special permissions allow for additional privileges over the standard permission sets (as the name suggests). There is a special permission option for each access level discussed previously. Let's take a look at each one individually, beginning with Set UID:

user + s (pecial)

Commonly noted as SUID, the special permission for the user access level has a single function: A file with SUID always executes as the user who owns the file, regardless of the user passing the command. If the file owner doesn't have execute permissions, then use an uppercase S here.

Now, to see this in a practical light, let's look at the /usr/bin/passwd command. This command, by default, has the SUID permission set:

[tcarrigan@server ~]$ ls -l /usr/bin/passwd 
-rwsr-xr-x. 1 root root 33544 Dec 13  2019 /usr/bin/passwd

Note the s where x would usually indicate execute permissions for the user.

group + s (pecial)

Commonly noted as SGID, this special permission has a couple of functions:

  • If set on a file, it allows the file to be executed as the group that owns the file (similar to SUID)
  • If set on a directory, any files created in the directory will have their group ownership set to that of the directory owner
[tcarrigan@server article_submissions]$ ls -l 
total 0
drwxrws---. 2 tcarrigan tcarrigan  69 Apr  7 11:31 my_articles

This permission set is noted by a lowercase s where the x would normally indicate execute privileges for the group. It is also especially useful for directories that are often used in collaborative efforts between members of a group. Any member of the group can access any new file. This applies to the execution of files, as well. SGID is very powerful when utilized properly.

As noted previously for SUID, if the owning group does not have execute permissions, then an uppercase S is used.

other + t (sticky)

The last special permission has been dubbed the "sticky bit." This permission does not affect individual files. However, at the directory level, it restricts file deletion. Only the owner (and root) of a file can remove the file within that directory. A common example of this is the /tmp directory:

[tcarrigan@server article_submissions]$ ls -ld /tmp/
drwxrwxrwt. 15 root root 4096 Sep 22 15:28 /tmp/

The permission set is noted by the lowercase t, where the x would normally indicate the execute privilege.

Setting special permissions

To set special permissions on a file or directory, you can utilize either of the two methods outlined for standard permissions above: Symbolic or numerical.

Let's assume that we want to set SGID on the directory community_content.

To do this using the symbolic method, we do the following:

[tcarrigan@server article_submissions]$ chmod g+s community_content/

Using the numerical method, we need to pass a fourth, preceding digit in our chmod command. The digit used is calculated similarly to the standard permission digits:

  • Start at 0
  • SUID = 4
  • SGID = 2
  • Sticky = 1

The syntax is:

[tcarrigan@server ~]$ chmod X### file | directory

Where X is the special permissions digit.

Here is the command to set SGID on community_content using the numerical method:

[tcarrigan@server article_submissions]$ chmod 2770 community_content/
[tcarrigan@server article_submissions]$ ls -ld community_content/
drwxrws---. 2 tcarrigan tcarrigan 113 Apr  7 11:32 community_content/

Summary

In closing, permissions are fundamentally important to being an effective Linux administrator. There are two defined ways to set permissions using the chmod command: Symbolic and numerical. We examined the syntax and calculations required for both methods. We also considered the special permissions and their role in the system. Now that you understand permissions and the underlying concepts, you can solve the ever-annoying Permission denied error when it tries to impede your work.





Wednesday, November 27, 2019

Remove all from docker

1. Remove all in docker.
# Stop all containers
docker stop `docker ps -qa`

# Remove all containers
docker rm `docker ps -qa`

# Remove all images
docker rmi -f `docker images -qa`

# Remove all volumes
docker volume rm $(docker volume ls -qf dangling="true")

# Remove all networks
docker network rm `docker network ls -q`

# Your installation should now be all fresh and clean.

# The following commands should not output any items:
# docker ps -a
# docker images -a
# docker volume ls

# The following command show only show the default networks:
# docker network ls

source https://gist.github.com/beeman/aca41f3ebd2bf5efbd9d7fef09eac54d

2. Debug in docker
# method 1
docker run -it image_id bash

Sunday, May 19, 2019

5 Most Common Python Interview Questions with Detailed Answers

1. What is pickling and unpickling?

Pickling means serializing the object into binary streams before writing it to the file. It’s basically a way to convert a Python object into a character stream.
In Python, any object can be pickled to be saved on disk. This is very useful when someone wants to save the state of his objects and reuse later without losing any instance-specific data.
In simple words, Pickling and unpickling are used for serializing and deserializing an object structure in Python.
Suppose, you’re restoring a saved game, it means you’re loading pickled, and therefore you’re unpickling it. Both of these terms are widely used in the industry as they allow you to easily send data from one server to another and ultimately store it in a file or database.

2. What is a Tuple? What’s the difference between lists and tuples in Python?

Both lists and tuples are sequence data types that can store a collection of items. But the main difference between these two is — lists are mutable and tuples are immutable. It means you can modify the values in lists but you cannot modify or even copy the values in tuples.
Another difference is lists are used to store homogeneous elements i.e elements belonging to the same type, whereas tuples are used to store heterogeneous elements i.e elements belonging to different types. You can also use tuples as dictionary keys if needed.

3. What are some advantages of using Python over other programming languages?

There are a lot of advantages to using Python over other languages. First of all, Python is open-source, has extensive support libraries and clean object-oriented designs. It has simple syntax and comes with easy readability.
Python has powerful control capabilities. It can call C, C++ or Java directly via Jython. It comes with Enterprise Application Integration which makes it easier to develop Web services by invoking COM or COBRA components. Python also saves programming time and effort by reducing the number of lines of code required to do a particular task.

4. How memory is managed in Python?

Python contains a private heap storing all the Python objects and data structures. This private heap is internally managed by the Python memory manager.
This Python memory manager has different components which are responsible for various dynamic storage management aspects such as sharing, segmentation, caching or preallocation.
Hence, the Python memory manager delegates some of its work to the object-specific allocators but always ensures that they operate within the private heap limits.

5. What is Flask and what are its benefits?

Flask is a Python framework inspired by Sinatra Ruby framework and based on the Werkzeug and Jinja2 framework libraries.
The main purpose of building this framework was to create a strong foundation for both simple and complex web applications. Flask is easy to use and extend. It allows one to use any extension he/she needs.
They are Unicode based, have a built-in development server, support for secure cookies, has integrated support for unit testing. Flask is available under the BSD license.

Thursday, May 9, 2019

sed, awk command line

1. Insert text from begining and special line (from line >= 57) with awk
  • awk 'FNR>=57,$0="allow "$0{print}' /etc/nginx/akamai_https.conf > test2.txt
  • sed -i -e 's/^/text\ to \ insert/g' filename
2. Replace all IP "xxx.xxx.xxx.xxx;" => "xxx.xxx.xxx.0/24;"
  • sed -e 's/\.[0-9]\+;/\.0\/24;/g' /tmp/ips.txt > /tmp/new_ips.txt
    Here is content in file:
    access_log /var/log/test.log;
    I want to insert before the ; character
  • sed -i -e "s/\(access_log.*.log\)\(;\)/\1\ combined\ if\=\$loggable\2/g" filename.txt
3. Replace string in all file in dir
  • ls -1 <dir> | xargs -n1 -i%f sed -i -e 's/old_string/new_string/g' '%f'
4. Sed with variable with forward slash in shell script
  • vari1=/Users/huytn/test
  • sed -i -e "s/old_string/${vari1//\//\\/}/g" /path/to/file







Tuesday, February 12, 2019

10 thứ trẻ nên học để trở thành người hạnh phúc

1. Ngoại ngữ
Một nghiên cứu cho thấy những đứa trẻ học ngôn ngữ thứ hai thích nghi nhanh với sự thay đổi, có trí nhớ tốt và hiểu rõ hơn về ngôn ngữ nói chung. Chưa kể, khi lớn lên, việc giao tiếp được bằng nhiều thứ tiếng sẽ giúp con bạn có nhiều lựa chọn nghề nghiệp hơn. 
Các nhà khoa học từ Viện nghiên cứu Rotman ở Canada cũng đã chứng minh việc nói hai ngôn ngữ giúp não trì hoãn sự khởi phát của bệnh Alzheimer khi về già.
2. Bơi lội
Hoạt động thể chất giúp chúng ta có cuộc sống lành mạnh. Bơi lội còn là kỹ năng sinh tồn cần thiết giúp trẻ tự cứu sống bản thân trong những tình huống nguy cấp. Nhờ bơi lội, tay chân sẽ phát triển khả năng phối hợp, não bộ duy trì sự minh mẫn, theo nghiên cứu được công bố bởi Trung tâm Thông tin Công nghệ sinh học Quốc gia Mỹ.
3. Nhạc cụ
Ảnh: Pixabay
Ảnh: Pixabay
Theo Journal of Neuroscience, việc chơi một nhạc cụ giúp cải thiện kỹ năng của thính giác, trì hoãn sự suy giảm năng lực não bộ khi về già. Điều này xảy ra do khi chơi nhạc cụ, chúng ta kích hoạt một số hệ thống ở não cùng lúc như thính giác, vận động và nhận thức. Nhờ chơi nhạc cụ từ nhỏ, trẻ sẽ có khả năng giao tiếp và thể hiện bản thân tốt hơn khi lớn lên. 
4. Nhảy múa
Một nghiên cứu từ Đại học Karlstad (Thụy Điển) cho thấy nhảy múa giúp trẻ học cách giao tiếp và thể hiện cảm xúc thông qua cơ thể. Âm nhạc còn khuyến khích khả năng sáng tạo, kỹ năng xã hội và vận động. Nhảy múa giúp trẻ đến gần hơn với những nền văn hóa khác, khiến chúng có xu hướng cởi mở hơn và tự tin vào cơ thể của mình. 
5. Tái chế
Thông qua việc tái chế, chúng ta góp phần bảo vệ Trái Đất, để lại một thế giới tốt hơn cho thế hệ sau. Đối với trẻ em, tái chế còn kích thích khả năng sáng tạo. Chúng sẽ biết không cần đến những nguyên liệu đắt tiền để biến ý tưởng thành hiện thực. Ở Tây Ban Nha, nhiều nhà giáo dục khuyến khích đưa tái chế vào giảng dạy trong trường học để nâng cao nhận thức về bảo vệ môi trường. 
6. Dọn dẹp
Ảnh: Depositphotos
Ảnh: Depositphotos
Trật tự và vệ sinh là hai yếu tố không thể thiếu trong cuộc sống của bất kỳ người nào. Bên cạnh những lý do dễ thấy như mang lại không gian sạch đẹp, việc dọn dẹp còn giúp ích cho tinh thần, khiến con người trở nên có tổ chức hơn. Ở Nhật Bản, việc dọn dẹp lớp học và khuôn viên trường là một phần của giáo dục. 
7. Định hướng
Khuyến khích ý thức định hướng sẽ tốt cho não bộ của trẻ. Một nghiên cứu đã chỉ ra rằng có một hệ thống định vị bên trong não bộ tạo ra các mạng lưới tế bào thần kinh, nuôi dưỡng ý thức và giúp não lập kế hoạch, lộ trình, cải thiện khả năng đưa ra quyết định của mỗi người.

8. Nấu ăn
Bằng cách nấu ăn, trẻ sẽ cải thiện mối quan hệ với thực phẩm. Nếu bạn cho con cùng chuẩn bị một món ăn, chúng sẽ thích thú hơn khi ngồi vào bàn ăn và dần ít muốn ăn vặt. Khi làm theo công thức nấu ăn, chúng sẽ học được tầm quan trọng của việc tuân thủ hướng dẫn, khám phá từng nguyên liệu bằng các giác quan cụ thể. Nếu trẻ còn quá nhỏ, bạn hãy giao nhiệm vụ đơn giản, quan sát kỹ để tránh xảy ra tai nạn. 
9. Tiêu tiền
Khi lớn lên, trách nhiệm tài chính ngày càng nặng nề và chúng ta sẽ dễ mắc sai lầm nếu không được chuẩn bị từ sớm. Điều quan trọng là hãy dạy trẻ rằng tiền là công cụ, không phải phần thưởng. Không chỉ học cách tiết kiệm, trẻ cũng cần học cách tiêu tiền khôn ngoan. 
10. Biểu lộ cảm xúc
Ảnh: Pixabay
Ảnh: Pixabay
Một số tình huống không tránh được trong cuộc sống gây cảm xúc tiêu cực. Do đó, ngay từ khi con còn nhỏ, bạn hãy dạy chúng cách xác định, chấp nhận và biểu lộ cảm xúc. Trí tuệ cảm xúc (EQ) sẽ cho phép trẻ đưa ra quyết định và phản ứng phù hợp trong các tình huống phức tạp. 
Ngoài ra, bạn nên dạy con tầm quan trọng của việc nghỉ ngơi và thư giãn. Ở trường học, thầy cô dạy trẻ kiến thức, giao bài tập, yêu cầu thu thập thông tin và cách sống hòa hợp với tập thể. Ở nhà, cha mẹ cần giúp trẻ học cách tìm những khoảnh khắc thích hợp để vui đùa và giải phóng sự căng thẳng. 

Tuesday, December 18, 2018

gitlab some tips


  • Working with non default ssh key pairs path
    • If you use non default file path for your Gitlab key pairs, you must configure your ssh client to find your gitlab private ssh key for connections to gitlab. Open terminate and enter
$eval($ssh-agent -s)
$ssh-add /path/to/another_id_rsa
    •  To retain these settings, you need to save them to configuration file. For openssh client this is configured in the ~/.ssh/config file
Host gitlab.com
    Preferredauthentications publickey 
    IdentityFile ~/.ssh/example_com_rsa 
  • Switching remote URLs from https to git: 
    • open terminal
git remote set-url https://gitlab.com gitlab@gitlab.com:USERNAME/REPOSITORY
    • Verify  remote URL has changed
git remote -v