Add notes and deploy script
This commit is contained in:
17
content/notes/Android_Studio.md
Normal file
17
content/notes/Android_Studio.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title : Android Studio
|
||||
description : Notes
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
draft : true
|
||||
---
|
||||
|
||||
https://developer.android.com/studio/run/emulator-acceleration?utm_source=android-studio-app&utm_medium=app#vm-linux
|
||||
|
||||
https://developer.android.com/studio/install#linux
|
||||
|
||||
https://developer.android.com/studio
|
||||
|
||||
https://askubuntu.com/questions/298857/how-to-add-android-studio-to-the-launcher
|
||||
80
content/notes/Connect_MPI_system_over_SSH_for_Dummy.md
Normal file
80
content/notes/Connect_MPI_system_over_SSH_for_Dummy.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title: Connect MPI system over SSH for Dummy
|
||||
description: How to setup MPI system over SSH
|
||||
date: 2025-01-01
|
||||
author: Nikola Petrov
|
||||
draft: false
|
||||
---
|
||||
|
||||
1. On all computers
|
||||
```bash
|
||||
sudo apt install openssh-client
|
||||
sudo apt install openssh-server
|
||||
sudo apt install openmpi-bin libopenmpi-dev
|
||||
```
|
||||
|
||||
2. Disable firewall
|
||||
```bash
|
||||
sudo ufw status
|
||||
sudo ufw disable
|
||||
```
|
||||
|
||||
3. Try connecting master to every slave ( you will need password )
|
||||
```bash
|
||||
ssh user@ipslave1
|
||||
ssh user@ipslave2
|
||||
```
|
||||
|
||||
4. On master generate a key and put it on the slaves
|
||||
```bash
|
||||
ssh-keygen -t rsa
|
||||
|
||||
ssh-copy-id user@ipslave1
|
||||
ssh-copy-id user@ipslave2
|
||||
```
|
||||
|
||||
5. Try connecting master to every slave ( you will not need password )
|
||||
```bash
|
||||
ssh user@ipslave1
|
||||
ssh user@ipslave2
|
||||
```
|
||||
|
||||
6. Compile program
|
||||
```bash
|
||||
mpicc main.c -o main
|
||||
mpic++ main.cpp -o main
|
||||
```
|
||||
|
||||
7. Copy main in to /tmp folder for easy same location ( program needs to be in the same path on all computers )
|
||||
```bash
|
||||
cp /path/to/main /tmp/mympiprogram/
|
||||
```
|
||||
|
||||
8. Copy program to all computers
|
||||
- Could use NFS server for auto copy
|
||||
```bash
|
||||
scp <source> <destination>
|
||||
scp /tmp/mympiprogram/main user@ipslave1:/tmp/mympiprogram/main
|
||||
scp /tmp/mympiprogram/main user@ipslave2:/tmp/mympiprogram/main
|
||||
```
|
||||
|
||||
|
||||
9. Run program
|
||||
- `num < c1 + c2 + c3`
|
||||
- c1 is number of processes that can run on the computer
|
||||
- num is number of processes that are needed for the program
|
||||
```bash
|
||||
mpirun -np <num> --host 127.0.0.1:<c1>,ipslave1:<c2>,ipslave2<c3> /tmp/mympiprogram/main
|
||||
```
|
||||
|
||||
10. Enable firewall
|
||||
```bash
|
||||
sudo ufw status
|
||||
sudo ufw enable
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
40
content/notes/Firefox.md
Normal file
40
content/notes/Firefox.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title: Firefox
|
||||
description: Notes
|
||||
date: 2025-01-01
|
||||
author: Nikola Petrov
|
||||
draft: true
|
||||
---
|
||||
|
||||
Theme:
|
||||
https://github.com/soulhotel/FF-ULTIMA
|
||||
|
||||
|
||||
| Command | Shortcut |
|
||||
| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| New Tab | Ctrl + T |
|
||||
| Close Tab | Ctrl + W |
|
||||
| Close Window | Ctrl + Shift + W |
|
||||
| Exit | Ctrl + Shift + Q |
|
||||
| Go one Tab to the Left | Ctrl + Shift + Tab |
|
||||
| Go one Tab to the Right | Ctrl + Tab |
|
||||
| New [Private Window](https://support.mozilla.org/en-US/kb/private-browsing-use-firefox-without-history) | Ctrl + Shift + P |
|
||||
| Go to Tab 1 to 8 | Ctrl + 1 to 8 |
|
||||
| Go to Last Tab | Ctrl + 9 |
|
||||
| Move Tab Left | Ctrl + Shift + Page Up |
|
||||
| Move Tab Right | Ctrl + Shift + Page Down |
|
||||
| [Mute/Unmute Audio](https://support.mozilla.org/en-US/kb/mute-sound-firefox-tabs) | Ctrl + M |
|
||||
| New Window | Ctrl + N |
|
||||
| Reopen last closed tab or window | Ctrl + Shift + T <br>**Note:**Reopens last closed tab or window, in the order closed. If there aren't any tabs or windows to reopen, this command restores the previous session. |
|
||||
| Focus [Search bar](https://support.mozilla.org/en-US/kb/add-search-bar-firefox-toolbar) | Ctrl + K <br>Ctrl + E |
|
||||
| [Bookmarks](https://support.mozilla.org/en-US/kb/bookmarks-firefox) sidebar | Ctrl + B |
|
||||
| Show/hide the Bookmarks toolbar | Ctrl + Shift + B |
|
||||
| Focus Address Bar | Ctrl + L |
|
||||
|
||||
For X11 to enable swipe to back
|
||||
Add to .profile for back swipe then log out
|
||||
```
|
||||
export MOZ_USE_XINPUT2=1
|
||||
```
|
||||
47
content/notes/QimGv.md
Normal file
47
content/notes/QimGv.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title : QimGv
|
||||
description : Notes
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
draft : true
|
||||
---
|
||||
|
||||
App for photos
|
||||
https://github.com/easymodo/qimgv
|
||||
|
||||
| Action | Shortcut |
|
||||
| -------------------------- | ---------------------------------------- |
|
||||
| Next image | Right arrow / MouseWheel |
|
||||
| Previous image | Left arrow / MouseWheel |
|
||||
| Goto first image | Home |
|
||||
| Goto last image | End |
|
||||
| Zoom in | Ctrl+MouseWheel / Crtl+Up |
|
||||
| Zoom out | Ctrl+MouseWheel / Crtl+Down |
|
||||
| Zoom (alt. method) | Hold right mouse button & move up / down |
|
||||
| Fit mode: window | 1 |
|
||||
| Fit mode: width | 2 |
|
||||
| Fit mode: 1:1 (no scaling) | 3 |
|
||||
| Switch fit modes | Space |
|
||||
| Toggle fullscreen mode | DoubleClick / F / F11 |
|
||||
| Exit fullscreen mode | Esc |
|
||||
| Show EXIF panel | I |
|
||||
| Crop image | X |
|
||||
| Resize image | R |
|
||||
| Rotate left | Ctrl+L |
|
||||
| Rotate Right | Ctrl+R |
|
||||
| Open containing directory | Ctrl+D |
|
||||
| Slideshow mode | ~ |
|
||||
| Shuffle mode | Ctrl+~ |
|
||||
| Quick copy | C |
|
||||
| Quick move | M |
|
||||
| Move to trash | Delete |
|
||||
| Delete file | Shift+Delete |
|
||||
| Save | Ctrl+S |
|
||||
| Save As | Ctrl+Shift+S |
|
||||
| Folder view | Enter / Backspace |
|
||||
| Open | Ctrl+O |
|
||||
| Print / Export PDF | Ctrl+P |
|
||||
| Settings | P |
|
||||
| Exit application | Esc / Ctrl+Q / Alt+X / MiddleClick |
|
||||
38
content/notes/Tmux.md
Normal file
38
content/notes/Tmux.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title : Tmux
|
||||
description : Notes
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
draft : true
|
||||
---
|
||||
|
||||
https://www.geeksforgeeks.org/tmux-in-linux/
|
||||
|
||||
|
||||
|Key|Description|
|
||||
|---|---|
|
||||
|Ctrl+B D|It will detach from the current session.|
|
||||
|Ctrl+B %|It will split the window into two panes horizontally.|
|
||||
|Ctrl+B "|It will split the window into two panes vertically.|
|
||||
|Ctrl+B Arrow Key (Left, Right, Up, Down)|It helps in moving between panes.|
|
||||
|Ctrl+B N or P|It helps in switching the next or previous window.|
|
||||
|Ctrl+B C|It will create a new window.|
|
||||
|Ctrl+B X|It will close the pane|
|
||||
|Ctrl+B 0 (1,2...)|It will move to the particular window by number.|
|
||||
|Ctrl+B :|Enter the command line to type commands.|
|
||||
|Ctrl+B ?|It will display all key bindings.|
|
||||
|Ctrl+B W|It opens a panel to navigate across windows in multiple sessions.|
|
||||
|
||||
|
||||
```
|
||||
tmux ls
|
||||
->
|
||||
0: 1 windows (created Wed Mar 5 23:03:01 2025)
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
tmux a
|
||||
```
|
||||
28
content/notes/VSCodium.md
Normal file
28
content/notes/VSCodium.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title : VSCodium
|
||||
description : Notes
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
draft : true
|
||||
---
|
||||
https://vscodium.com/#install-on-debian-ubuntu-deb-package
|
||||
|
||||
### platform_io
|
||||
```
|
||||
sudo apt install python3-venv
|
||||
sudo usermod -a -G tty $USER
|
||||
sudo usermod -a -G dialout $USERNAME
|
||||
|
||||
```
|
||||
|
||||
#### arduino debuging
|
||||
https://www.youtube.com/watch?v=7wx27FcluMg
|
||||
|
||||
### C/C++ debuging
|
||||
```
|
||||
sudo apt install gdb
|
||||
```
|
||||
|
||||
https://rookiehpc.org/index.html
|
||||
32
content/notes/job_notes.md
Normal file
32
content/notes/job_notes.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title : Job notes
|
||||
description : Notes for job search
|
||||
date : 2026-03-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
|
||||
|
||||
##### Introduction
|
||||
Pozdravljeni,
|
||||
|
||||
sem Nikola Petrov, končujem študij Računalništvo in informacijske tehnologije in trenutno čakam na zagovor diplome.
|
||||
|
||||
Vaš oglas me je zelo pritegnil, ker me to področje še posebej zanima. Zato se z velikim interesom prijavljam na razpisano delovno mesto.
|
||||
Prav tako tudi že imam nekaj delovnih izkušenj na tem področju, kar je razvidno v priloženem CV v priponki.
|
||||
|
||||
Vesel bom vašega povabila na razgovor.
|
||||
|
||||
Lep pozdrav
|
||||
Nikola Petrov
|
||||
|
||||
##### Tell us why do you think you are the right person for this position?
|
||||
My background in computer science and hands-on experience in software development align closely with the key requirements of this position. At RRC d.o.o., I worked as a full-stack developer, where I utilized Java, JavaScript, and SQL to build and maintain robust applications and databases. My ability to quickly learn new technologies and adapt to evolving challenges allows me to contribute effectively to your team’s success.
|
||||
|
||||
##### Do you have a question for us
|
||||
Ok recimo čez eno leto ko sem že sprejet kaj bi moral jaz narediti da bi vi rekli da sem jaz bil dobra odločitev
|
||||
|
||||
##### Why company
|
||||
I prefer working on-site, and your office’s proximity to my home makes [company] an ideal fit. I’ve also heard great things about your company culture and am excited by the opportunity to contribute to your team.
|
||||
|
||||
113
content/notes/linux_utils.md
Normal file
113
content/notes/linux_utils.md
Normal file
@@ -0,0 +1,113 @@
|
||||
---
|
||||
tags:
|
||||
- General
|
||||
title : Linux utils
|
||||
description : Utils for linux
|
||||
date : 2025-01-02
|
||||
author : Nikola Petrov
|
||||
---
|
||||
|
||||
### .desktop file location
|
||||
```bash
|
||||
~/.local/share/applications
|
||||
/usr/share/applications
|
||||
```
|
||||
### nvim
|
||||
|
||||
The [Releases](https://github.com/neovim/neovim/releases) page provides pre-built binaries for Linux systems.
|
||||
|
||||
```bash
|
||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
||||
sudo rm -rf /opt/nvim
|
||||
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
||||
```
|
||||
|
||||
After this step add this to `~/.bashrc`:
|
||||
```bash
|
||||
export PATH="$PATH:/opt/nvim-linux64/bin"
|
||||
```
|
||||
For sudo acces
|
||||
```bash
|
||||
sudo ln -s /opt/nvim-linux64/bin/nvim /usr/bin/
|
||||
```
|
||||
|
||||
### Open default file explorer
|
||||
```bash
|
||||
xdg-open .
|
||||
```
|
||||
|
||||
### See memory usage
|
||||
```bash
|
||||
htop
|
||||
```
|
||||
|
||||
### Find
|
||||
```bash
|
||||
find -name <file_name> # Search files by name
|
||||
find -type d -name <file_name> # Search directory name
|
||||
```
|
||||
|
||||
### To upgrade all
|
||||
```bash
|
||||
sudo apt-get upgrade
|
||||
```
|
||||
|
||||
### zoxide better cd
|
||||
https://github.com/ajeetdsouza/zoxide
|
||||
### git
|
||||
```bash
|
||||
git config --global user.name "Nikola Petrov"
|
||||
git config --global user.email "nikola@petrovv.com"
|
||||
```
|
||||
|
||||
### ffmpeg convert JPG to video
|
||||
```bash
|
||||
ffmpeg -framerate 30 -pattern_type glob -i '*.JPG' -c:v libx264 -pix_fmt yuv420p -s 1920x1080 -r 30 video.mp4
|
||||
```
|
||||
|
||||
### tmux
|
||||
https://github.com/tmux/tmux/wiki/Installing
|
||||
|
||||
### Gparted
|
||||
for formating disks
|
||||
|
||||
### rfm-bin
|
||||
https://github.com/dsxmachina/rfm
|
||||
|
||||
https://github.com/sharkdp/bat
|
||||
|
||||
### PopOS 22 to disable appstore auto start up and save 0,5 GB ram
|
||||
|
||||
```bash
|
||||
sudo dpkg-divert --divert "/etc/xdg/autostart/io.elementary.appcenter-daemon.desktop.~ram~" --rename "/etc/xdg/autostart/io.elementary.appcenter-daemon.desktop"
|
||||
```
|
||||
|
||||
### Gnome to change back ground img size to zoom
|
||||
```bash
|
||||
sudo apt install gnome-tweaks
|
||||
```
|
||||
Appearance -> Background Adjusment -> Scaled
|
||||
|
||||
### PopOS 22 Mouse pad right click
|
||||
Enable in settings -> Mouse & Touchpad -> Touchpad Click Options -> Second option
|
||||
|
||||
### AudioControll
|
||||
```bash
|
||||
sudo apt install pavucontrol
|
||||
```
|
||||
|
||||
### .tar
|
||||
```bash
|
||||
tar -cf archive_name.tar /path/to/dir
|
||||
tar -xf archive_name.tar
|
||||
```
|
||||
### .tar.gz
|
||||
```bash
|
||||
tar -czf archive_name.tar.gz /path/to/dir
|
||||
tar -xzf yourfile.tar.gz
|
||||
```
|
||||
|
||||
### sync two dirs
|
||||
```
|
||||
unison /path/to/dir/one /path/to/dir/two
|
||||
```
|
||||
66
content/notes/server/Caddy.md
Normal file
66
content/notes/server/Caddy.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Caddy
|
||||
description : Caddy
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
|
||||
https://caddyserver.com/docs/
|
||||
|
||||
### Install
|
||||
```
|
||||
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
sudo apt update
|
||||
sudo apt install caddy
|
||||
```
|
||||
|
||||
### Change privilege to access port 80 and 443
|
||||
```
|
||||
sudo setcap cap_net_bind_service=+ep $(which caddy)
|
||||
```
|
||||
|
||||
### Caddyfile
|
||||
|
||||
/etc/caddy/Caddyfile
|
||||
|
||||
```
|
||||
petrovv.com {
|
||||
reverse_proxy * 0.0.0.0:4080
|
||||
}
|
||||
lang.petrovv.com {
|
||||
reverse_proxy * 0.0.0.0:8010
|
||||
}
|
||||
vault.petrovv.com {
|
||||
reverse_proxy * 0.0.0.0:6080
|
||||
}
|
||||
git.petrovv.com {
|
||||
reverse_proxy * 0.0.0.0:3000
|
||||
}
|
||||
game.petrovv.com {
|
||||
reverse_proxy * 0.0.0.0:8080
|
||||
}
|
||||
rss.petrovv.com {
|
||||
reverse_proxy * 0.0.0.0:8082
|
||||
}
|
||||
files.petrovv.com {
|
||||
root * /srv
|
||||
file_server browse
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### comands
|
||||
|
||||
```
|
||||
caddy start
|
||||
caddy stop
|
||||
caddy reload
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
63
content/notes/server/Containers.md
Normal file
63
content/notes/server/Containers.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Containers
|
||||
description : containers on my server
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
## languagetool
|
||||
|
||||
```sh
|
||||
podman pull docker.io/erikvl87/languagetool:latest
|
||||
|
||||
podman run --restart=always -d -p 8010:8010 --name languagetool-cont docker.io/erikvl87/languagetool
|
||||
```
|
||||
|
||||
|
||||
```ini
|
||||
#/etc/containers/systemd/languagetool.container
|
||||
[Unit]
|
||||
Description=LanguageTool Container
|
||||
After=network.target
|
||||
|
||||
[Container]
|
||||
Image=docker.io/erikvl87/languagetool
|
||||
Name=languagetool-cont
|
||||
PublishPort=8010:8010
|
||||
Environment=Java_Xms=512m
|
||||
Environment=Java_Xmx=2g
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
```
|
||||
## vaultwarden
|
||||
```sh
|
||||
podman pull docker.io/vaultwarden/server:latest
|
||||
|
||||
podman run -d --restart=always -e SIGNUPS_ALLOWED=false -v /root/vaultwarden/:/data/ -p 6080:80 --name vaultwarden-cont vaultwarden/server:latest
|
||||
```
|
||||
|
||||
|
||||
```ini
|
||||
#/etc/containers/systemd/vaultwarden.container
|
||||
[Unit]
|
||||
Description=Vaultwarden (Bitwarden-Compatible Server)
|
||||
After=network.target
|
||||
|
||||
[Container]
|
||||
Image=vaultwarden/server:latest
|
||||
Name=vaultwarden-cont
|
||||
PublishPort=6080:80
|
||||
Volume=/root/vaultwarden/:/data
|
||||
Environment=SIGNUPS_ALLOWED=false
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
|
||||
## CALENDAR
|
||||
|
||||
80
content/notes/server/Nginx.md
Normal file
80
content/notes/server/Nginx.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Nginx
|
||||
description : Nginx
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
|
||||
### Install
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install nginx
|
||||
```
|
||||
|
||||
### Test config
|
||||
```
|
||||
sudo nginx -t
|
||||
```
|
||||
|
||||
### Config location
|
||||
```
|
||||
/etc/nginx
|
||||
```
|
||||
|
||||
### Restart
|
||||
```
|
||||
sudo service nginx restart
|
||||
```
|
||||
|
||||
### Template for reverse proxy
|
||||
```
|
||||
server{
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## For auto ssl/https
|
||||
|
||||
- Install snapstore
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install snapd
|
||||
```
|
||||
|
||||
- remove old certbot
|
||||
```
|
||||
sudo apt-get remove certbot
|
||||
```
|
||||
|
||||
- Install certbot
|
||||
```
|
||||
sudo snap install --classic certbot
|
||||
```
|
||||
|
||||
- Link command to /usr/bin
|
||||
```
|
||||
sudo ln -s /snap/bin/certbot /usr/bin/certbot
|
||||
```
|
||||
|
||||
- Get and install cert
|
||||
```
|
||||
sudo certbot --nginx
|
||||
```
|
||||
|
||||
- Test auto renewal
|
||||
```
|
||||
sudo certbot renew --dry-run
|
||||
```
|
||||
|
||||
|
||||
20
content/notes/server/RSS.md
Normal file
20
content/notes/server/RSS.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Commafeed
|
||||
description : Commafeed
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
|
||||
https://www.commafeed.com/#/welcome
|
||||
|
||||
config
|
||||
```
|
||||
commafeed.http-client.max-response-size=10M
|
||||
commafeed.feed-refresh.max-interval=24H
|
||||
commafeed.feed-refresh.force-refresh-cooldown-duration=10S
|
||||
commafeed.database.cleanup.entries-max-age=0
|
||||
commafeed.database.cleanup.max-feed-capacity=0
|
||||
|
||||
```
|
||||
77
content/notes/server/Server.md
Normal file
77
content/notes/server/Server.md
Normal file
@@ -0,0 +1,77 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Server notes
|
||||
description : Server notes
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
|
||||
## To prevent updating of a specific package?
|
||||
Hold a package:
|
||||
|
||||
sudo apt-mark hold <package-name>
|
||||
|
||||
Remove the hold:
|
||||
|
||||
sudo apt-mark unhold <package-name>
|
||||
|
||||
Show all packages on hold:
|
||||
|
||||
sudo apt-mark showhold
|
||||
|
||||
|
||||
### USE APT PURGE TO REMOVE APPS
|
||||
|
||||
## Dynamic DNS
|
||||
DDClient [YouTube](https://www.youtube.com/watch?v=iuDCuUEmKF4) [NameCheap](https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/how-do-i-configure-ddclient/)
|
||||
|
||||
Install & Setup Instructions:
|
||||
sudo apt-get install ddclient
|
||||
sudo nano /etc/ddclient.conf
|
||||
daemon=3600
|
||||
ssl=yes
|
||||
protocol=dyndns2
|
||||
use=web, web=myip.dnsomatic.com
|
||||
server=updates.dnsomatic.com
|
||||
login=Your OpenDNS login
|
||||
password=Your OpenDNS Password
|
||||
all.dnsomatic.com
|
||||
|
||||
sudo nano /etc/default/ddclient
|
||||
run_ipup="false"
|
||||
run_daemon="true"
|
||||
daemon_interval=3600
|
||||
|
||||
To run it initially: sudo ddclient -daemon=0 -debug -verbose -noquiet
|
||||
|
||||
## Shutdown
|
||||
```
|
||||
systemctl reboot
|
||||
systemctl poweroff
|
||||
```
|
||||
|
||||
## Raid
|
||||
https://linuxconfig.org/linux-software-raid-1-setup
|
||||
|
||||
## ssh
|
||||
in `~/.ssh/authorized_keys` paste your pub key
|
||||
and then disable password login in `/etc/ssh/sshd_config` change `PasswordAuthentication`
|
||||
to `no`
|
||||
|
||||
```
|
||||
ssh-keygen -t ed25519
|
||||
systemctl reload sshd
|
||||
```
|
||||
|
||||
|
||||
## Network monitor tool
|
||||
`vnstat --help`
|
||||
|
||||
## python venv in debian
|
||||
```sh
|
||||
sudo apt install -y python3-full python3-pip
|
||||
python -m venv venv
|
||||
```
|
||||
|
||||
|
||||
132
content/notes/server/Systemctl.md
Normal file
132
content/notes/server/Systemctl.md
Normal file
@@ -0,0 +1,132 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Systemctl tutorial
|
||||
description : Systemctl
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
|
||||
Copy of https://bun.com/docs/guides/ecosystem/systemd
|
||||
|
||||
[systemd](https://systemd.io) is an init system and service manager for Linux operating systems that manages the startup and control of system processes and services.
|
||||
|
||||
<!-- systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and auto mount points, and implements an elaborate transactional dependency-based service control logic. systemd supports SysV and LSB init scripts and works as a replacement for sysvinit. -->
|
||||
|
||||
<!-- Other parts include a logging daemon, utilities to control basic system configuration like the hostname, date, locale, maintain a list of logged-in users and running containers and virtual machines, system accounts, runtime directories and settings, and daemons to manage simple network configuration, network time synchronization, log forwarding, and name resolution. -->
|
||||
|
||||
---
|
||||
|
||||
To run a Bun application as a daemon using **systemd** you'll need to create a _service file_ in `/etc/systemd/system/`.
|
||||
|
||||
```sh
|
||||
$ cd /etc/systemd/system
|
||||
$ touch my-app.service
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Here is a typical service file that runs an application on system start. You can use this as a template for your own service. Replace `YOUR_USER` with the name of the user you want to run the application as. To run as `root`, replace `YOUR_USER` with `root`, though this is generally not recommended for security reasons.
|
||||
|
||||
Refer to the [systemd documentation](https://www.freedesktop.org/software/systemd/man/systemd.service.html) for more information on each setting.
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
# describe the app
|
||||
Description=My App
|
||||
# start the app after the network is available
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
# usually you'll use 'simple'
|
||||
# one of https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=
|
||||
Type=simple
|
||||
# which user to use when starting the app
|
||||
User=YOUR_USER
|
||||
# path to your application's root directory
|
||||
WorkingDirectory=/home/YOUR_USER/path/to/my-app
|
||||
# the command to start the app
|
||||
# requires absolute paths
|
||||
ExecStart=/home/YOUR_USER/.bun/bin/bun run index.ts
|
||||
# restart policy
|
||||
# one of {no|on-success|on-failure|on-abnormal|on-watchdog|on-abort|always}
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
# start the app automatically
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
If your application starts a webserver, note that non-`root` users are not able to listen on ports 80 or 443 by default. To permanently allow Bun to listen on these ports when executed by a non-`root` user, use the following command. This step isn't necessary when running as `root`.
|
||||
|
||||
```bash
|
||||
$ sudo setcap CAP_NET_BIND_SERVICE=+eip ~/.bun/bin/bun
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
With the service file configured, you can now _enable_ the service. Once enabled, it will start automatically on reboot. This requires `sudo` permissions.
|
||||
|
||||
```bash
|
||||
$ sudo systemctl enable my-app
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
To start the service without rebooting, you can manually _start_ it.
|
||||
|
||||
```bash
|
||||
$ sudo systemctl start my-app
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Check the status of your application with `systemctl status`. If you've started your app successfully, you should see something like this:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl status my-app
|
||||
● my-app.service - My App
|
||||
Loaded: loaded (/lib/systemd/system/my-app.service; enabled; preset: enabled)
|
||||
Active: active (running) since Thu 2023-10-12 11:34:08 UTC; 1h 8min ago
|
||||
Main PID: 309641 (bun)
|
||||
Tasks: 3 (limit: 503)
|
||||
Memory: 40.9M
|
||||
CPU: 1.093s
|
||||
CGroup: /system.slice/my-app.service
|
||||
└─309641 /home/YOUR_USER/.bun/bin/bun run /home/YOUR_USER/application/index.ts
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
To update the service, edit the contents of the service file, then reload the daemon.
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
For a complete guide on the service unit configuration, you can check [this page](https://www.freedesktop.org/software/systemd/man/systemd.service.html). Or refer to this cheatsheet of common commands:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl daemon-reload # tell systemd that some files got changed
|
||||
$ sudo systemctl enable my-app # enable the app (to allow auto-start)
|
||||
$ sudo systemctl disable my-app # disable the app (turns off auto-start)
|
||||
$ sudo systemctl start my-app # start the app if is stopped
|
||||
$ sudo systemctl stop my-app # stop the app
|
||||
$ sudo systemctl restart my-app # restart the app
|
||||
```
|
||||
|
||||
|
||||
|
||||
## See logs
|
||||
https://www.linode.com/docs/guides/how-to-use-journalctl/
|
||||
https://www.loggly.com/ultimate-guide/using-journalctl/
|
||||
```
|
||||
sudo journalctl -u my-app.service
|
||||
journalctl --vacuum-time=2d // clear
|
||||
journalctl --since "1 hour ago" -u my-app.service
|
||||
journalctl -u my-app.service -n 100 // last 100
|
||||
```
|
||||
8
content/notes/server/_index.md
Normal file
8
content/notes/server/_index.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Server
|
||||
description : Server notes
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
9
content/notes/server/gitea.md
Normal file
9
content/notes/server/gitea.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Gitea
|
||||
description : Gitea
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
https://docs.gitea.com/installation/install-from-binary
|
||||
29
content/notes/server/podman.md
Normal file
29
content/notes/server/podman.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
tags:
|
||||
- Server
|
||||
title : Podman
|
||||
description : Podman
|
||||
date : 2025-01-01
|
||||
author : Nikola Petrov
|
||||
---
|
||||
https://podman.io/docs/installation
|
||||
|
||||
### install
|
||||
```
|
||||
sudo apt-get -y install podman
|
||||
```
|
||||
|
||||
https://docs.podman.io/en/latest/
|
||||
|
||||
https://github.com/containers/podman/blob/main/docs/tutorials/podman_tutorial.md
|
||||
|
||||
|
||||
sudo podman ps -a
|
||||
sudo podman container ls
|
||||
sudo podman ps
|
||||
sudo podman container rm
|
||||
sudo podman image ls
|
||||
sudo podman image rm
|
||||
|
||||
|
||||
https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html
|
||||
@@ -1,58 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
title = "Emoji Support"
|
||||
date = "2023-07-07"
|
||||
description = "Guide to emoji usage in Hugo"
|
||||
tags = [
|
||||
"hugo",
|
||||
"markdown",
|
||||
"emoji",
|
||||
]
|
||||
categories = [
|
||||
"syntax",
|
||||
"theme demo",
|
||||
]
|
||||
series = ["Theme Demo"]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
Emoji can be enabled in a Hugo project in a number of ways.
|
||||
|
||||
<!--more-->
|
||||
|
||||
The [`emojify`](https://gohugo.io/functions/emojify/) function can be called directly in templates or [Inline Shortcodes](https://gohugo.io/templates/shortcode-templates/#inline-shortcodes).
|
||||
|
||||
To enable emoji globally, set `enableEmoji` to `true` in your site's [configuration](https://gohugo.io/getting-started/configuration/) and then you can type emoji shorthand codes directly in content files; e.g.
|
||||
|
||||
<p><span class="nowrap"><span class="emojify">🙈</span> <code>:see_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙉</span> <code>:hear_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙊</span> <code>:speak_no_evil:</code></span></p>
|
||||
<br>
|
||||
|
||||
The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference for emoji shorthand codes.
|
||||
|
||||
---
|
||||
|
||||
**N.B.** The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack; e.g.
|
||||
|
||||
{{< highlight html >}}
|
||||
.emoji {
|
||||
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
|
||||
}
|
||||
{{< /highlight >}}
|
||||
|
||||
{{< css.inline >}}
|
||||
|
||||
<style>
|
||||
.emojify {
|
||||
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
|
||||
font-size: 2rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@media screen and (max-width:650px) {
|
||||
.nowrap {
|
||||
display: block;
|
||||
margin: 25px 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
{{< /css.inline >}}
|
||||
@@ -1,11 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
date = "2023-07-06"
|
||||
title = "External Page: Hugo Coder Wiki"
|
||||
slug = "hugo-coder-wiki"
|
||||
tags = [
|
||||
"hugo"
|
||||
]
|
||||
externalLink = "https://github.com/luizdepra/hugo-coder/wiki"
|
||||
draft = true
|
||||
+++
|
||||
@@ -1,135 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
title = "HTML and CSS only tabs"
|
||||
date = "2023-07-09"
|
||||
description = "Sample article showcasing shortcodes for HTML/CSS only tabs"
|
||||
tags = [
|
||||
"hugo",
|
||||
"markdown",
|
||||
"css",
|
||||
"html",
|
||||
"shortcodes",
|
||||
]
|
||||
categories = [
|
||||
"theme demo",
|
||||
"syntax",
|
||||
]
|
||||
series = ["Theme Demo"]
|
||||
aliases = ["migrate-from-jekyl"]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
## Shortcodes
|
||||
|
||||
The following content:
|
||||
|
||||
```markdown
|
||||
{{</* tabgroup */>}}
|
||||
{{</* tab name="Hello" */>}}
|
||||
Hello World!
|
||||
{{</* /tab */>}}
|
||||
|
||||
{{</* tab name="Goodbye" */>}}
|
||||
Goodbye Everybody!
|
||||
{{</* /tab */>}}
|
||||
{{</* /tabgroup */>}}
|
||||
```
|
||||
|
||||
Will generate:
|
||||
|
||||
{{< tabgroup >}}
|
||||
{{< tab name="Hello" >}}
|
||||
Hello World!
|
||||
{{< /tab >}}
|
||||
|
||||
{{< tab name="Goodbye" >}}
|
||||
Goodbye Everybody!
|
||||
{{< /tab >}}
|
||||
{{< /tabgroup >}}
|
||||
|
||||
## Right alignment
|
||||
|
||||
You can also align the tabs to the right:
|
||||
|
||||
```markdown
|
||||
{{</* tabgroup align="right" */>}}
|
||||
{{</* tab name="Hello" */>}}
|
||||
Hello World!
|
||||
{{</* /tab */>}}
|
||||
|
||||
{{</* tab name="Goodbye" */>}}
|
||||
Goodbye Everybody!
|
||||
{{</* /tab */>}}
|
||||
{{</* /tabgroup */>}}
|
||||
```
|
||||
|
||||
Giving you this look:
|
||||
|
||||
{{< tabgroup align="right" >}}
|
||||
{{< tab name="Hello" >}}
|
||||
Hello World!
|
||||
{{< /tab >}}
|
||||
|
||||
{{< tab name="Goodbye" >}}
|
||||
Goodbye Everybody!
|
||||
{{< /tab >}}
|
||||
{{< /tabgroup >}}
|
||||
|
||||
## Markdown content
|
||||
|
||||
Any valid markdown can be used inside the tab:
|
||||
|
||||
````markdown
|
||||
{{</* tabgroup align="right" style="code" */>}}
|
||||
{{</* tab name="Ruby" */>}}
|
||||
|
||||
```ruby
|
||||
puts 'Hello'
|
||||
```
|
||||
|
||||
{{</* /tab */>}}
|
||||
{{</* tab name="Python" */>}}
|
||||
|
||||
```python
|
||||
print('Hello')
|
||||
```
|
||||
|
||||
{{</* /tab */>}}
|
||||
{{</* tab name="JavaScript" */>}}
|
||||
|
||||
```js
|
||||
console.log("Hello");
|
||||
```
|
||||
|
||||
{{</* /tab */>}}
|
||||
{{</* /tabgroup */>}}
|
||||
````
|
||||
|
||||
And you get this lovely content:
|
||||
|
||||
{{< tabgroup align="right" style="code" >}}
|
||||
{{< tab name="Ruby" >}}
|
||||
|
||||
```ruby
|
||||
puts 'Hello'
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< tab name="Python" >}}
|
||||
|
||||
```python
|
||||
print('Hello')
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< tab name="JavaScript" >}}
|
||||
|
||||
```js
|
||||
console.log("Hello");
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< /tabgroup >}}
|
||||
|
||||
In this case `style="code"` makes it look a little nicer for scenarios where
|
||||
your content is purely a code block.
|
||||
@@ -1,169 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
title = "Markdown Syntax Guide"
|
||||
date = "2023-07-13"
|
||||
description = "Sample article showcasing basic Markdown syntax and formatting for HTML elements."
|
||||
tags = [
|
||||
"hugo",
|
||||
"markdown",
|
||||
"css",
|
||||
"html",
|
||||
]
|
||||
categories = [
|
||||
"theme demo",
|
||||
"syntax",
|
||||
]
|
||||
series = ["Theme Demo"]
|
||||
aliases = ["migrate-from-jekyl"]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## Headings
|
||||
|
||||
The following HTML `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest.
|
||||
|
||||
# H1
|
||||
|
||||
## H2
|
||||
|
||||
### H3
|
||||
|
||||
#### H4
|
||||
|
||||
##### H5
|
||||
|
||||
###### H6
|
||||
|
||||
## Paragraph
|
||||
|
||||
Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.
|
||||
|
||||
Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.
|
||||
|
||||
## Links
|
||||
|
||||
This is a [internal link](/posts/emoji-support) to another page. [This one](https://www.gohugo.io) points to a external page nad will be open in a new tag.
|
||||
|
||||
## Blockquotes
|
||||
|
||||
The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations.
|
||||
|
||||
#### Blockquote without attribution
|
||||
|
||||
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
|
||||
> **Note** that you can use _Markdown syntax_ within a blockquote.
|
||||
|
||||
#### Blockquote with attribution
|
||||
|
||||
> Don't communicate by sharing memory, share memory by communicating.<br>
|
||||
> — <cite>Rob Pike[^1]</cite>
|
||||
|
||||
## Tables
|
||||
|
||||
Tables aren't part of the core Markdown spec, but Hugo supports them out-of-the-box.
|
||||
|
||||
| Name | Age |
|
||||
| ----- | --- |
|
||||
| Bob | 27 |
|
||||
| Alice | 23 |
|
||||
|
||||
#### Inline Markdown within tables
|
||||
|
||||
| Italics | Bold | Code |
|
||||
| --------- | -------- | ------ |
|
||||
| _italics_ | **bold** | `code` |
|
||||
|
||||
## Code Blocks
|
||||
|
||||
#### Code block with backticks
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Example HTML5 Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
#### Code block indented with four spaces
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Example HTML5 Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
#### Code block with Hugo's internal highlight shortcode
|
||||
|
||||
{{< highlight html >}}
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Example HTML5 Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test</p>
|
||||
</body>
|
||||
</html>
|
||||
{{< /highlight >}}
|
||||
|
||||
## List Types
|
||||
|
||||
#### Ordered List
|
||||
|
||||
1. First item
|
||||
2. Second item
|
||||
3. Third item
|
||||
|
||||
#### Unordered List
|
||||
|
||||
- List item
|
||||
- Another item
|
||||
- And another item
|
||||
|
||||
#### Nested list
|
||||
|
||||
- Fruit
|
||||
- Apple
|
||||
- Orange
|
||||
- Banana
|
||||
- Dairy
|
||||
- Milk
|
||||
- Cheese
|
||||
|
||||
#### Foot Notes
|
||||
|
||||
Check it[^2] at the end[^3] of this text[^4].
|
||||
|
||||
## Other Elements — abbr, sub, sup, kbd, mark
|
||||
|
||||
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.
|
||||
|
||||
H<sub>2</sub>O
|
||||
|
||||
X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
|
||||
|
||||
Press <kbd><kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd></kbd> to end the session.
|
||||
|
||||
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
||||
|
||||
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
|
||||
[^2]: A footnote.
|
||||
[^3]: Another one.
|
||||
[^4]: Cool, right?
|
||||
@@ -1,65 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
title = "Math Typesetting"
|
||||
date = "2023-07-10"
|
||||
description = "A brief guide to setup KaTeX"
|
||||
math = true
|
||||
tags = [
|
||||
"hugo",
|
||||
"markdown",
|
||||
"css",
|
||||
"html",
|
||||
]
|
||||
categories = [
|
||||
"theme demo",
|
||||
"syntax",
|
||||
]
|
||||
series = ["Theme Demo"]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.
|
||||
|
||||
<!--more-->
|
||||
|
||||
In this example we will be using [KaTeX](https://katex.org/)
|
||||
|
||||
- Create a partial under `/layouts/partials/math.html`
|
||||
- Within this partial reference the [Auto-render Extension](https://katex.org/docs/autorender.html) or host these scripts locally.
|
||||
- Include the partial in your templates like so:
|
||||
|
||||
```bash
|
||||
{{ if or .Params.math .Site.Params.math }}
|
||||
{{ partial "math.html" . }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
- To enable KaTeX globally set the parameter `math` to `true` in a project's configuration
|
||||
- To enable KaTeX on a per page basis include the parameter `math: true` in content files
|
||||
|
||||
**Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html)
|
||||
|
||||
{{< math.inline >}}
|
||||
{{ if or .Page.Params.math .Site.Params.math }}
|
||||
|
||||
<!-- KaTeX -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
|
||||
{{ end }}
|
||||
{{</ math.inline >}}
|
||||
|
||||
### Examples
|
||||
|
||||
{{< math.inline >}}
|
||||
|
||||
<p>
|
||||
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
|
||||
</p>
|
||||
{{</ math.inline >}}
|
||||
|
||||
Block math:
|
||||
|
||||
$$
|
||||
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
|
||||
$$
|
||||
@@ -1,44 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
date = "2023-07-08"
|
||||
title = "Mermaid JS support"
|
||||
description = "The post demonstrates Mermaid JS support"
|
||||
tags = [
|
||||
"hugo",
|
||||
"markdown",
|
||||
"css",
|
||||
"html",
|
||||
]
|
||||
categories = [
|
||||
"theme demo",
|
||||
"syntax",
|
||||
]
|
||||
series = ["Theme Demo"]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
If you want to use [Mermaid-JS](https://mermaid-js.github.io/mermaid/#/) on your website.
|
||||
Provide `mermaid` as [Shortcode](https://gohugo.io/content-management/shortcodes/#readout) in your markdown file.
|
||||
|
||||
{{<mermaid>}}
|
||||
flowchart LR
|
||||
|
||||
A --> B
|
||||
|
||||
B --> C
|
||||
|
||||
C --> D
|
||||
|
||||
D --> B
|
||||
|
||||
{{</mermaid>}}
|
||||
|
||||
{{<mermaid>}}
|
||||
sequenceDiagram
|
||||
participant Alice
|
||||
participant Bob
|
||||
Alice->>Bob: Hi Bob
|
||||
Bob->>Alice: Hi Alice
|
||||
{{</mermaid>}}
|
||||
|
||||
Find more example on [Mermaid-JS](https://mermaid-js.github.io/mermaid/#/) website.
|
||||
@@ -1,53 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
title = "More Rich Content"
|
||||
date = "2023-07-11"
|
||||
description = "A brief description about Hugo Coder's Custom Shortcodes"
|
||||
tags = [
|
||||
"hugo",
|
||||
"markdown",
|
||||
"css",
|
||||
"html",
|
||||
"shortcodes",
|
||||
]
|
||||
categories = [
|
||||
"theme demo",
|
||||
"syntax",
|
||||
]
|
||||
series = ["Theme Demo"]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
Hugo Coder provides some Custom Shortcodes.
|
||||
|
||||
## <!--more-->
|
||||
|
||||
## Shortcodes Avisos
|
||||
|
||||
{{< notice note >}}
|
||||
One note here.
|
||||
{{< /notice >}}
|
||||
|
||||
{{< notice tip >}}
|
||||
I'm giving a tip about something.
|
||||
{{< /notice >}}
|
||||
|
||||
{{< notice example >}}
|
||||
This is an example.
|
||||
{{< /notice >}}
|
||||
|
||||
{{< notice question >}}
|
||||
Is this a question?
|
||||
{{< /notice >}}
|
||||
|
||||
{{< notice info >}}
|
||||
Notice that this box contain information.
|
||||
{{< /notice >}}
|
||||
|
||||
{{< notice warning >}}
|
||||
This is the last warning!
|
||||
{{< /notice >}}
|
||||
|
||||
{{< notice error >}}
|
||||
There is an error in your code.
|
||||
{{< /notice >}}
|
||||
@@ -1,48 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
title = "Placeholder Text"
|
||||
date = "2023-07-05"
|
||||
description = "Lorem Ipsum Dolor Si Amet"
|
||||
tags = [
|
||||
"markdown",
|
||||
"text",
|
||||
]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
Lorem est tota propiore conpellat pectoribus de pectora summo. <!--more-->Redit teque digerit hominumque toris verebor lumina non cervice subde tollit usus habet Arctonque, furores quas nec ferunt. Quoque montibus nunc caluere tempus inhospita parcite confusaque translucet patri vestro qui optatis lumine cognoscere flos nubis! Fronde ipsamque patulos Dryopen deorum.
|
||||
|
||||
1. Exierant elisi ambit vivere dedere
|
||||
2. Duce pollice
|
||||
3. Eris modo
|
||||
4. Spargitque ferrea quos palude
|
||||
|
||||
Rursus nulli murmur; hastile inridet ut ab gravi sententia! Nomine potitus silentia flumen, sustinet placuit petis in dilapsa erat sunt. Atria tractus malis.
|
||||
|
||||
1. Comas hunc haec pietate fetum procerum dixit
|
||||
2. Post torum vates letum Tiresia
|
||||
3. Flumen querellas
|
||||
4. Arcanaque montibus omnes
|
||||
5. Quidem et
|
||||
|
||||
# Vagus elidunt
|
||||
|
||||
<svg class="canon" xmlns="http://www.w3.org/2000/svg" overflow="visible" viewBox="0 0 496 373" height="373" width="496"><g fill="none"><path stroke="#000" stroke-width=".75" d="M.599 372.348L495.263 1.206M.312.633l494.95 370.853M.312 372.633L247.643.92M248.502.92l246.76 370.566M330.828 123.869V1.134M330.396 1.134L165.104 124.515"></path><path stroke="#ED1C24" stroke-width=".75" d="M275.73 41.616h166.224v249.05H275.73zM54.478 41.616h166.225v249.052H54.478z"></path><path stroke="#000" stroke-width=".75" d="M.479.375h495v372h-495zM247.979.875v372"></path><ellipse cx="498.729" cy="177.625" rx=".75" ry="1.25"></ellipse><ellipse cx="247.229" cy="377.375" rx=".75" ry="1.25"></ellipse></g></svg>
|
||||
|
||||
[The Van de Graaf Canon](https://en.wikipedia.org/wiki/Canons_of_page_construction#Van_de_Graaf_canon)
|
||||
|
||||
## Mane refeci capiebant unda mulcebat
|
||||
|
||||
Victa caducifer, malo vulnere contra dicere aurato, ludit regale, voca! Retorsit colit est profanae esse virescere furit nec; iaculi matertera et visa est, viribus. Divesque creatis, tecta novat collumque vulnus est, parvas. **Faces illo pepulere** tempus adest. Tendit flamma, ab opes virum sustinet, sidus sequendo urbis.
|
||||
|
||||
Iubar proles corpore raptos vero auctor imperium; sed et huic: manus caeli Lelegas tu lux. Verbis obstitit intus oblectamina fixis linguisque ausus sperare Echionides cornuaque tenent clausit possit. Omnia putatur. Praeteritae refert ausus; ferebant e primus lora nutat, vici quae mea ipse. Et iter nil spectatae vulnus haerentia iuste et exercebat, sui et.
|
||||
|
||||
Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel **mitis temploque** vocatus, inque alis, _oculos nomen_ non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides **parte**.
|
||||
|
||||
{{< css.inline >}}
|
||||
|
||||
<style>
|
||||
.canon { background: white; width: 100%; height: auto; }
|
||||
</style>
|
||||
|
||||
{{< /css.inline >}}
|
||||
@@ -1,43 +0,0 @@
|
||||
+++
|
||||
authors = ["Lone Coder"]
|
||||
title = "Rich Content"
|
||||
date = "2023-07-12"
|
||||
description = "A brief description of Hugo Shortcodes"
|
||||
tags = [
|
||||
"hugo",
|
||||
"markdown",
|
||||
"css",
|
||||
"html",
|
||||
"shortcodes",
|
||||
]
|
||||
categories = [
|
||||
"theme demo",
|
||||
"syntax",
|
||||
]
|
||||
series = ["Theme Demo"]
|
||||
draft = true
|
||||
+++
|
||||
|
||||
Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugos-built-in-shortcodes) for rich content, along with a [Privacy Config](https://gohugo.io/about/hugo-and-gdpr/) and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds.
|
||||
|
||||
## <!--more-->
|
||||
|
||||
## YouTube Privacy Enhanced Shortcode
|
||||
|
||||
{{< youtube ZJthWmvUzzc >}}
|
||||
|
||||
<br>
|
||||
|
||||
---
|
||||
|
||||
## Twitter Shortcode
|
||||
|
||||
{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
|
||||
|
||||
<br>
|
||||
|
||||
---
|
||||
|
||||
## Vimeo Simple Shortcode
|
||||
|
||||
{{< vimeo_simple 48912912 >}}
|
||||
@@ -1,8 +0,0 @@
|
||||
+++
|
||||
title = "demo"
|
||||
slug = "projects"
|
||||
date = "2023-07-07"
|
||||
draft = true
|
||||
+++
|
||||
|
||||
Nothing to see here... Move along!
|
||||
Reference in New Issue
Block a user