Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/JAlcocerT/Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
JAlcocerT committed Apr 9, 2024
2 parents e4b1282 + ea9fd9d commit f2419d8
Show file tree
Hide file tree
Showing 23 changed files with 687 additions and 84 deletions.
36 changes: 36 additions & 0 deletions Z_Linux_Installations_101/Cron_Examples/git_sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Define the base directory where the repositories are/will be located
BASE_DIR="/home/jalcocert/Desktop/GIT_SYNC/GITEA"

# Ensure the base directory exists
mkdir -p "$BASE_DIR"

# Define repository URLs - GITEA
REPO1_URL="http://192.168.3.200:3033/fossengineer/FOSSENGINEER.git"
REPO2_URL="http://192.168.3.200:3033/fossengineer/Py_Stocks.git"

# Define local directories (relative to BASE_DIR) where you want to pull the repositories
REPO1_DIR="${BASE_DIR}/FOSSENGINEER"
REPO2_DIR="${BASE_DIR}/Py_Stocks"

# Function to pull or clone a repository
pull_or_clone() {
local repo_url=$1
local repo_dir=$2

# Check if the directory exists and is a git repository
if [ -d "$repo_dir/.git" ]; then
echo "Updating $repo_dir from $repo_url"
git -C "$repo_dir" pull
else
echo "Cloning $repo_url into $repo_dir"
git clone "$repo_url" "$repo_dir"
fi
}

# Pull or clone each repository
pull_or_clone "$REPO1_URL" "$REPO1_DIR"
pull_or_clone "$REPO2_URL" "$REPO2_DIR"

echo "Operation completed."
88 changes: 88 additions & 0 deletions Z_Linux_Installations_101/Cron_Examples/git_sync_uptimekuma.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import requests
import datetime
from pathlib import Path
import subprocess

# Repositories to update: (URL, local directory name)
REPOSITORIES = [
("http://192.168.3.200:3033/fossengineer/FOSSENGINEER.git", "FOSSENGINEER"),
("http://192.168.3.200:3033/fossengineer/Py_Stocks.git", "Py_Stocks"),
]

BASE_DIR = "/home/jalcocert/Desktop/GIT_SYNC/GITEA3"
UPTIME_KUMA_PUSH_URL = "http://192.168.3.200:3001/api/push/Xe6iHxz97X?status=up&msg=OK&ping=" #"http://uptimekuma.mydomain.com/api/push/xyz"

def git_clone_or_pull(repo_url, local_dir):
"""Clones the repo if it doesn't exist, or pulls updates if it does."""
subprocess.run(["mkdir", "-p", str(local_dir)], check=True)
if (local_dir / ".git").exists():
print(f"Updating existing repository in {local_dir}")
subprocess.run(["git", "-C", str(local_dir), "pull"], check=True)
else:
print(f"Cloning new repository from {repo_url} into {local_dir}")
subprocess.run(["git", "clone", repo_url, str(local_dir)], check=True)

def update_status():
"""Sends a GET request to the Uptime Kuma monitoring endpoint."""
try:
response = requests.get(UPTIME_KUMA_PUSH_URL)
response.raise_for_status()
print("Status update sent successfully.")
except requests.RequestException as e:
print(f"Failed to send status update to Uptime Kuma: {e}")

def main():
for repo_url, repo_dir in REPOSITORIES:
git_clone_or_pull(repo_url, Path(BASE_DIR) / repo_dir)

# Send a GET request to Uptime Kuma's push URL to signal success
update_status()

if __name__ == "__main__":
main()



# import subprocess
# import requests
# import datetime

# # Repositories to update: (URL, local directory name)
# REPOSITORIES = [
# ("http://192.168.3.200:3033/fossengineer/FOSSENGINEER.git", "FOSSENGINEER"),
# ("http://192.168.3.200:3033/fossengineer/Py_Stocks.git", "Py_Stocks"),
# ]

# BASE_DIR = "/home/jalcocert/Desktop/GIT_SYNC/GITEA2"
# STATUS_ENDPOINT = "http://yourserver:5000/update_status"

# def git_clone_or_pull(repo_url, local_dir):
# """Clones the repo if it doesn't exist, or pulls updates if it does."""
# subprocess.run(["mkdir", "-p", local_dir], check=True)
# if (local_dir / ".git").exists():
# print(f"Updating existing repository in {local_dir}")
# subprocess.run(["git", "-C", local_dir, "pull"], check=True)
# else:
# print(f"Cloning new repository from {repo_url} into {local_dir}")
# subprocess.run(["git", "clone", repo_url, local_dir], check=True)

