2023年8月26日 星期六

What I Learned Today (08/26/2023): Guide to Mastering Command Line and Shortcuts on Mac

Guide to Mastering Command Line and Shortcuts on Mac

Unlock the true potential of your Mac by mastering its command line interface and various keyboard shortcuts. Here's how.

Table of Contents

Check Mac Version

To check your Mac version, open the Terminal and type:

sw_vers -productVersion

Change Hostname

Change your Mac's HostName with the following commands:

  • Change HostName: sudo scutil --set HostName [nameyouwant]
  • Change temporary hostname: sudo hostname [mbpr]

Managing Applications

  • Start an application (e.g., TeamViewer): open -g -a /Applications/TeamViewer.app
  • Gracefully quit an application: osascript -e 'quit app "TeamViewer.app"'
  • Open multiple instances of VLC: /Applications/VLC.app/Contents/MacOS/VLC

User Management

For details on hiding, refer to Apple Support.

  • Disable a user: pwpolicy -u username disableuser
  • Enable a user: pwpolicy -u username enableuser
  • Hide a user from login screen: sudo dscl . create /Users/username IsHidden 1
  • Show a hidden user: sudo dscl . create /Users/username IsHidden 0

Browser Tricks

  • Add 'www' and '.com' to a URL: Press Control + Enter.
  • Reopen closed tab: ⌘ + Shift + T
  • Highlight URL bar: ⌘ + L
  • Open Incognito Mode: ⌘ + Shift + N
  • Clear cache and refresh: ⌘ + SHIFT + R

VLC Tips

  • Sync audio forward or backward: Press J or K.
  • Sync subtitles: Press H or G.

Miscellaneous Shortcuts

  • Lock screen: CMD+Ctrl+Q
  • Show dock: CMD+option+D
  • Maximize keyboard shortcut: Follow the guide in System Preferences > Keyboard settings.

Uninstalling Apps

  • 1. Go to LaunchPad.
  • 2. Drag the icon into your dock.
  • 3. Right-click on the icon and select Options > Show in Finder.
  • 4. Delete file.
  • 5. Right-click on the icon in the dock again and select Options > Remove from Dock.

Update Mac Using Terminal

  • Check for updates: softwareupdate -l
  • Install specific update: sudo softwareupdate -i 'macOS Catalina 10.15.4 Update- ' (note the space at the end)

2023年8月24日 星期四

What I Learned Today (08/25/2023): Diablo 4 Nightmare Dungeon Tiers Guide

Diablo 4 Nightmare Dungeon Tiers: A Comprehensive Guide 🎮

There is more than one difficulty for them beyond the World Tiers. When you start these dungeons, they start at Tier 1, but the overall tiers go much higher. What are Nightmare Dungeon Tiers in Diablo 4? Let's dive into the details!

What are Nightmare Dungeon Tiers in Diablo 4? 💭

There are 100 Nightmare Dungeon Tiers in Diablo 4 that all have randomized Affixes and rewards for players to collect. To reach higher Tiers, you need to bring Sigil Powder to the Occultist and increase the level of your Sigils. Below you can find all the tiers and the amount of powder needed for each level.

Tier 1 – 20 (World Tier 3) 🌍

  • Tier 1 – 5 (3 Sigil Powder)
  • Tier 6 – 10 (6 Sigil Powder)
  • Tier 11 – 15 (11 Sigil Powder)
  • Tier 16 – 20 (20 Sigil Powder)

Anything Past this point is World Tier 4.

Tier 21 – 100 (World Tier 4 and Ancestral) 🌌

  • Tier 21 – 25 (50 Sigil Powder)
  • Tier 26 – 30 (80 Sigil Powder)
  • Tier 31 – 35 (125 Sigil Powder)
  • Tier 36 – 40 (190 Sigil Powder)
  • Tier 41 – 50 (275 Sigil Powder)
  • Tier 51 – 60 (350 Sigil Powder)
  • Tier 61 – 70 (375 Sigil Powder)
  • Tier 71 – 80 (400 Sigil Powder)
  • Tier 81 – 90 (425 Sigil Powder)
  • Tier 91 – 100 (450 Sigil Powder)

Tier Level Mapping with Character Level 🗺️

