Skip to main content

Etc


clang-format​

Installation​

sudo apt install -y clang-format-9 \
&& sudo update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-9) 1

Option​

https://clang.llvm.org/docs/ClangFormatStyleOptions.html

wget https://raw.githubusercontent.com/hhk7734/conf/master/.clang-format -O .clang-format

Usage​

clang-format -style=file -i -verbose [file]

User and Group​

User​

sudo useradd -m -s $SHELL <user>
sudo passwd <user>
sudo usermod -aG <group> <user>
sudo groups <user>
sudo visudo
# user host=(target_user:target_group)[option:] command
# %group host=(target_user:target_group)[option:] command

# ex
# hhk7734λŠ” μ ‘μ†μœ„μΉ˜μ— 관계없이, μ–΄λ–€ μœ μ €λ‚˜ 그룹의 μ†Œμœ μ— 관계없이
# ν™˜κ²½ λ³€μˆ˜λ₯Ό μœ μ§€ν•˜κ³ , μ•”ν˜Έ μž…λ ₯ 없이 λͺ¨λ“  λͺ…λ Ήμ–΄λ₯Ό sudo둜 μ‹€ν–‰ κ°€λŠ₯
# μΆ”κ°€ μœ„μΉ˜λ₯Ό λͺ¨λ₯΄λ©΄ 맨 μ•„λž«μ€„μ— μΆ”κ°€ν•˜μ‹œκΈ° λ°”λžλ‹ˆλ‹€.
# hhk7734 ALL=(ALL:ALL) NOPASSWD:SETENV: ALL
sudo userdel -r <user>

Group​

sudo groupadd <group>
sudo groupdel <group>

systemd service​

μ‹œμž‘ μ„œλΉ„μŠ€ 등둝을 μœ„ν•΄ ν•„μš” μ˜΅μ…˜λ§Œ κ³¨λΌμ„œ μ‚¬μš©ν•˜λ©΄ λ©λ‹ˆλ‹€. λ‹€μ–‘ν•œ μ˜΅μ…˜μ΄ μžˆμœΌλ―€λ‘œ ν•„μš”μ— 따라 κ²€μƒ‰ν•΄λ΄μ•Όν•©λ‹ˆλ‹€.

sudo vim /etc/systemd/system/<service_name>.service
sudo chmod +x /etc/systemd/system/<service_name>.service

<service_name>.service​

[Unit]
Description=
# 의쑴
Requires=
# μ•½ν•œ 의쑴
Wants=
# μž‘μ„± 쀑인 μ„œλΉ„μŠ€ A before B
# B 이전에 A μ‹€ν–‰
Before=
# μž‘μ„± 쀑인 μ„œλΉ„μŠ€ A after C
# C 이후에 A μ‹€ν–‰
After=
# C -> A -> B 순으둜 μ‹€ν–‰ 됨

[Service]
User=
Group=
# μ‹€ν–‰ μœ„μΉ˜
WorkingDirectory=
# ν™˜κ²½ λ³€μˆ˜
# 파이썬 κ°€μƒν™˜κ²½ μ‚¬μš© μ‹œ "PATH=κ°€μƒν™˜κ²½/bin" μΆ”κ°€
Environment=
# μ‹€ν–‰ λͺ…λ Ήμ–΄1; μ‹€ν–‰ λͺ…λ Ήμ–΄2;
# λ˜λŠ” ν•΄λ‹Ή 섀정을 μ—¬λŸ¬λ²ˆ ν•˜λ©΄ 됨
ExecStart=
ExecStop=
Restart=[no|on-success|on-failure|on-watchdog|on-abort|always]

[Install]
# μœ λ‹›μ„ λ“±λ‘ν• λ•Œ 등둝에 ν•„μš”ν•œ μœ λ‹›
WantedBy=default.target
RequiredBy=

Desktop Entry​

/usr/share/applications/example.desktop
[Desktop Entry]
Name=
Type=<Application|Link|Directory>
Comment=
Icon=
Encoding=UTF-8
Categories=<AudioVideo|Audio|Video|Development|Education|Game|Graphics|...
# Network|Office|Science|Settings|System|Utility>
Keywords=
Exec=<command>
Terminal=<false|true>