# def update_status(message):
# """Sends a status update to the monitoring endpoint."""
# try:
# response = requests.post(STATUS_ENDPOINT, data=message)
# response.raise_for_status()
# print("Status update sent successfully.")
# except requests.RequestException as e:
# print(f"Failed to send status update: {e}")

# def main():
# from pathlib import Path
# for repo_url, repo_dir in REPOSITORIES:
# git_clone_or_pull(repo_url, Path(BASE_DIR) / repo_dir)

# # Update the monitoring endpoint with completion status
# now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# update_status(f"Git sync script completed successfully at {now}")

# if __name__ == "__main__":
# main()
36 changes: 36 additions & 0 deletions Z_Linux_Installations_101/Cron_Examples/git_sync_v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Define the base directory where the repositories are/will be located
BASE_DIR="/home/jalcocert/Desktop/GIT_SYNC/GITEA"

# Ensure the base directory exists
mkdir -p "$BASE_DIR"

# Function to pull or clone a repository
pull_or_clone() {
local repo_url=$1
local repo_dir=$2

# Ensure the directory exists for the repo
mkdir -p "$repo_dir"

# Check if the directory exists and is a git repository
if [ -d "$repo_dir/.git" ]; then
echo "Updating $repo_dir from $repo_url"
git -C "$repo_dir" pull
else
echo "Cloning $repo_url into $repo_dir"
git clone "$repo_url" "$repo_dir"
fi
}

# Loop through the arguments two by two (URL and DIR)
while (( "$#" >= 2 )); do
repo_url=$1
repo_dir="${BASE_DIR}/$2"
pull_or_clone "$repo_url" "$repo_dir"
# Shift by two to get to the next pair of arguments
shift 2
done

echo "Operation completed."
12 changes: 12 additions & 0 deletions Z_Linux_Installations_101/Cron_Examples/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* <https://jalcocert.github.io/Linux/docs/debian/useful_tools/#crontab-tasks>

* v1 - hardcoded repositories
* v2 - listed repositories

```sh
chmod +x /home/jalcocert/Desktop/GIT_SYNC/git_sync_v2.sh
/home/jalcocert/Desktop/GIT_SYNC/git_sync_v2.sh http://192.168.3.200:3033/fossengineer/FOSSENGINEER FOSSENGINEER http://192.168.3.200:3033/fossengineer/Py_Stocks Py_Stocks
```