Tier 1 = LV 54Tier 21 = LV 75Tier 41 = LV 95Tier 61 = LV 115Tier 81 = LV 135
Tier 2 = LV 55Tier 22 = LV 76Tier 42 = LV 96Tier 62 = LV 116Tier 82 = LV 136
Tier 3 = LV 56Tier 23 = LV 77Tier 43 = LV 97Tier 63 = LV 117Tier 83 = LV 137
Tier 4 = LV 57Tier 24 = LV 78Tier 44 = LV 98Tier 64 = LV 118Tier 84 = LV 138
Tier 19 = LV 72Tier 39 = LV 93Tier 59 = LV 113Tier 79 = LV 133Tier 99 = LV 153
Tier 20 = LV 73Tier 40 = LV 94Tier 60 = LV 114Tier 80 = LV 134Tier 100 = LV 154

The affixes also get shot up to five per dungeon once you enter the World Tier 4.

Happy gaming! 🎮 Feel free to leave your thoughts and questions in the comments section below!

What I learn today (08/24/2023): Mastering Ports, SSH, and Editor Shortcuts

🔐 Mastering Ports, SSH, and Editor Shortcuts: A Comprehensive Guide

Opening and Managing Ports

Control over your firewall and ports is crucial for security and application accessibility. Here's how you can open up a new port:

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload

To list all open ports, simply use:

firewall-cmd --list-all

Managing Users and SSH

Need to logout a user? Use this:

pkill -u username

SSH port forwarding can be handled with the following:

ssh -L port:127.0.0.1:port -l Account -N RemoteIP

SSH keys

  1. Generate SSH key pair:
  2. ssh-keygen -t rsa
  3. Add the content in id_rsa.pub to the remote server's .ssh/authorized_keys file.

Text Editor Tricks

  • Select all instances of a word: double click the word, then press ⌘ + Ctrl + G (Mac) or Alt + F3 (Windows/Linux).
  • Quick Column View: Press ⌘ (Ctrl on Windows) + Alt + 2 → 4 to open 2, 3, or 5 columns. Use 1 to return to a single column layout.
  • Vertical selection: Use alt + click + drag.

Additional Shortcuts

Bring up login screen: Ctrl+Alt+F1 or Windows + L.

By mastering these commands and shortcuts, you'll find your workflow becomes smoother and more efficient. Whether you're managing a server or editing files, these tips and tricks are essential tools for any tech professional. Happy coding! 🚀

2023年8月23日 星期三

What I Learned Today (08/23/2023): Homebrew Installation Guide 🛠️

🛠 Homebrew Installation Guide 🛠

Welcome to our official guide to installing and managing packages with Homebrew!

Official site: http://brew.sh/ 🌐

Brew Installation 📥

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Java ☕


brew tap caskroom/cask
brew install brew-cask
brew cask install java
    

Install wget 🌐

brew install wget

Install unrar 📦

brew install unrar

Install PHP mcrypt 🔐


brew install homebrew/php/php56-mcrypt
    

Search PHP module 🔍

brew search php | grep mcrypt

Install Pillow 🖼


brew install libtiff libjpeg webp little-cms2
pip install Pillow
    

2023年8月22日 星期二

What I Learned Today (08/22/2023): Docker tip!

Installation: 🛠️
CA not find error: 🚫
> unset ${!DOCKER*}

Start/Stop docker service: service docker start/stop ⏯️

Build image: docker build -t="test:latest" . 🏗️
List images: docker images 🖼️
Run a command in a new container: 🚀

  • docker run -it -p 8888:8080 -d test:latest

List containers: docker ps 📋
Connect to running docker container: docker exec -i -t "IMAGE ID" /bin/bash
Stop containers: docker stop $(docker ps -a -q) 🛑

Remove image: docker rmi "IMAGE ID" 🗑️
Remove containers: docker rm $(docker ps -a -q) 🧼
Removing all unused docker images: docker images -q |xargs docker rmi ♻️

Docker hub commands: 🌐
Push docker image:
  • docker tag 515ba39974ef test/icadl:version1
  • docker push test/icadl 📤
Recreate default env 🔄
Show docker-machine ip 🌐
  • docker-machine ip
Docker-compose command 🧩

2023年8月21日 星期一

What I Learned Today (08/21/2023): grep commands

 

🧐 Searching Within a Directory: A Handy Guide! 📂

