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
|
||||
Reference in New Issue
Block a user