@reboot /home/jalcocert/Desktop/GIT_SYNC/git_sync_v2.sh http://192.168.3.200:3033/fossengineer/BachataMeetv2-Astro BachataMeetv2-Astro http://192.168.3.200:3033/fossengineer/CyclingThere2 CyclingThere2 >> /home/jalcocert/Desktop/GIT_SYNC/git_sync_v2.log 2>&1
2 changes: 1 addition & 1 deletion content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Linux is an **open-source operating system** that is used in a variety of device
subtitle="LLMs with Linux - Linux nature is Open Source - Same like these LLMs that you can use with your Laptop (no GPU required)."
class="aspect-auto md:aspect-[1.1/1] max-lg:min-h-[340px]"
style="background: radial-gradient(ellipse at 50% 80%,rgba(221,210,59,0.15),hsla(0,0%,100%,0));"
link="https://jalcocert.github.io/Linux/docs/linux__cloud.md/llms/"
link="https://jalcocert.github.io/Linux/docs/linux__cloud/llms/"
>}}
{{< hextra/feature-card
Expand Down
7 changes: 5 additions & 2 deletions content/docs/Arch/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,21 @@ While Arch Linux demands a deeper understanding of Linux and requires users to c

* [Pacman](https://jalcocert.github.io/Linux/docs/arch/garuda/#pacman---garuda-package-manager)

> Here you have [this Gist](https://gist.github.com/JAlcocerT/9865a045b2b86adb41fad71e4beddc06) with some usefull installs on Arch.♻️*There are similar ones for [Ubuntu](https://gist.github.com/JAlcocerT/197667ec5ec0da53e78eb58c4253a73f), even [Windows](https://gist.github.com/JAlcocerT/76f22ddf886277ef2653f82898c634d8)* ♻️.
> Here you have [**this Gist**](https://gist.github.com/JAlcocerT/9865a045b2b86adb41fad71e4beddc06) with some usefull installs on Arch.♻️*There are similar ones for [Ubuntu](https://gist.github.com/JAlcocerT/197667ec5ec0da53e78eb58c4253a73f), even [Windows](https://gist.github.com/JAlcocerT/76f22ddf886277ef2653f82898c634d8)* ♻️.
### SelfHosting with Arch

If you are used to deploy your favourite Apps with [Docker](https://jalcocert.github.io/Linux/docs/debian/docker/) (or [Podman](https://jalcocert.github.io/Linux/docs/debian/podman/)), congratulations, you can use them seamlessly with Arch as you do with Debian, mac or Windows.

For example:
{{% details title="Some examples" closed="true" %}}

* [Analytic Tools](https://jalcocert.github.io/Linux/docs/linux__cloud/analytics/)
* Local Gen AI - [LLMs](https://jalcocert.github.io/Linux/docs/linux__cloud/llms/)
* [SelfHosting](https://jalcocert.github.io/Linux/docs/linux__cloud/selfhosting/)

{{% /details %}}


### Benchmark with Arch

```sh
Expand Down
55 changes: 54 additions & 1 deletion content/docs/Arch/garuda.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Additionally, Garuda Linux also provides a graphical package manager called "Pam
* The Arch Linux Package Search: <https://archlinux.org/packages/>


{{% details title="Its as simple as this" closed="true" %}}

Update repos with:

```sh
Expand All @@ -41,6 +43,9 @@ And install packages with:
sudo pacman -S firefox
```

{{% /details %}}


> More examples [here](https://gist.github.com/JAlcocerT/9865a045b2b86adb41fad71e4beddc06).
### Useful Repositories
Expand All @@ -53,10 +58,17 @@ But the beauty is that anyone can contribute and publish their Apps at:
The AUR is a **community-driven repository** that contains a wide range of software packages not available in the official Arch Linux repositories. And we, as Garuda Linux users can also benefit from the AUR.


{{% details title="More about AUR" closed="true" %}}

When you visit these websites, you can use the search functionality to look for packages by name.

The AUR website is particularly useful for finding user-contributed packages that may not be in the official repositories. Once you find a package you want to install, you can note its name and use it with the pacman or yay command in the terminal, or search for it in the Pamac graphical package manager.

{{% /details %}}

<!-- https://itsfoss.com/rua-aur-tool/ -->


Remember that when installing packages from the AUR, you should follow the AUR guidelines and consider using an **AUR helper like yay** for better package management and dependency handling.

Lets install yay and use it to give us an [UI to manage packages](https://aur.archlinux.org/packages/pamac-all)
Expand All @@ -73,11 +85,45 @@ pamac-manager
### Gaming on Arch


{{% details title="How to Install Games in Garuda Linux" closed="true" %}}


* With Steam Platform (Thanks to [Proton](https://jalcocert.github.io/Linux/docs/debian/gaming/#steam-play--proton)):

```sh
sudo nano /etc/pacman.conf
#[multilib]
#Include=/etc/pacman.d/mirrorlist
sudo pacman -Sy

sudo pacman -S steam
yay -S protonup-qt
```

> Dont Forget to enable Steam Play as per [this guide](https://linuxiac.com/how-to-play-games-on-arch-linux-using-steam/)
* You also can with Lutris:

```sh
sudo pacman -S lutris

#example #https://lutris.net/games/ea-app/
```

{{% /details %}}
<!--
```sh
sudo pacman -Sy
sudo pacman -S steam
``` -->

{{% details title="How to use SteamOS with Docker in Garuda Linux" closed="true" %}}

Thanks to the project: <https://docs.linuxserver.io/images/docker-steamos/>

{{% /details %}}

---

## FAQ
Expand Down Expand Up @@ -196,4 +242,11 @@ Like Debian-based distributions:

Fixed releases prioritize stability and ease of maintenance but might not have the latest features as soon as they're released.

{{% /details %}}
{{% /details %}}


### How to Customize Garuda

Garuda is an impressive looking distro out of the box

* You can get their Art-Work from [this gitlab repo](https://gitlab.com/garuda-linux/themes-and-settings/artwork/garuda-wallpapers/-/blob/master/src/garuda-wallpapers/Dr460nized%20Honeycomb.png?ref_type=heads)
25 changes: 18 additions & 7 deletions content/docs/Debian/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,22 @@ sidebar:

Debian is a widely respected, stable Linux distribution known for its reliability, **extensive software repository**, and strong commitment to free and open-source software principles.

Debian provides users with a robust and well-maintained ecosystem of software packages, covering a wide range of applications and utilities. It offers multiple release branches, including the stable, testing, and unstable branches, allowing users to choose the level of stability and software freshness that suits their needs.

Debian's **package management system, [APT](https://jalcocert.github.io/Linux/docs/debian/linux_installing_apps/#apt)** (Advanced Package Tool), simplifies software installation, upgrades, and maintenance. The distribution **emphasizes system stability** and security, making it a popular choice for servers and mission-critical environments.

While Debian doesn't have the same "do-it-yourself" philosophy as [Arch Linux](https://jalcocert.github.io/Linux/docs/arch/), it provides a solid foundation for various use cases, including desktop computing, server hosting, and embedded systems. It's well-regarded for its community-driven development process and commitment to free software, making it a trusted choice for users who prioritize open-source principles and long-term support.
> Here you have a [GIST with examples](https://gist.github.com/JAlcocerT/197667ec5ec0da53e78eb58c4253a73f) ♻️
{{% details title="Get to Know! 🚀" closed="true" %}}

* Debian provides users with a robust and well-maintained ecosystem of software packages, covering a wide range of applications and utilities. It offers multiple release branches, including the stable, testing, and unstable branches, allowing users to choose the level of stability and software freshness that suits their needs.

* While Debian doesn't have the same "do-it-yourself" philosophy as [Arch Linux](https://jalcocert.github.io/Linux/docs/arch/), it provides a solid foundation for various use cases, including desktop computing, server hosting, and embedded systems.


{{% /details %}}



> It's well-regarded for its community-driven development process and commitment to free software, making it a trusted choice for users who **prioritize open-source principles and long-term support**.
<!-- {{< hextra/feature-card
title="Get Ubuntu"
Expand Down Expand Up @@ -45,7 +56,6 @@ While Debian doesn't have the same "do-it-yourself" philosophy as [Arch Linux](h




## Managing Packages in Debian

You might be wondering, where do I start to install my favourite Apps in Debian (most likely, in Ubuntu)?
Expand All @@ -54,7 +64,7 @@ You might be wondering, where do I start to install my favourite Apps in Debian

You can search for available Packages at: <https://tracker.debian.org/> - (For example: <https://tracker.debian.org/pkg/7zip>)

{{% details title="Check HOW" closed="true" %}}
{{% details title="Check HOW 🔥" closed="true" %}}

APT (Advanced Package Tool) is a package management system used in Debian-based Linux distributions, including Debian itself, Ubuntu, and many others. It simplifies the process of installing, updating, and managing software packages on your system. Here are some common APT commands and tasks:

Expand Down Expand Up @@ -112,15 +122,16 @@ These are some of the basic APT commands you can use to manage software packages

### Other Ways to Manage Packages with Debian

* With .deb files
* With tar files
* [Snap](https://jalcocert.github.io/Linux/docs/debian/linux_installing_apps/#snap)
* [Flatpak](https://jalcocert.github.io/Linux/docs/debian/linux_installing_apps/#flatpak)

* [Nix](https://jalcocert.github.io/Linux/docs/nix/)

* The already mentioned - [APT](https://jalcocert.github.io/Linux/docs/debian/linux_installing_apps/#apt)
* Or use it with [NALA](https://jalcocert.github.io/Linux/docs/debian/linux_installing_apps/#nala)

> A [Gist](https://gist.github.com/JAlcocerT/197667ec5ec0da53e78eb58c4253a73f) with useful installations for Debian
> A [Gist](https://gist.github.com/JAlcocerT/197667ec5ec0da53e78eb58c4253a73f) with useful installations for Debian ♻️
### How to Install HomeBrew in Linux

Expand Down
4 changes: 4 additions & 0 deletions content/docs/Debian/content_creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ flatpak run com.obsproject.Studio
#nix-shell -p obs-studio
```

### Snapshots

* [Spectacle](https://github.com/KDE/spectacle)


### Editing Videos in Linux

Expand Down
Loading

0 comments on commit f2419d8

Please sign in to comment.