Wave changes

This commit is contained in:
2026-03-27 15:39:35 +00:00
parent cb3e4c5809
commit bddb928ec2
253 changed files with 7056 additions and 1727 deletions

View File

@@ -0,0 +1,16 @@
:PROPERTIES:
:ID: 9d5aae0f-4ae1-49a5-a047-9099baad0a06
:END:
#+title: i3-wm
#+filetags: :guide:
* Commands:
*Mod1 = Win Key*
$mod+Enter = Open Terminal
$mod+s = Stacked layout
$mod+e = Default layout
$mod+d = dmenu
* Config file:

View File

@@ -0,0 +1,11 @@
:PROPERTIES:
:ID: bdb493df-db92-4c93-9558-0b10fdff3048
:END:
#+title: linux_moc
#+filetags: :index:linux:
- [[id:7612a9a6-ae70-4525-93a0-81bac857df39][wacom-notes]]
- [[id:bf277242-4f09-46a2-aa6b-1d75ce0025ac][systemd_services]]
- [[id:30c28e5e-0b1c-43ae-b3bd-eb31023f8b73][gpg-encryption]]
- [[id:569a4a57-1843-4821-8259-17762855985e][linux-arch-linux]]
- [[id:9d5aae0f-4ae1-49a5-a047-9099baad0a06][i3-wm]]

View File

@@ -0,0 +1,17 @@
:PROPERTIES:
:ID: bdb493df-db92-4c93-9558-0b10fdff3048
:END:
#+title: Linux MOC
#+filetags: :linux:moc:
- [[id:7612a9a6-ae70-4525-93a0-81bac857df39][wacom-notes]]
- [[id:bf277242-4f09-46a2-aa6b-1d75ce0025ac][systemd_services]]
- [[id:30c28e5e-0b1c-43ae-b3bd-eb31023f8b73][gpg-encryption]]
- [[id:569a4a57-1843-4821-8259-17762855985e][linux-arch-linux]]
- [[id:9d5aae0f-4ae1-49a5-a047-9099baad0a06][i3-wm]]
- [[id:0217f537-442a-4593-8c69-d481f0d1f2a8][keyboard]]

View File

@@ -0,0 +1,58 @@
:PROPERTIES:
:ID: 7612a9a6-ae70-4525-93a0-81bac857df39
:END:
#+title: wacom-notes
#+filetags: :hardware:linux:wacom:
The command: ~xsetwacom --list~ gave me:
#+BEGIN_SRC bash
Wacom One by Wacom M Pen stylus id: 12 type: STYLUS
Wacom One by Wacom M Pen eraser id: 13 type: ERASER
#+END_SRC
Then, in order to map the stylus to a single monitor i needed to know my monitor mappings via ~xrandr~:
#+begin_src 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)
#+end_src
Then I simply map it via:
~xsetwacom set "Wacom One by Wacom M Pen stylus" MapToOutput HEAD-0~

View File

@@ -0,0 +1,44 @@
:PROPERTIES:
:ID: bf277242-4f09-46a2-aa6b-1d75ce0025ac
:END:
#+title: systemd_services
#+filetags: :linux:systemd:
* 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_files/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

View File

@@ -0,0 +1,35 @@
:PROPERTIES:
:ID: 30c28e5e-0b1c-43ae-b3bd-eb31023f8b73
:END:
#+title: gpg-encryption
#+filetags: :linux:security:gpg:
If you want to encrypt a file, use the following command:
#+begin_src 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
#+end_src
and to decrypt, use:
#+begin_src 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.
#+end_src
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

View File

@@ -0,0 +1,16 @@
:PROPERTIES:
:ID: 569a4a57-1843-4821-8259-17762855985e
:END:
#+title: linux-arch-linux
#+filetags: :linux:arch:
* Links:
- https://www.geeksforgeeks.org/how-to-install-intellij-idea-on-arch-based-linux-distributionsmanjaro/
#+begin_src shell
sudo fuser -k 8000/tcp
#+end_src

View File

@@ -0,0 +1,9 @@
:PROPERTIES:
:ID: 99533f2d-a4e8-41d0-a605-c7d4cef6f995
:END:
#+title: self_hosting
#+filetags: :networking:self-hosting:index:
https://hub.docker.com/_/nextcloud
[[id:56f39be4-1108-4020-be5a-1f3a0fbf96fa][nextcloud]]

View File

@@ -0,0 +1,220 @@
:PROPERTIES:
:ID: 56f39be4-1108-4020-be5a-1f3a0fbf96fa
:END:
#+title: Nextcloud
#+filetags: :self-hosting:
* The docker file:
#+begin_src 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
#+end_src
* Database related things:
#+begin_src 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=#
#+end_src
* Permissions:
** *Not sure if the below still applies*
#+begin_src 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
#+end_src
** <2026-03-25 Wed> fixes:
Up To Date Fixes:
We need to add zaine to the www-data group:
#+begin_src bash
sudo usermod -aG www-data zaine
#+end_src
Then we need to make the directories setgid, so that any new files created will have the group www-data:
#+begin_src 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
#+end_src
*** 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:
#+begin_src bash
sudo chown -R www-data:www-data /home/zaine/master-folder
#+end_src
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:
#+begin_src 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"
#+end_src
One other thing:
#+begin_src 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
#+end_src
* Config
Location is:
sudo nano /var/lib/docker/volumes/nextcloud_nextcloud/_data/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:
#+begin_src 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!
#+end_src
** Connecting to IOS
https://www.reddit.com/r/NextCloud/comments/1pehpft/calendar_app_for_ios/

View File

@@ -0,0 +1,18 @@
:PROPERTIES:
:ID: f09cb4ed-1407-4187-9002-de2c5db13a8f
:END:
#+title: Server MOC
#+filetags: :moc:server:
[[id:2c2d8df4-ad36-40ab-9f30-8a047b372956][old_nextcloud_server_code]]
- [[id:a9829b5d-690d-4a21-ba94-ac8beac4d439][Old NGINX Config]]
- [[id:effa2bf5-8b04-42d3-b9c1-17160dc4ddc2][Actual]]
- [[id:9a71daa4-d9d4-4706-98f1-72e3d4eda9bc][Server Backend]]
- [[id:56f39be4-1108-4020-be5a-1f3a0fbf96fa][nextcloud]]
- [[id:e12ef44d-69a4-45c8-a823-c810d2c3857c][Vaultwarden]]

View File

@@ -0,0 +1,86 @@
:PROPERTIES:
:ID: 9a71daa4-d9d4-4706-98f1-72e3d4eda9bc
:END:
#+title: Server Backend
#+filetags: :server:java:api:
* 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:
[[https://gitea.zainezq.com/zaine/org_backend][Link to the backend repository]]
* 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:
#+begin_src 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
#+end_src
* 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.
* 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:
#+begin_src 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
#+end_src

View File

@@ -0,0 +1,15 @@
:PROPERTIES:
:ID: e12ef44d-69a4-45c8-a823-c810d2c3857c
:END:
#+title: Vaultwarden
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:
#+begin_src bash
docker compose pull
docker compose up -d
#+end_src