Categories
Productivity Tech

How To Mount SMB With Command Line In Ubuntu And Debian

I need to mount an SMB to one of my local machines. After a few tries and errors, I found a perfect solution.

Step 1 – Install the cifs-utils package.

sudo apt install cifs-utils

If you missed this step, you’ll end up with the following error:

mount -t cifs results in 'cannot mount readonly' error

Step 2 – Create a local mount directory

There is no absolute right or wrong directory to mount. I prefer the /mnt for most of my mounting directories. mysmb is an arbitrary folder name. You can name it whatever you want.

sudo mkdir /mnt/mysmb

Step 3 – Mount SMB

Mount the SMB to the /mnt/mysmb directory in step 2.

sudo mount -t cifs -o username=user //smb-server-address/share-name /mnt/mysmb
  • user: the user name of your SMB
  • smb-server-address: the IP address of your SMB
  • share-name: if you have a folder and you only want to mount that folder, you can specify it here

For example:

sudo mount -t cifs -o username=mysmbuser //10.0.1.123/myFolder /mnt/mysmb

Then you’ll get a prompt to enter the password for your user. Viola! Now you can access your SMB folder from your local at /mnt/mysmb (or whatever the local path you specified in step 2).

Leave me a message if you have a question.

If my note helped, please consider buying me a coffee😁.

Cheers,
Lok

Categories
Productivity Tech

Linux: How To Convert HEIC Files to JPG or PNG

As some of you might know, iPhone has its own picture file format. The HEIC(High-Efficiency Image Container) format. it doesn’t always work when you want to upload it to many websites. There are some websites out there that can convert it for you. It might be okay for some photos that you don’t care about. But for some family photos, you might not want to share them on some random websites.

I found that on Linux, you can simply install a command-line tool called heif-convert. To use it, simply install the libheif-examples command-line. heif-convert just comes with it for free. To install, run the following command:

sudo apt-get install libheif-examples

You can easily convert your HEIC file with the following command:

heif-convert [original-file-name] [file-name-with-jpg-or-png-extension]

For example, if you have a file called IMG_1234.HEIC and want to convert it to IMG_1234.jpg, you can simply run:

heif-convert IMG_1234.HEIC IMG_1234.jpg

Easy, isn’t it? This command can only convert 1 file at a time, which can be annoying when you need to convert multiple files. If you’re lucky, all of the files you drag from the iPhone will have lowercase extension “heic”. You can run this script to convert them:

for file in *.heic; do heif-convert $file ${file/%.heic/.jpg}; done

Sometimes, some files are in lowercase and some come with uppercase. There are many ways to deal with this issue. You can rename all the files to lowercase and then run the above command, you can write a program that reads all the files and then run the heif-convert command.

I took the route to learn about how to do that with a bash script. My script will read all the files that contain “.heic” or “.HEIC” in the filename. Then convert them into jpg format with the heif-convert command.

I created a GitHub repository for any handy command in the future. You can download the heic-converter.sh executable from here. To run it:

./heic-converter.sh

If my note helped, please consider buying me a coffee😁.

Cheers,
Lok

Reference:

https://askubuntu.com/questions/958355/any-app-on-ubuntu-to-open-and-or-convert-heif-pictures-heic-high-efficiency-i

Categories
Productivity

How To Study Less, Study Smart

I came across a video recently about how to study smarter. I found it useful for people at any age that needed to focus and learn. Here’s a note I took that summarizes it.

1. Break your study sessions into 25-minute chunks

Your attention is limited. Study shows that most people can only focus on a task for about 25 minutes. Then your efficiency will deplete very quickly.
When you reach a plateau where you cannot focus anymore, take a 5-minute break. That will recharge your brain and give you a fresh start.
You can also reward yourself after finishing your entire day. This way you’ll enjoy studying more in the future.

2. Create a dedicated study area

You have trained yourself to behave differently in different rooms or areas. For example, you’ll eat at the dining table, sleep in the bedroom, etc. If you happened to eat, study, and play at the same desk, your brain will be confused when you need to focus. Ideally, you can have a study area just for you to study. But sometimes this is a luxury, especially when you’re living in a dorm room. The solution is to buy a study lamp. It doesn’t have to be fancy or expensive. You only turn it on when you need to focus and study. That way you’ll adapt to the atmosphere of staying concentrated when the lamp is on.

3. Study actively – once you’ve learned, test yourself actively

When it comes to studying, there are two categories of memorizing: concept and fact. A concept is something easy to remember once you truly understand it. For example, the functionality of a particular bone in the human body. A fact is something you just have to memorize. For example, the name of a particular human bone.

Our brain is good at recognizing but it’s not good at recollecting. For example, when you can’t remember a concept and you started looking at a highlighted paragraph. You would think you have remembered it. But you actually just recognized it. If you want to actually memorize it, you have to test yourself and learn actively. To distinguish whether you are recalling something or recognizing something, try explaining it without looking at the note or book. If you can do that, congratulations! You’re recalling it.

3. After class, study as soon as possible

Our brain can forget something pretty quickly. By immediately studying or summarizing what you just learned, the memory will be strengthened much better than later. The sooner you study, the easier you can retain the knowledge in the future. A five-minutes investment of your time after class will help you recollect the detail much better even for the next day.

4. The SQ3R reading method

Survey: Skim through all the headings and sub-headings of each chapter before reading into the detail.
Question: Convert the headings into questions. Ask yourself what is each paragraph is trying to answer.
Read: Read the paragraphs to find out what is it actually trying to tell you.
Recite: After reading, speak out loud with your own words about what you have just read as if you’re teaching it to someone.
Review: Review right away and review frequently. That way you’ll find it very easy to study for your tests and exams.

5. Use mnemonics to remember facts

Use acronyms. For example, use ROYGBIV to represent the colors: red orange yellow green blue indigo violet.

Try to associate numbers with syllables or related words. For example, to remember how many calories does carbohydrates contain, you can think of the number of syllables of the word car-bo-hy-drates. Then you’d know it is 4. Another example, carbohydrates starts with the word “car”. A car has four wheels. And you would remember carbohydrate has 4 calories.

If you face something hard to use the above methods. Think of a ridiculous story to connect the dots. The weirder the story, the easier to remember.

Summary:

  1. Break your studying sessions into 25-minute chunks
  2. Create a dedicated study area
  3. Study actively
  4. Use the SQ3R method to read
  5. Use mnemonics to memorize facts

Cheers,
Lok