Welcome to this quick guide! Today, we'll explore some powerful command-line tools to make your life easier. Whether you're a programmer or just someone who likes to work efficiently, these commands are sure to help you out! 🚀

🔍 Search for Files and Matched Strings

Want to find specific text within your files? Use the grep command! Here's how you can search for both files and the matched text:

Show both file and matched string:

grep -R text /home/users/workspace grep -lir text /home/users/workspace

 Show only the file:

grep -Rl text /home/users/workspace

🎵 Append a String and More! 🧩

You can do more than just search! Here are some examples of appending and manipulating strings:

  • Grep and append string (perfect for downloading! 🎉):

  • more musiclist.txt | grep ecx | sed -e 's/^/wget /'

  • Append a string to every line from the grep result (great for zipping 📦 and unzipping 🎁):
ls -a | grep "Vol_" | perl -ne 'print "zip $_"'
ls -a | grep "rar" | perl -ne 'print "unrar x $_"'

✏️ Grep and Replace String: Make Quick Changes! 🔄

Need to replace a specific string across multiple files? Here's a super handy command for that:

  • Grep and replace a string:

 grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'

grep -rl 'windows' ./ | xargs sed -i 's/windows/linux/g'

🎉 Wrapping Up

With these commands at your fingertips, you're all set to search, manipulate, and conquer your files! Whether you're a newbie or a seasoned pro, these tips can make your daily tasks a breeze. Happy coding! 🎈

If you have any questions or need further assistance, feel free to leave a comment below. Happy searching! 🔎👩‍💻👨‍💻


2023年8月20日 星期日

What I Learned Today (08/20/2023): Mac Keyboard Shortcuts Guide 🍎

 

  • Command Key: 蘋果鍵 🍏
  • Option Key: alt鍵
  • Control Key: ctrl鍵
  • Eject Key: 光碟退出鍵 ⏏️
  • Down Arrow Key: 上下左右的下鍵 ⬇️

Switching Between Programs & Windows 🔄

  • Command + Tab: Switch between different programs (forward) ➡️
  • Command + Shift + Tab: Switch between different programs (backward) ⬅️
  • Command + ` : Switch between different windows of the same program (forward) ➡️
  • Command + ~ : Switch between different windows of the same program (backward) ⬅️

Editing & File Management ✏️

  • Command + C: Copy 📋
  • Command + V: Paste 📄
  • Command + X: Cut ✂️
  • Command + N: Open new window 🖼️
  • Command + W: Close tab ❌
  • Command + Option + W: Close all tabs, but don't close the program ❌❌
  • Command + Q: Close entire program ❌🗑️
  • Command + A: Select all 📑
  • Command + F: Find 🔍
  • Command + O: Open file 📂
  • Command + S: Save file 💾
  • Command + M: Minimize 🗕
  • Command + H: Hide current program (switch back with Command + Tab) 🔍
  • Command + Option + H: Hide all windows except the current program 🔍🔍
  • Command + E: Eject on external device ⏏️
  • Command + D: Make a backup 🔄
  • Command + ↓ : Execute/run ⚙️
  • Command + Shift + A: Open applications folder in Finder 🗂️
  • Control + Eject Key: Shutdown inquiry window 🚫💻
  • Command + Option + Esc: Force quit program 🚫❌
  • Command + Option + Eject Key: Sleep 💤
  • Command + Option + Ctrl + Eject Key: Shutdown 🚫💻
  • Command + Ctrl + Power Key: Force restart ⚡
  • Command + Shift + 3: Full-screen screenshot 📷
  • Command + Shift + 4: Screenshot (select range) 📸
  • Command + Shift + 4 + Space Key: Screenshot (select application) 📸🖼️

During Boot-Up 🥾

  • Option: Choose boot disk 🎛️
  • T: Turn your Mac into an external hard drive (use Firewire to connect to another computer) 💿
  • C: Boot from CD 📀
  • Shift: Safe mode boot 🛑
  • Command + S: Single-user mode 👤

Mouse Controls 🖱️

  • Right Click: ctrl + Left Click = Right Click 🖱️
  • Two-finger touch on touch panel + Left Click: Right Click 🖱️🖱️

Happy computing! 🎉 Feel free to bookmark this page for future reference. Please let me know if there is anything that need update!