This commit is contained in:
3
Technical/20250402185735-java_moc.md
Executable file
3
Technical/20250402185735-java_moc.md
Executable file
@@ -0,0 +1,3 @@
|
||||
Use this node for pom.xml: [maven-pom-file](id:bcd41e87-120c-455c-8898-996ddaa41f75)
|
||||
|
||||
Tests: [java-junit-testing](id:7b8de14c-a73e-4c92-a403-a9a1c419c0b3)
|
||||
1
Technical/20250723190656-java_junit_testing.md
Executable file
1
Technical/20250723190656-java_junit_testing.md
Executable file
@@ -0,0 +1 @@
|
||||
<https://www.geeksforgeeks.org/software-testing/introduction-to-junit-5/>
|
||||
3
Technical/20250918120519-misc_moc.md
Executable file
3
Technical/20250918120519-misc_moc.md
Executable file
@@ -0,0 +1,3 @@
|
||||
# [wedding<sub>moc</sub>](id:c1de3972-e932-48fd-8065-3d89dad58007)
|
||||
|
||||
# [workflow-moc](id:8CE93986-280B-45BD-9DF2-5D06586DDDE7)
|
||||
7
Technical/20250926151524-workflow_moc.md
Executable file
7
Technical/20250926151524-workflow_moc.md
Executable file
@@ -0,0 +1,7 @@
|
||||
What are the use cases of the macbook and the pc:
|
||||
|
||||
# Macbook
|
||||
|
||||
##
|
||||
|
||||
# PC
|
||||
25
Technical/20251101123637-backlog.md
Executable file
25
Technical/20251101123637-backlog.md
Executable file
@@ -0,0 +1,25 @@
|
||||
****This backlog serves as a repository for ideas, tasks, and projects that are not currently being worked on but may be of interest in the future. It is a place to capture and organise thoughts, plans, and potential initiatives that can be revisited when the time is right. They are not limited to this website or the Org Web.****
|
||||
|
||||
# Ideas
|
||||
|
||||
- Building a code smells coverage checker for the `output` dir
|
||||
|
||||
- Powershell script to give insights on the build scripts. This can be fed into the daily logs/discord pipeline
|
||||
|
||||
- have a central point where we can see the server details and documentations
|
||||
|
||||
- Have a two way sync between the cookbook and org-roam notes (see: [swagger](https://nextcloud.github.io/cookbook/dev/api/0.1.3/index.html#/Recipes/listRecipes))
|
||||
|
||||
- Sort out all the iphone chrome nitter/xcancel links (so we don't go there again)
|
||||
|
||||
- sort out all the book notes. the current ones are:
|
||||
|
||||
- the science of self-discipline
|
||||
- clean coder
|
||||
- so good they can't ignore you
|
||||
|
||||
# Checked:
|
||||
|
||||
- Source of truth for mostly used functions
|
||||
|
||||
# To sort:
|
||||
1
Technical/20251214210526-useful_c_imports.md
Executable file
1
Technical/20251214210526-useful_c_imports.md
Executable file
@@ -0,0 +1 @@
|
||||
- SDL2 [See this](https://wiki.libsdl.org/SDL2/FrontPage)
|
||||
9
Technical/20251223220531-technical_commonplace.md
Executable file
9
Technical/20251223220531-technical_commonplace.md
Executable file
@@ -0,0 +1,9 @@
|
||||
In this commonplace, I will collect technical notes and insights that I find useful. This is a work in progress, and I will update it as I learn new things.
|
||||
|
||||
# Articles:
|
||||
|
||||
- <https://forge.medium.com/a-simple-tool-for-personal-growth-dc1e822aa229>
|
||||
|
||||
# Github:
|
||||
|
||||
- <https://github.com/XEphem/XEphem?tab=readme-ov-file>
|
||||
9
Technical/20260111204228-rss_articles.md
Executable file
9
Technical/20260111204228-rss_articles.md
Executable file
@@ -0,0 +1,9 @@
|
||||
# [Downdetector and the real cost of no upstream dependencies](https://blog.pragmaticengineer.com/downdetector-and-the-real-cost-of-no-upstream-dependencies/)
|
||||
|
||||
# [Loneliness Isn’t Just Something We Endure](https://coffeeandjunk.substack.com/p/loneliness)
|
||||
|
||||
# [What are dormant volcanoes good for? Copper mining](https://bigthink.com/technology-innovation/dormant-volcanoes-copper-mining)
|
||||
|
||||
# [Where Have All the Geniuses Gone?](https://coffeeandjunk.substack.com/p/genius)
|
||||
|
||||
# [Not Everything Has to Be Timeless](https://coffeeandjunk.substack.com/p/forever)
|
||||
1
Technical/20260117194854-programming_projects.md
Executable file
1
Technical/20260117194854-programming_projects.md
Executable file
@@ -0,0 +1 @@
|
||||
- <https://github.com/codecrafters-io/build-your-own-x>
|
||||
11
Technical/Linux/Arch Linux.md
Executable file
11
Technical/Linux/Arch Linux.md
Executable file
@@ -0,0 +1,11 @@
|
||||
# Links:
|
||||
|
||||
- <https://www.geeksforgeeks.org/how-to-install-intellij-idea-on-arch-based-linux-distributionsmanjaro/>
|
||||
|
||||
|
||||
|
||||
``` shell
|
||||
|
||||
sudo fuser -k 8000/tcp
|
||||
|
||||
```
|
||||
35
Technical/Linux/GPG Encryption.md
Executable file
35
Technical/Linux/GPG Encryption.md
Executable file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
note type:
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
If you want to encrypt a file, use the following command:
|
||||
|
||||
``` bash
|
||||
|
||||
gpg -c file.txt
|
||||
|
||||
# options include :
|
||||
# gpg -c file.txt : for symmetric encryption
|
||||
# gpg -d file.txt.gpg : to decrypt the file
|
||||
# gpg --batch -c --passphrase mypassphrase file.txt : accepts passphrase right from command line
|
||||
|
||||
```
|
||||
|
||||
and to decrypt, use:
|
||||
|
||||
``` bash
|
||||
|
||||
gpg -d file.txt
|
||||
|
||||
# You have to wait 10 minutes before you can get prompted for a password, before this, it will
|
||||
# decrypt without the passphrase.
|
||||
|
||||
```
|
||||
|
||||
`gpg –batch -c –passphrase Shakkal123! passwords.md`
|
||||
|
||||
`gpg –batch -d –passphrase Shakkal123! passwords.md.gpg`
|
||||
|
||||
`gpg –batch –output passwords.md -d –passphrase Shakkal123! passwords.md.gpg`
|
||||
179
Technical/Linux/Keyboard.md
Executable file
179
Technical/Linux/Keyboard.md
Executable file
@@ -0,0 +1,179 @@
|
||||
# Keyboard inputs
|
||||
|
||||
This all comes from the fact that a "key press" isn't one thing — it's
|
||||
a stack of specs and translations from **keyboard hardware → USB/HID →
|
||||
Linux kernel → userspace (XKB/Wayland) → Hyprland binds**.
|
||||
|
||||
## 1\. Big picture: what happens when you press a key?
|
||||
|
||||
When you hit a key (like your "lock" key), roughly this happens:
|
||||
|
||||
``` text
|
||||
Physical switch on keyboard
|
||||
↓
|
||||
Keyboard firmware → USB HID "usage" (e.g. 0x07:0xE3 = Left GUI)
|
||||
↓
|
||||
Linux kernel input subsystem (evdev) → KEY_LEFTMETA (code 125)
|
||||
↓
|
||||
libinput / xkbcommon → keysyms (like Super_L, L, etc.)
|
||||
↓
|
||||
Hyprland → your `bind = SUPER, L, exec, ...`
|
||||
```
|
||||
|
||||
The "topic" we've been poking at is basically **understanding each layer
|
||||
in that stack**.
|
||||
|
||||
-----
|
||||
|
||||
## 2\. USB HID: where `700e3` comes from
|
||||
|
||||
Modern USB keyboards follow the **USB HID (Human Interface Device)
|
||||
specification**. This spec defines **Usage Tables**: numerical codes for
|
||||
things like keys, buttons, axes, etc.
|
||||
|
||||
- The keyboard page is **Usage Page 0x07 (Keyboard/Keypad)**.
|
||||
|
||||
- In your `evtest` output, `MSC_SCAN value 700e3` means:
|
||||
|
||||
- `0x07` (Keyboard page)
|
||||
- `0xE3` (Left GUI / "Windows/Super" key)
|
||||
|
||||
You can see the official tables here (PDF):
|
||||
|
||||
- **HID Usage Tables (includes Keyboard/Keypad page 0x07)**
|
||||
<https://usb.org/sites/default/files/hut1_21.pdf>
|
||||
([USB Implementers Forum](https://usb.org/sites/default/files/hut1_21.pdf?utm_source=chatgpt.com))
|
||||
|
||||
If you scroll to the **Keyboard/Keypad Page (0x07)** section, it lists all
|
||||
the key usages: A, B, C, modifiers, function keys, etc. There's also a
|
||||
standalone Keyboard/Keypad-page extract people mirror, like this PDF
|
||||
snippet:
|
||||
([d1.amobbs.com](https://d1.amobbs.com/bbs_upload782111/files_47/ourdev_692986N5FAHU.pdf?utm_source=chatgpt.com))
|
||||
|
||||
So:
|
||||
|
||||
- `700e3` = Page `0x07`, Usage `0xE3` → *Keyboard Left GUI*
|
||||
- `7000f` = Page `0x07`, Usage `0x0F` → *Keyboard L* key
|
||||
|
||||
That's how we knew your lock key was sending **Super + L**.
|
||||
|
||||
-----
|
||||
|
||||
## 3\. Linux input subsystem: `EV_MSC`, `EV_KEY`, `KEY_LEFTMETA`
|
||||
|
||||
Linux has a dedicated **input subsystem** in the kernel (`drivers/input`,
|
||||
`drivers/hid` etc.) that takes those HID usages and turns them into a
|
||||
unified stream of **input events**.
|
||||
([Linux Kernel Documentation](https://docs.kernel.org/input/input.html?utm_source=chatgpt.com))
|
||||
|
||||
Key ideas:
|
||||
|
||||
- Devices expose `/dev/input/eventX` nodes.
|
||||
|
||||
- Each event is a struct with:
|
||||
|
||||
- `type` (e.g. =EV<sub>KEY</sub>=, `EV_MSC`, `EV_REL`, `EV_SYN`)
|
||||
- `code` (e.g. =KEY<sub>L</sub>=, `KEY_LEFTMETA`)
|
||||
- `value` (pressed = 1, released = 0, repeat = 2)
|
||||
|
||||
Docs worth bookmarking:
|
||||
|
||||
- **Linux input subsystem overview**
|
||||
<https://docs.kernel.org/input/input.html>
|
||||
([Linux Kernel Documentation](https://docs.kernel.org/input/input.html?utm_source=chatgpt.com))
|
||||
|
||||
- **Input event types and codes (`event-codes.txt`)**
|
||||
<https://www.kernel.org/doc/Documentation/input/event-codes.txt>
|
||||
([Kernel.org](https://www.kernel.org/doc/Documentation/input/event-codes.txt?utm_source=chatgpt.com))
|
||||
|
||||
The **keycode definitions** (`KEY_L`, `KEY_LEFTMETA`, etc.) live in:
|
||||
|
||||
- `include/uapi/linux/input-event-codes.h` in the kernel source Example
|
||||
mirror:
|
||||
<https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/input-event-codes.h>
|
||||
([GitHub](https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/input-event-codes.h?utm_source=chatgpt.com))
|
||||
|
||||
When `evtest` prints:
|
||||
|
||||
``` text
|
||||
type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
|
||||
type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
|
||||
```
|
||||
|
||||
that means:
|
||||
|
||||
- `EV_MSC / MSC_SCAN` → "Here is the raw hardware scancode" (from USB
|
||||
HID).
|
||||
- `EV_KEY / KEY_LEFTMETA` → "Linux mapped that scancode to logical key
|
||||
LEFTMETA".
|
||||
|
||||
-----
|
||||
|
||||
## 4\. XKB / xkbcommon: mapping to actual characters & modifiers
|
||||
|
||||
Above the kernel, you've got an extra mapping layer that says:
|
||||
|
||||
> For keycode N, with this layout, when Shift is held, produce this
|
||||
> character/symbol.
|
||||
|
||||
On X11 this is handled by **XKB (X Keyboard Extension)**; on Wayland
|
||||
compositors (including Hyprland) the same ideas are implemented via
|
||||
**xkbcommon**.
|
||||
|
||||
Docs:
|
||||
|
||||
- **X Keyboard Extension (XKB) protocol spec**
|
||||
<https://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html>
|
||||
([X.Org](https://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html?utm_source=chatgpt.com))
|
||||
|
||||
- **Arch Wiki: X keyboard extension** (good high-level intro)
|
||||
<https://wiki.archlinux.org/title/X_keyboard_extension>
|
||||
([ArchWiki](https://wiki.archlinux.org/title/X_keyboard_extension?utm_source=chatgpt.com))
|
||||
|
||||
- A nice "practical" walkthrough of XKB concepts:
|
||||
[[https://medium.com/\[cite/t:@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450](https://medium.com/%5Bcite/t:@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450)](https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450)\]
|
||||
([Medium](https://medium.com/%40damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450?utm_source=chatgpt.com))
|
||||
|
||||
Hyprland, Sway, etc. all use libinput + xkbcommon under the hood to
|
||||
interpret those keycodes and translate them into keysyms and modifiers.
|
||||
|
||||
-----
|
||||
|
||||
## 5\. Hyprland / your config: where the bindings fit in
|
||||
|
||||
Hyprland sits at the top of this stack:
|
||||
|
||||
- It listens to the input events (via libinput).
|
||||
- It sees keysyms/modifiers (e.g. =Super=, `L`).
|
||||
- It matches them against your config:
|
||||
|
||||
<!-- end list -->
|
||||
|
||||
``` ini
|
||||
bind = SUPER, L, exec, hyprlock
|
||||
```
|
||||
|
||||
So your keyboard's "lock" key:
|
||||
|
||||
1. Firmware sends HID usages `0xE3` (Left GUI) and `0x0F` (L).
|
||||
2. Linux maps them to `KEY_LEFTMETA` (125) and `KEY_L` (38).
|
||||
3. xkbcommon maps that to `Super` + `L`.
|
||||
4. Hyprland says: "Ah, SUPER+L → run `hyprlock`".
|
||||
|
||||
The "topic" you stumbled into is just **peeling back each abstraction
|
||||
layer**.
|
||||
|
||||
-----
|
||||
|
||||
## 6\. Handy tools & libraries if you want to go deeper
|
||||
|
||||
- `evtest`, `libinput debug-events`, `showkey` → To watch what your
|
||||
keyboard is actually sending.
|
||||
|
||||
- **Python-evdev** – Python bindings to read `/dev/input/event*`
|
||||
yourself: <https://python-evdev.readthedocs.io/>
|
||||
([python-evdev.readthedocs.io](https://python-evdev.readthedocs.io/?utm_source=chatgpt.com))
|
||||
|
||||
- Linux input subsystem docs again:
|
||||
<https://docs.kernel.org/driver-api/input.html>
|
||||
([Linux Kernel Documentation](https://docs.kernel.org/driver-api/input.html?utm_source=chatgpt.com))
|
||||
12
Technical/Linux/Linux MOC.md
Executable file
12
Technical/Linux/Linux MOC.md
Executable file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
note type:
|
||||
- moc
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
- [[Wacom]]
|
||||
- [[Systemd Services]]
|
||||
- [[GPG Encryption]]
|
||||
- [[Arch Linux]]
|
||||
- [[i3 WM]]
|
||||
- [[Keyboard]]
|
||||
45
Technical/Linux/Systemd Services.md
Executable file
45
Technical/Linux/Systemd Services.md
Executable file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
note type:
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
# To add a systemctl
|
||||
|
||||
- create a new systemd service file:
|
||||
`sudo nano /etc/systemd/system/name.service`
|
||||
|
||||
- example content:
|
||||
`[Unit]`
|
||||
`Description=Watch TODO Directory and Update Master Task List`
|
||||
`After=network.target`
|
||||
|
||||
`[Service]`
|
||||
`ExecStart=/usr/local/bin/watch-todo.sh`
|
||||
`Restart=always`
|
||||
`User=zaine`
|
||||
`WorkingDirectory=/home/zaine/master-folder/org<sub>files</sub>/todo`
|
||||
`StandardOutput=append:/var/log/watch-todo.log`
|
||||
`StandardError=append:/var/log/watch-todo.log`
|
||||
|
||||
\[Install\]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
- reload and start:
|
||||
|
||||
`sudo systemctl daemon-reload`
|
||||
`sudo systemctl enable watch-todo.service`
|
||||
`sudo systemctl start watch-todo.service`
|
||||
|
||||
# To remove a systemctl service:
|
||||
|
||||
```
|
||||
systemctl stop \[servicename\]
|
||||
systemctl disable \[servicename\]
|
||||
rm *etc/systemd/system*\[servicename\]
|
||||
rm *etc/systemd/system*\[servicename\] \# and symlinks that might be related
|
||||
rm *usr/lib/systemd/system*\[servicename\]
|
||||
rm *usr/lib/systemd/system*\[servicename\] \# and symlinks that might be related
|
||||
systemctl daemon-reload
|
||||
systemctl reset-failed
|
||||
```
|
||||
58
Technical/Linux/Wacom.md
Executable file
58
Technical/Linux/Wacom.md
Executable file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
note type:
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
The command: `xsetwacom --list` gave me:
|
||||
|
||||
``` bash
|
||||
Wacom One by Wacom M Pen stylus id: 12 type: STYLUS
|
||||
Wacom One by Wacom M Pen eraser id: 13 type: ERASER
|
||||
```
|
||||
|
||||
Then, in order to map the stylus to a single monitor i needed to know my monitor mappings via `xrandr`:
|
||||
|
||||
``` bash
|
||||
|
||||
Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767
|
||||
DP-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
|
||||
1920x1080 60.00*+ 143.85 119.98 59.94
|
||||
1680x1050 59.95
|
||||
1440x900 59.89
|
||||
1440x576 50.00
|
||||
1440x480 59.94
|
||||
1280x1024 75.02 60.02
|
||||
1280x960 60.00
|
||||
1280x720 60.00 59.94
|
||||
1152x864 75.00
|
||||
1024x768 75.03 70.07 60.00
|
||||
800x600 75.00 72.19 60.32 56.25
|
||||
720x480 59.94
|
||||
640x480 75.00 72.81 59.94 59.93
|
||||
DP-1 disconnected (normal left inverted right x axis y axis)
|
||||
HDMI-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 521mm x 293mm
|
||||
1920x1080 60.00*+ 59.94 50.00
|
||||
1680x1050 59.95
|
||||
1600x900 60.00
|
||||
1440x900 59.89
|
||||
1280x1024 60.02
|
||||
1280x800 59.81
|
||||
1280x720 60.00 59.94 50.00
|
||||
1024x768 70.07 60.00
|
||||
800x600 72.19 60.32 56.25
|
||||
720x576 50.00
|
||||
720x480 59.94
|
||||
640x480 72.81 59.94
|
||||
DP-2 disconnected (normal left inverted right x axis y axis)
|
||||
DP-3 disconnected (normal left inverted right x axis y axis)
|
||||
DP-4 disconnected (normal left inverted right x axis y axis)
|
||||
DP-5 disconnected (normal left inverted right x axis y axis)
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
Then I simply map it via:
|
||||
|
||||
`xsetwacom set "Wacom One by Wacom M Pen stylus" MapToOutput HEAD-0`
|
||||
10
Technical/Linux/i3 WM.md
Executable file
10
Technical/Linux/i3 WM.md
Executable file
@@ -0,0 +1,10 @@
|
||||
# Commands:
|
||||
|
||||
**Mod1 = Win Key**
|
||||
|
||||
`$mod+Enter = Open Terminal`
|
||||
`$mod+s = Stacked layout`
|
||||
`$mod+e = Default layout`
|
||||
`$mod+d = dmenu`
|
||||
|
||||
# Config file:
|
||||
16
Technical/Server/Actual (finance).md
Executable file
16
Technical/Server/Actual (finance).md
Executable file
@@ -0,0 +1,16 @@
|
||||
# Notes:
|
||||
|
||||
- \<2026-04-01 Wed\>: There is one transaction waiting to show on the statement for \<2026-03-31 Tue\>. Will need to redo March full. \[ \]
|
||||
|
||||
# Setup
|
||||
|
||||
In order to update the balance, I have decided for the moment to export as `csv` the monthly transactions from Halifax. Place the file into the `~/master-folder/attachments/bank-statements/` folder and name it as `halifax-YYYY-MM.csv`, where `YYYY` is the four-digit year and `MM` is the two-digit month.
|
||||
|
||||
Then run the following command in the terminal whilst being in the `~/master-folder/projects/scripts/` directory:
|
||||
|
||||
``` python
|
||||
python3 clean-halifax-actual.py ../../attachments/bank-statements/halifax-YYYY-MM.csv ../../attachments/bank-statements/halifax-YYYY-MM-cleaned.csv
|
||||
|
||||
```
|
||||
|
||||
Then you can go to the website `https://actual.zainezq.com/` and upload the cleaned file to update the balance.
|
||||
79
Technical/Server/Cloudflare.md
Executable file
79
Technical/Server/Cloudflare.md
Executable file
@@ -0,0 +1,79 @@
|
||||
---
|
||||
note type:
|
||||
- server
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
# Go to: <https://dash.cloudflare.com/49b791cb8f903fdcab3db1cfa124321b/one/access-controls/apps>
|
||||
|
||||
This is to edit the access control in the zero trust cloudflare.
|
||||
|
||||
# Origin certificate
|
||||
|
||||
```
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEojCCA4qgAwIBAgIUGvC9u3SW6C6y5uOcQjul2hyghmgwDQYJKoZIhvcNAQEL
|
||||
BQAwgYsxCzAJBgNVBAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMTQw
|
||||
MgYDVQQLEytDbG91ZEZsYXJlIE9yaWdpbiBTU0wgQ2VydGlmaWNhdGUgQXV0aG9y
|
||||
aXR5MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRMwEQYDVQQIEwpDYWxpZm9ybmlh
|
||||
MB4XDTI2MDQwOTEyNDYwMFoXDTQxMDQwNTEyNDYwMFowYjEZMBcGA1UEChMQQ2xv
|
||||
dWRGbGFyZSwgSW5jLjEdMBsGA1UECxMUQ2xvdWRGbGFyZSBPcmlnaW4gQ0ExJjAk
|
||||
BgNVBAMTHUNsb3VkRmxhcmUgT3JpZ2luIENlcnRpZmljYXRlMIIBIjANBgkqhkiG
|
||||
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwnW7egyN30IndtYbCdk4EA9IVb+icJo4d9mR
|
||||
Bsiw4TJ6YSlnFkVXuHl1iitSZiMnlGxHke5AsDGm8rnyCa5BzT/n+VI27WwyncoO
|
||||
PJXjSjOFIWVg/VAaHJUwXcc+taqNn/U3661iSN+1TlJFgpVwF6ei6t+raJcCAXxN
|
||||
ajrA3ksf4FhMWQcpdi6J0ecM8LWsa94nNHFZJCH8nTGsND90zw7ueOMu5JIhc6Ru
|
||||
0Iw5kke2jIkhVQpg4DYTzKoEa1SmgGCZAPBlBaOc7Ii4VpVMmydhRh0TFDZbe5Bz
|
||||
lgVMslOSj1qnq4o7nFCk0LY8gfSykbuKJEHr/aboOEkot+E4kwIDAQABo4IBJDCC
|
||||
ASAwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcD
|
||||
ATAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBThHBF5Sw8X+uuHUB0NIANwIakBsjAf
|
||||
BgNVHSMEGDAWgBQk6FNXXXw0QIep65TbuuEWePwppDBABggrBgEFBQcBAQQ0MDIw
|
||||
MAYIKwYBBQUHMAGGJGh0dHA6Ly9vY3NwLmNsb3VkZmxhcmUuY29tL29yaWdpbl9j
|
||||
YTAlBgNVHREEHjAcgg0qLnphaW5lenEuY29tggt6YWluZXpxLmNvbTA4BgNVHR8E
|
||||
MTAvMC2gK6AphidodHRwOi8vY3JsLmNsb3VkZmxhcmUuY29tL29yaWdpbl9jYS5j
|
||||
cmwwDQYJKoZIhvcNAQELBQADggEBALfCfzqPuLXLepdyY/O8j9+0kiwdgby6ir1x
|
||||
1O8HKm0y47WZx7nntromSo4Bgq+R1KglUCvkcy+kCwlsfFk1WmCgVMiE9WCnn6Pv
|
||||
NriftoM5Q1tiHeSR0kLOJ9mROmiy5roThMm2EOWCjhWw2jJzVfvTj1s651dpmGRj
|
||||
E6BoX6NJr9NvzVEeCqhgjoiCXIv5bfGEwl1Mj/mIj2/GIbLiayT90vi8T89ixgca
|
||||
RTLlmRiEEJnKP0NN45vGYjgtJCgkXtCDL0lfSBt5FuEXq4sXIjDhhIn/hH004doJ
|
||||
fHlwK4tTfpZPYterSRRuy4zSgV7IekKS2z9pjCloQbDbMjqnAKI=
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
|
||||
```
|
||||
|
||||
# Private key
|
||||
|
||||
```
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDCdbt6DI3fQid2
|
||||
1hsJ2TgQD0hVv6Jwmjh32ZEGyLDhMnphKWcWRVe4eXWKK1JmIyeUbEeR7kCwMaby
|
||||
ufIJrkHNP+f5UjbtbDKdyg48leNKM4UhZWD9UBoclTBdxz61qo2f9TfrrWJI37VO
|
||||
UkWClXAXp6Lq36tolwIBfE1qOsDeSx/gWExZByl2LonR5wzwtaxr3ic0cVkkIfyd
|
||||
Maw0P3TPDu544y7kkiFzpG7QjDmSR7aMiSFVCmDgNhPMqgRrVKaAYJkA8GUFo5zs
|
||||
iLhWlUybJ2FGHRMUNlt7kHOWBUyyU5KPWqerijucUKTQtjyB9LKRu4okQev9pug4
|
||||
SSi34TiTAgMBAAECggEADPLiBQKI//Dbx+IB8unv/cHGw077dhwO3owySA1dGeHO
|
||||
nGGxZ54+dR5BYW35EqwMmqmLKoB+9jyYLVmMcHCWGSDERanf1nd591/ZCtfARtSf
|
||||
bNXfW37V/klA6z21Q0uUGq6thpgJD2k2HX0E++kPicOz6YfzVgeYLpkkXoqDBUpF
|
||||
dzC+eGZDzjI1BECoW/N/U3P2F8nv7fHv/4xVudkMehlkPJ56BiMbx2K15jvh2Dyz
|
||||
znZvelNNw/XRHv29GgOkggh4BQRDXHl3/mTMTe8JmLWU560rNZ99xjpv1lrbqwuO
|
||||
W5WNRKcQRXCELXsEDiH1dEsteU1wVUaOyZSzEg6OYQKBgQD4InmF5kuhPrgnNwKu
|
||||
uRYZB60JFvkVdxal1xIGDwjylWBVsWWJEIAko3wbt6iI2/r1Est4tsBnap9nMciG
|
||||
Zn4FKJRAj0bZW6CwFHUZy6q91qK7JFM1e1dcrDXhgFOCG4rI802roPSjCo/rztkI
|
||||
LEQomGbMVs/86KtqaSRqVjGXXQKBgQDIn7StCglsRD/+RDWFIgtSOJbdIe0imP1h
|
||||
ewRa7iSKBMbc8ZFwDuZ3JxDI1a0DTQdMM3MpZRtGO2urnnepNV3fqSnZaaruaEL0
|
||||
1IKvCtZn1MHMEi4gErqpEBqgHfvSOIBvFhKQ6bbclmZJ5u1OFBrbu9EALfLk1Tkz
|
||||
Luje1fnArwKBgF7zIjlgtJQRIfqvjDE71f7h9w7BYbMbDOmM8PKskinxixl/dnEK
|
||||
hV5/yJ/6mV01gESDWqTomZt5K2IbpLX5RkPHEWPa76uA6m42hdDHJKDcHw0pi0Wt
|
||||
2vI1W7DcoBfrXiIjKBeC0doJ0qTTVC1Scwpttvh+R7xpdB6V+T9PmE5pAoGBALhm
|
||||
On31xLVzgdImRX8JzJgVFW1JOpnbPsFzfYxKaOFHBLWdf40c1O3dxUqjQ3POQA/l
|
||||
FkuM9+W0xgEnFVs8hv0FkkaYHhklUa2RClDzSCCFaF82spiePl0YRTC4fnY5oqr4
|
||||
Abaaao4T2w7AJ4vlZM5ksfRVR3TXGs0Vp8rxp65XAoGAPNgi8uz9zcAp5tUizZVg
|
||||
6nP68Cws6I3PmExMnbr2BmYAi2tl2NY93PQG1OT9MZ51Z0W+ynM6nTzti2zm7iXO
|
||||
Rs4AAsErEG1YDt4U0GExJdoEBIJ14+9Q6PSYPAMBbx0nv1WA1hvdvDHIUaYNPWqZ
|
||||
wuSVw419xlxUkj9uCb1kQoo=
|
||||
-----END PRIVATE KEY-----
|
||||
|
||||
|
||||
```
|
||||
24
Technical/Server/Gitea.md
Executable file
24
Technical/Server/Gitea.md
Executable file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
note type:
|
||||
- server
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
In order to connect to the gitea server and run git commands, you will need to do the following:
|
||||
|
||||
Run `cat ~/.ssh/id_ed25519.pub`
|
||||
|
||||
Copy that key and add it to the ssh keys in gitea
|
||||
|
||||
`ssh-keygen -t ed25519 -C "windows-gitea"`
|
||||
|
||||
`ssh -T -p 222 git@192.168.0.241`
|
||||
|
||||
Check the remote url of the git project.
|
||||
|
||||
`git remote -v`
|
||||
|
||||
Change it to:
|
||||
|
||||
`git remote set-url origin git@`
|
||||
289
Technical/Server/Nextcloud.md
Executable file
289
Technical/Server/Nextcloud.md
Executable file
@@ -0,0 +1,289 @@
|
||||
---
|
||||
note type:
|
||||
- note
|
||||
- server
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
# The docker file:
|
||||
|
||||
``` bash
|
||||
|
||||
version: '3.8'
|
||||
services:
|
||||
app:
|
||||
image: nextcloud
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 8007:80
|
||||
volumes:
|
||||
- nextcloud:/var/www/html
|
||||
environment:
|
||||
- POSTGRES_DB=nextcloud
|
||||
- POSTGRES_USER=nextcloud
|
||||
- POSTGRES_PASSWORD=zxq123_nextcloud
|
||||
- POSTGRES_HOST=postgres
|
||||
networks:
|
||||
- postgres_network
|
||||
|
||||
volumes:
|
||||
nextcloud:
|
||||
|
||||
networks:
|
||||
postgres_network:
|
||||
external: true
|
||||
|
||||
```
|
||||
|
||||
# Database related things:
|
||||
|
||||
``` bash
|
||||
|
||||
zxq_db=# CREATE DATABASE nextcloud;
|
||||
CREATE DATABASE
|
||||
zxq_db=# CREATE USER nextcloud WITH PASSWORD 'zxq123_nextcloud';
|
||||
CREATE ROLE
|
||||
zxq_db=# GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
|
||||
GRANT
|
||||
zxq_db=#
|
||||
|
||||
```
|
||||
|
||||
# Permissions:
|
||||
|
||||
## **Not sure if the below still applies**
|
||||
|
||||
``` bash
|
||||
|
||||
# Add yourself and www-data to a shared group
|
||||
|
||||
### Create a shared group:
|
||||
|
||||
sudo groupadd ncshare
|
||||
|
||||
### Add both users:
|
||||
|
||||
sudo usermod -aG ncshare zaine
|
||||
sudo usermod -aG ncshare www-data
|
||||
|
||||
### Set the folder to that group:
|
||||
|
||||
sudo chown -R zaine:ncshare /home/zaine/master-folder
|
||||
sudo chmod -R 775 /home/zaine/master-folder
|
||||
|
||||
|
||||
```
|
||||
|
||||
## \<2026-03-25 Wed\> fixes:
|
||||
|
||||
Up To Date Fixes:
|
||||
We need to add zaine to the www-data group:
|
||||
|
||||
``` bash
|
||||
sudo usermod -aG www-data zaine
|
||||
```
|
||||
|
||||
Then we need to make the directories setgid, so that any new files created will have the group www-data:
|
||||
|
||||
``` bash
|
||||
sudo chown -R zaine:www-data /home/zaine/master-folder
|
||||
sudo chmod -R 2775 /home/zaine/master-folder # the 2 sets the setgid bit, which means that new files will inherit the group of the directory, which is www-data
|
||||
```
|
||||
|
||||
### Older fixes
|
||||
|
||||
So apparently, nextcloud needs to have www-data as the owner of the files, and to do that, we need to run the following command:
|
||||
|
||||
``` bash
|
||||
sudo chown -R www-data:www-data /home/zaine/master-folder
|
||||
```
|
||||
|
||||
I modified the build scripts to change permissions back to zaine:zaine when deleting the output folder, then changing it back to www-<data:www-data>.
|
||||
|
||||
One other useful thing may be:
|
||||
|
||||
``` bash
|
||||
|
||||
docker exec -u 1000:1000 -it nextcloud-app-1 php occ files:scan --all
|
||||
|
||||
# or
|
||||
|
||||
docker exec -u 1000 nextcloud-app-1 php occ files:scan --path="zaine/files/master-folder"
|
||||
|
||||
```
|
||||
|
||||
One other thing:
|
||||
|
||||
``` bash
|
||||
i FIXED IT BY doing this:
|
||||
|
||||
zaine@zaine-HP-ProDesk-400-G1-SFF [09:47:47] [~/docker-services/nextcloud]
|
||||
-> % docker exec -it postgres psql -U nextcloud -d nextcloud
|
||||
psql (17.5 (Debian 17.5-1.pgdg120+1))
|
||||
Type "help" for help.
|
||||
|
||||
nextcloud=> SELECT * FROM oc_file_locks;
|
||||
nextcloud=> DELETE FROM oc_file_locks;
|
||||
DELETE 15002
|
||||
nextcloud=> \q
|
||||
zaine@zaine-HP-ProDesk-400-G1-SFF [09:49:01] [~/docker-services/nextcloud]
|
||||
-> % docker exec -it nextcloud-app-1 ls /mnt/master-folder
|
||||
alimiyyah attachments booking career hurra.txt org_files pdfs projects uni
|
||||
zaine@zaine-HP-ProDesk-400-G1-SFF [09:49:04] [~/docker-services/nextcloud]
|
||||
-> % docker exec -u 1000 -it nextcloud-app-1 php occ files:scan --all
|
||||
Starting scan for user 1 out of 2 (halima)
|
||||
Starting scan for user 2 out of 2 (zaine)
|
||||
+---------+-------+-----+---------+---------+--------+--------------+
|
||||
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
|
||||
+---------+-------+-----+---------+---------+--------+--------------+
|
||||
| 1985 | 12906 | 0 | 522 | 0 | 0 | 00:00:50 |
|
||||
+---------+-------+-----+---------+---------+--------+--------------+
|
||||
zaine@zaine-HP-ProDesk-400-G1-SFF [09:49:59] [~/docker-services/nextcloud]
|
||||
-> %
|
||||
|
||||
there is some issue in the nextcloud permissions itself. if i create a file and delete it in windows, i get this error in the client: A
|
||||
master-folder/hehe.txt
|
||||
now
|
||||
The resource you are trying to access is currently locked and cannot be modified. Please try changing it later, or contact your server administrator ...
|
||||
|
||||
and if i try to delete it in nextcloud ui (web), it says file cant be deleted
|
||||
|
||||
```
|
||||
|
||||
# Config
|
||||
|
||||
Location is:
|
||||
|
||||
sudo nano /var/lib/docker/volumes/nextcloud<sub>nextcloud</sub>/<sub>data</sub>/config/config.php
|
||||
|
||||
# Accounts
|
||||
|
||||
User is: zaine
|
||||
Pass: Shakkal123\!
|
||||
|
||||
# Legacy stuff
|
||||
|
||||
Something I've been trying to reverse proxy ahead of time. Go to <https://zserver.zapto.org/nextcloud> , you'll be prompted to login with a username and password:
|
||||
Here's your credentials:
|
||||
|
||||
Username: halima
|
||||
Password: loser2104\!
|
||||
|
||||
Once you've logged in, I've set up your account already, so there should be a calendar already there.
|
||||
|
||||
To get your phone logged in, there's two ways:
|
||||
|
||||
1. go to the following address: <https://zserver.zapto.org/nextcloud/settings/user/security> , scroll to the bottom, under devices and sessions, type in a random name (iphone), and click create new app password. You should then be able to generate a QR code (next to or under the password field), then you can scan that on your iphone app.
|
||||
|
||||
2. inside the app, type the following URL: <https://zserver.zapto.org/nextcloud> then follow the instructions.
|
||||
|
||||
Im thinking of having this as our shared calendar and file system. The only users are us 2 and its completely off the internet (self-hosted).
|
||||
|
||||
## network issues resolved by:
|
||||
|
||||
``` bash
|
||||
|
||||
docker network connect postgres_network postgres
|
||||
|
||||
zaine@zaine-HP-ProDesk-400-G1-SFF [21:00:27] [~/docker-services/nextcloud]
|
||||
-> % psql -h zserver.zapto.org -p 5432 -U zaine -d zxq_db
|
||||
Password for user zaine:
|
||||
psql (14.18 (Ubuntu 14.18-0ubuntu0.22.04.1), server 17.5 (Debian 17.5-1.pgdg120+1))
|
||||
WARNING: psql major version 14, server major version 17.
|
||||
Some psql features might not work.
|
||||
Type "help" for help.
|
||||
|
||||
zxq_db=# \c nextcloud
|
||||
psql (14.18 (Ubuntu 14.18-0ubuntu0.22.04.1), server 17.5 (Debian 17.5-1.pgdg120+1))
|
||||
WARNING: psql major version 14, server major version 17.
|
||||
Some psql features might not work.
|
||||
You are now connected to database "nextcloud" as user "zaine".
|
||||
nextcloud=# GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
|
||||
GRANT
|
||||
nextcloud=# GRANT USAGE ON SCHEMA public TO nextcloud;
|
||||
GRANT CREATE ON SCHEMA public TO nextcloud;
|
||||
GRANT
|
||||
GRANT
|
||||
nextcloud=# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO nextcloud;
|
||||
GRANT
|
||||
nextcloud=# GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO nextcloud;
|
||||
GRANT
|
||||
nextcloud=#
|
||||
|
||||
zaine
|
||||
M22ZN-fmefj-RdF36-3BMfT-LfWo8
|
||||
|
||||
zaine
|
||||
zxh123!
|
||||
|
||||
```
|
||||
|
||||
## Connecting to IOS
|
||||
|
||||
<https://www.reddit.com/r/NextCloud/comments/1pehpft/calendar_app_for_ios/>
|
||||
|
||||
# ICS stuff:
|
||||
|
||||
## To get the ID of a calendar subscription:
|
||||
|
||||
```
|
||||
zaine@zaine-HP-ProDesk-400-G1-SFF [14:14:27] [~]
|
||||
-> % docker exec nextcloud-app-1 php occ dav:list-subscriptions zaine
|
||||
+-----------------------+-----------------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| URI | Displayname | Refresh rate | Source |
|
||||
+-----------------------+-----------------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| outlookoffice365com-1 | outlook.office365.com | PT5M (default) | https://outlook.office365.com/owa/calendar/b910ea835e414663831e505f3d10baa2@microlise.com/d2568a0134fb49af92d39c1669c4729317662288011094411305/calendar.ics |
|
||||
+-----------------------+-----------------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
```
|
||||
|
||||
## emacs config to sync calendars:
|
||||
|
||||
```
|
||||
(require 'org-caldav)
|
||||
(require 'url)
|
||||
(require 'icalendar)
|
||||
(modify-coding-system-alist 'file "caldav-work\\.org\\'" 'utf-8-unix)
|
||||
(defvar my/outlook-ics-url
|
||||
"https://outlook.office365.com/owa/calendar/b910ea835e414663831e505f3d10baa2@microlise.com/d2568a0134fb49af92d39c1669c4729317662288011094411305/calendar.ics")
|
||||
|
||||
(defvar my/outlook-org-file
|
||||
"D:\\_nextcloud\\master-folder\\org_files\\calendar\\caldav-work.org")
|
||||
|
||||
(defvar my/ics-python-script
|
||||
"D:\\_nextcloud\\master-folder\\org_files\\calendar\\ics_to_org.py")
|
||||
|
||||
(defun my/sync-outlook-calendar ()
|
||||
"Fetch and expand Outlook ICS (including recurrences) into org file."
|
||||
(interactive)
|
||||
(message "Syncing Outlook calendar...")
|
||||
(let* ((cmd (format "python \"%s\" \"%s\" \"%s\""
|
||||
my/ics-python-script
|
||||
my/outlook-ics-url
|
||||
my/outlook-org-file))
|
||||
(result (shell-command-to-string cmd)))
|
||||
(message "Outlook calendar sync: %s" (string-trim result))))
|
||||
|
||||
;; Sync on startup and every 30 minutes
|
||||
(my/sync-outlook-calendar)
|
||||
(run-with-timer (* 30 60) (* 30 60) #'my/sync-outlook-calendar)
|
||||
;; --- CalDAV for native Nextcloud calendars ---
|
||||
(setq org-caldav-url "https://nextcloud.zainezq.com/remote.php/dav/calendars/zaine/")
|
||||
(setq org-caldav-calendars
|
||||
'((:calendar-id "personal"
|
||||
:inbox "D:\\_nextcloud\\master-folder\\org_files\\calendar\\caldav-personal.org"
|
||||
:files nil)
|
||||
(:calendar-id "zxh"
|
||||
:inbox "D:\\_nextcloud\\master-folder\\org_files\\calendar\\caldav-family.org"
|
||||
:files nil)))
|
||||
|
||||
;; --- Agenda files ---
|
||||
(setq org-agenda-files
|
||||
'("D:\\_nextcloud\\master-folder\\org_files\\calendar\\caldav-personal.org"
|
||||
"D:\\_nextcloud\\master-folder\\org_files\\calendar\\caldav-work.org"
|
||||
"D:\\_nextcloud\\master-folder\\org_files\\calendar\\caldav-family.org"
|
||||
"D:\\_nextcloud\\master-folder\\org_files\\org_roam\\Books\\20250724230557-books_org_agenda.org"))
|
||||
|
||||
|
||||
```
|
||||
265
Technical/Server/Old NGINX Code.md
Executable file
265
Technical/Server/Old NGINX Code.md
Executable file
@@ -0,0 +1,265 @@
|
||||
---
|
||||
note type:
|
||||
- server
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
``` bash
|
||||
|
||||
|
||||
-> % cat /etc/nginx/sites-available/zserver
|
||||
|
||||
|
||||
server {
|
||||
server_name zainezq.com;
|
||||
|
||||
access_log /var/log/nginx/zserver.access.log combined;
|
||||
error_log /var/log/nginx/zserver.error.log warn;
|
||||
# Basic authentication for the entire server
|
||||
auth_basic "Restricted Access";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
|
||||
# Root location
|
||||
location / {
|
||||
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;
|
||||
proxy_redirect off;
|
||||
|
||||
root /home/zaine/master-folder/org_files/org_web/output;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /nginx_status {
|
||||
stub_status;
|
||||
}
|
||||
|
||||
location /dockge/ {
|
||||
proxy_pass http://127.0.0.1:5021/;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
location /guac/ {
|
||||
proxy_pass http://127.0.0.1:3003/guacamole/;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
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;
|
||||
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
# PGAdmin4 location
|
||||
location /pgadmin4/ {
|
||||
proxy_set_header X-Script-Name /pgadmin4;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://127.0.0.1:5050;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /pdf/ {
|
||||
proxy_pass http://127.0.0.1:8002/pdf/;
|
||||
proxy_set_header X-Script-Name /pdf;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /calibre {
|
||||
proxy_bind $server_addr;
|
||||
proxy_pass http://127.0.0.1:8083;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Scheme $scheme;
|
||||
proxy_set_header X-Script-Name /calibre; # IMPORTANT: path has NO trailing slash
|
||||
# This rewrites Calibre-Web's internal paths
|
||||
proxy_redirect off;
|
||||
proxy_http_version 1.1;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
|
||||
|
||||
location /codeserver/ {
|
||||
proxy_pass http://localhost:8441/;
|
||||
rewrite ^/codeserver(/.*)$ $1 break;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Accept-Encoding gzip;
|
||||
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;
|
||||
}
|
||||
|
||||
location /filebrowser {
|
||||
# prevents 502 bad gateway error
|
||||
proxy_buffers 8 32k;
|
||||
proxy_buffer_size 64k;
|
||||
|
||||
client_max_body_size 75M;
|
||||
|
||||
# redirect all HTTP traffic to localhost:8088;
|
||||
proxy_pass http://127.0.0.1:9991;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
#proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
# enables WS support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_read_timeout 999999999;
|
||||
}
|
||||
|
||||
|
||||
# Miniflux location
|
||||
location /miniflux/ {
|
||||
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;
|
||||
proxy_pass http://127.0.0.1:9433/miniflux/;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
# Jupyter location
|
||||
location /jupyter/ {
|
||||
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;
|
||||
proxy_pass http://127.0.0.1:8888/jupyter/;
|
||||
proxy_redirect off;
|
||||
|
||||
# WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
|
||||
location /portainer/ {
|
||||
proxy_pass https://localhost:9443/;
|
||||
proxy_ssl_verify off; # Because Portainer uses a self-signed cert by default
|
||||
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;
|
||||
proxy_set_header Authorization "";
|
||||
# Required for WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Rewrite URL base path
|
||||
rewrite ^/portainer(/.*)$ $1 break;
|
||||
}
|
||||
|
||||
location /wireguard/ {
|
||||
proxy_pass http://127.0.0.1:124/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
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;
|
||||
|
||||
# Rewrite assets for subpath compatibility
|
||||
proxy_set_header Accept-Encoding "";
|
||||
sub_filter 'href="/' 'href="/wireguard/';
|
||||
sub_filter 'src="/' 'src="/wireguard/';
|
||||
sub_filter_types text/css application/javascript;
|
||||
sub_filter_once off;
|
||||
}
|
||||
|
||||
# /password -> /password/
|
||||
location = /password { return 301 /password/; }
|
||||
|
||||
# Main app/API (disable inherited basic auth here)
|
||||
location ^~ /password/ {
|
||||
auth_basic off;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
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;
|
||||
|
||||
# WebSockets
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Keep the /password prefix upstream (NO trailing slash here)
|
||||
proxy_pass http://127.0.0.1:8006;
|
||||
}
|
||||
|
||||
# (Optional but tidy) If you keep a dedicated WS block, disable auth there too
|
||||
location ^~ /password/notifications/hub {
|
||||
auth_basic off;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_pass http://127.0.0.1:8006;
|
||||
}
|
||||
|
||||
|
||||
# Optional: Add a custom error page
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# Optional: Cache static assets for performance (add this new block)
|
||||
# location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|eot|svg|html|htm)$ {
|
||||
# root /home/zaine/master-folder/org_files/org_web/output;
|
||||
# expires 30d;
|
||||
# access_log off;
|
||||
# }
|
||||
|
||||
# Optional: Deny access to hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
|
||||
listen 443 ssl; # managed by Certbot
|
||||
ssl_certificate /etc/letsencrypt/live/zainezq.com-0001/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/zainezq.com-0001/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
if ($host = zserver.zapto.org) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
listen 80;
|
||||
server_name zserver.zapto.org;
|
||||
return 404; # managed by Certbot
|
||||
}
|
||||
|
||||
```
|
||||
70
Technical/Server/Old Nextcloud.md
Executable file
70
Technical/Server/Old Nextcloud.md
Executable file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
note type:
|
||||
- server
|
||||
- note
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
# wg
|
||||
|
||||
Shakkal123\!
|
||||
|
||||
docker run ghcr.io/wg-easy/wg-easy:14 node -e 'const bcrypt = require("bcryptjs"); const hash = bcrypt.hashSync("Shakkal123\!", 10); console.log(hash.replace(/\\$/g, "\[\]"));'
|
||||
|
||||
Unable to find image 'ghcr.io/wg-easy/wg-easy:14' locally
|
||||
14: Pulling from wg-easy/wg-easy
|
||||
Digest: sha256:5f26407fd2ede54df76d63304ef184576a6c1bb73f934a58a11abdd852fab549
|
||||
Status: Downloaded newer image for ghcr.io/wg-easy/wg-easy:14
|
||||
|
||||
\[2a\]10$$E1lkGe/IH5EnFrQLhDH2M.yKk3Q7KlgRuu.fzf/76CbWoAMy4G83u
|
||||
|
||||
# nextcloud:
|
||||
|
||||
location ^\~ *nextcloud* {
|
||||
auth<sub>basic</sub> off;
|
||||
|
||||
proxy<sub>pass</sub> <http://localhost:8007/>;
|
||||
proxy<sub>setheader</sub> Host $host;
|
||||
proxy<sub>setheader</sub> X-Real-IP $remote<sub>addr</sub>;
|
||||
proxy<sub>setheader</sub> X-Forwarded-For $proxy<sub>addxforwardedfor</sub>;
|
||||
proxy<sub>setheader</sub> X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy<sub>httpversion</sub> 1.1;
|
||||
proxy<sub>setheader</sub> Upgrade $http<sub>upgrade</sub>;
|
||||
proxy<sub>setheader</sub> Connection "upgrade";
|
||||
|
||||
client<sub>maxbodysize</sub> 512M;
|
||||
client<sub>bodybuffersize</sub> 512k;
|
||||
|
||||
add<sub>header</sub> Referrer-Policy "no-referrer" always;
|
||||
add<sub>header</sub> X-Content-Type-Options "nosniff" always;
|
||||
add<sub>header</sub> X-Frame-Options "SAMEORIGIN" always;
|
||||
add<sub>header</sub> X-XSS-Protection "1; mode=block" always;
|
||||
}
|
||||
|
||||
location ^\~ /.well-known/carddav {
|
||||
return 301 $scheme://$host/nextcloud/remote.php/dav;
|
||||
}
|
||||
|
||||
location ^\~ /.well-known/caldav {
|
||||
return 301 $scheme://$host/nextcloud/remote.php/dav;
|
||||
}
|
||||
|
||||
location ^\~ /.well-known {
|
||||
return 301 $scheme://$host/nextcloud/index.php$uri;
|
||||
}
|
||||
|
||||
# technitium
|
||||
|
||||
location *technitium* {
|
||||
proxy<sub>pass</sub> <http://localhost:5380/>;
|
||||
proxy<sub>httpversion</sub> 1.1;
|
||||
proxy<sub>setheader</sub> Host $host;
|
||||
proxy<sub>setheader</sub> X-Real-IP $remote<sub>addr</sub>;
|
||||
proxy<sub>setheader</sub> X-Forwarded-For $proxy<sub>addxforwardedfor</sub>;
|
||||
proxy<sub>setheader</sub> X-Forwarded-Proto $scheme;
|
||||
|
||||
rewrite ^/technitium/(.\*)$ /$1 break;
|
||||
}
|
||||
|
||||
curl -X GET "<https://zserver.zapto.org/portainer/api/endpoints/3/docker/containers/json?all=true>" -H "X-API-Key: ptr<sub>KFQqKse9K4Nc9M5jnpc61fpAvGzdTOXTzswz9CwOF74</sub>=" -u "admin:shakkal123"
|
||||
102
Technical/Server/Server Backend.md
Executable file
102
Technical/Server/Server Backend.md
Executable file
@@ -0,0 +1,102 @@
|
||||
---
|
||||
note type:
|
||||
- note
|
||||
- server
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
# Introduction
|
||||
|
||||
The original backend was written using FastAPI and has now been archived.
|
||||
|
||||
In replacement, I have written a Java Spring Boot backend that handles all of the API calls the domain `zainezq.com` uses.
|
||||
|
||||
Here is the repository for the backend:
|
||||
|
||||
[Link to the backend repository](https://gitea.zainezq.com/zaine/org_backend)
|
||||
|
||||
# Structure
|
||||
|
||||
The backend is structured as a typical Spring Boot application. It consists of several packages that handle different aspects of the application:
|
||||
|
||||
- ****Controllers****: These classes handle incoming HTTP requests and map them to appropriate service methods.
|
||||
- ****Services****: These classes contain the business logic of the application.
|
||||
- ****Repositories****: These classes interact with the database to perform CRUD operations.
|
||||
- ****Models****: These classes represent the data structures used in the application.
|
||||
|
||||
The full list of API endpoints can be viewed using Swagger UI, which is available at the `/swagger-ui.html` endpoint once the application is running.
|
||||
|
||||
# Running the Application
|
||||
|
||||
The application is built using Maven. To run the application, you can utilise the `Makefile` provided in the repository.
|
||||
|
||||
The project is packaged as a Docker container, making it easy to deploy. You can build and run the Docker container using the following commands:
|
||||
|
||||
``` bash
|
||||
|
||||
docker compose build org_backend
|
||||
|
||||
docker compose up -d org_backend
|
||||
|
||||
# Alternatively:
|
||||
docker compose down && docker compose build --no-cache && docker compose up -d
|
||||
|
||||
# To check logs
|
||||
|
||||
docker logs -f org_backend
|
||||
|
||||
```
|
||||
|
||||
# Bruno
|
||||
|
||||
Bruno is used for testing the backend API endpoints. It is a simple HTTP client that allows you to send requests to the backend and view the responses. I used the OpenAPI specification to generate Bruno tests for each endpoint.
|
||||
|
||||
# Authentication
|
||||
|
||||
The backend exposes public `/api/auth/register` and `/api/auth/login` endpoints. The website has a login page only; users are created through the API, then the login page stores the returned JWT in the browser.
|
||||
|
||||
Protected requests include:
|
||||
|
||||
``` text
|
||||
Authorization: Bearer <jwt-token>
|
||||
```
|
||||
|
||||
# Future?
|
||||
|
||||
## Integration with `notes.zainezq.com`
|
||||
|
||||
As the API is primarily used by `zainezq.com`, I want to think of ways that `notes.zainezq.com` could also use it. This website is used to store all my notes, and they are exported using `org-publish` in Emacs. Perhaps I could write an Emacs Lisp package that interacts with the backend API to store and retrieve notes.
|
||||
|
||||
Flow of how a note would be written:
|
||||
|
||||
1. User writes a note in `notes.zainezq.com` as org mode.
|
||||
2. When the note is saved, a POST request is sent to the backend API with the note content.
|
||||
3. The backend API stores the note in the database.
|
||||
4. This will trigger a function that republishes the notes website to include the new note.
|
||||
|
||||
****Need to think more about this.****
|
||||
|
||||
# Update
|
||||
|
||||
The org-backend is no longer hosted using docker, it is now using systemd. The backend is still built using Maven, but it is now deployed as a standalone application rather than a Docker container.
|
||||
|
||||
Here are the commands needed:
|
||||
|
||||
``` bash
|
||||
|
||||
# To build the application
|
||||
mvn clean package -DskipTests
|
||||
|
||||
# To run the application
|
||||
java -jar target/org_backend-1.0.0-SNAPSHOT.jar
|
||||
|
||||
# systemctl commands
|
||||
sudo systemctl start org_backend
|
||||
sudo systemctl stop org_backend
|
||||
sudo systemctl restart org_backend
|
||||
sudo systemctl status org_backend
|
||||
|
||||
# To check logs
|
||||
journalctl -u org_backend -f
|
||||
|
||||
```
|
||||
22
Technical/Server/Server MOC.md
Executable file
22
Technical/Server/Server MOC.md
Executable file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
note type:
|
||||
- moc
|
||||
- server
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
- [[Old Nextcloud]]
|
||||
|
||||
- [[Old NGINX Code]]
|
||||
|
||||
- [[Actual (finance)]]
|
||||
|
||||
- [[Server Backend]]
|
||||
|
||||
- [[Nextcloud]]
|
||||
|
||||
- [[Vaultwarden]]
|
||||
|
||||
- [[Cloudflare]]
|
||||
|
||||
- [[Gitea]]
|
||||
16
Technical/Server/Vaultwarden.md
Executable file
16
Technical/Server/Vaultwarden.md
Executable file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
note type:
|
||||
- note
|
||||
- server
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
Just ran into an issue where the IOS app was failing due to the latest version of bitwarden not being installed on the server. To fix this:
|
||||
|
||||
``` bash
|
||||
|
||||
docker compose pull
|
||||
|
||||
docker compose up -d
|
||||
|
||||
```
|
||||
40
Technical/Technical MOC.md
Executable file
40
Technical/Technical MOC.md
Executable file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
note type:
|
||||
- moc
|
||||
- technical
|
||||
date: 2026-06-03
|
||||
done: true
|
||||
---
|
||||
In this file I want to include technical information (things related to programming, coding and networking etc):
|
||||
|
||||
- [Programming Projects](id:d63abaad-15e8-45d8-aafb-c634164ec0c0)
|
||||
|
||||
- [AOC Notes](id:e7f2302b-16eb-476d-a7b9-be12f077819d)
|
||||
|
||||
- [Web Port Notes](id:348df473-6443-4f4a-b366-95397b574989)
|
||||
|
||||
- [Github Notes](id:ee6047b0-c878-4ec8-a1cf-9daf5c8f5b8e)
|
||||
|
||||
- [Linux MOC](id:bdb493df-db92-4c93-9558-0b10fdff3048)
|
||||
|
||||
- [Database MOC](id:e448cd99-afee-4702-947f-644bb34dc1aa)
|
||||
|
||||
- [Emacs MOC](id:8fa3f476-6152-45f4-b618-50f1e4bce46c)
|
||||
|
||||
- [Networking MOC](id:0880f089-a5ad-49cd-8ce3-f020a5941313)
|
||||
|
||||
- [Leetcode Notes](id:9d1cfccc-8da7-41a3-b435-9857f0abe441)
|
||||
|
||||
- [Haskell Notes](id:347d2663-515b-4d9a-9ee9-7706ee86a845)
|
||||
|
||||
- [C Notes](id:5a207a1c-6f02-40d5-b42e-38daaa0aec10)
|
||||
|
||||
- [Java MOC](id:ae343652-96fe-4341-8a36-ec3a1abd0dc6)
|
||||
|
||||
- [Server MOC](id:f09cb4ed-1407-4187-9002-de2c5db13a8f)
|
||||
|
||||
- [Technical Commonplace](id:37495d5f-2a77-40bc-b45c-8163189bbe6b)
|
||||
|
||||
- [Concepts](id:22737796-6D31-49D5-84F2-F7BC73E45144)
|
||||
|
||||
- [Website Stuff](id:84c371ea-6789-450e-978c-f1d77e725f4b)
|
||||
Reference in New Issue
Block a user