Switch theme to Doks

This commit is contained in:
2021-01-31 00:54:37 -08:00
commit 98666f3a08
150 changed files with 24437 additions and 0 deletions

4
content/docs/_index.md Normal file
View File

@@ -0,0 +1,4 @@
---
title: "Docs"
draft: false
---

View File

@@ -0,0 +1,8 @@
---
title: "AdvMake Docs"
draft: false
description: "Documentation for the AdvMake build system"
menu:
docs:
parent: "docs"
---

View File

@@ -0,0 +1,242 @@
---
title: "Build Files"
draft: false
description: "Understanding AdvMake Build Files"
---
{{< button-gitea color="green" project="advmake" text="AdvMake" >}}
{{< button-gitlab color="OrangeRed" project="advmake" text="AdvMake" >}}
### Format
AdvMake uses [Starlark](https://github.com/bazelbuild/starlark) as the format for its build files.
Extra builtins are also defined for both convenience and extra functionality.
Starlark is a Python-like language meant for configuration files.
### Configuration
Build files are by default called `AdvMakefile`, but that can be set via `-f`
An AdvMakefile example can be found at AdvMake's repo as it uses AdvMake itself.
AdvMake runs functions exposed by starlark in the format `<name>_<target>`.
To set the default name and target, the global variables `defaultName`, and `defaultTarget` must be set.
Here is an example from AdvMake's AdvMakefile:
```python
defaultName = "advmake"
defaultTarget = "build"
```
This will tell AdvMake to run the function `advmake_build()` when run with no arguments.
If AdvMake is run with one argument (such as `advmake install`), it will use the default name with the specified target,
so in that case, it would run `advmake_install()`.
If run with two arguments, AdvMake will use the first argument as the name and the second as the target.
So, running `advmake hello world` would run the function `hello_world()`.
### Builtins
As previously mentioned, AdvMake comes with extra builtins. Those are as follows:
#### `log()`
The log function uses zerolog in go to log a message to STDOUT. It has two arguments.
The first is a string with the message to log, and the second is `level` which is optional
Examples:
```python
log("Info log") # Default level is info
log("Warn log", level="warn") # Warn level log
log("Debug log", level="debug") # Debug level log
log("Fatal log", level="fatal") # Fatal level log. This will exit the program when executed
```
---
#### `execute()`
The execute function runs a script using `sh -c`. This function has three arguments.
The first is required and is a string with the script to run, the second is `output`
which is optional. It can be set to `return`, `stdout`, or `both`, and the default is `both`.
The `output` argument controls where the script's output will be directed:
- `return`: Returns script output as string
- `stdout`: Prints script output to STDOUT, returning nothing
- `both`: Prints to STDOUT and returns as string
The third argument is `concurrent` which can be either `True` or `False`, default `False`.
If `concurrent` is set to `True`, all the lines in the script will be split and run concurrently
via goroutines. The maximum threads for goroutines can be controlled using the `GOMAXPROCS` environment
variable and is by default the amount of CPU cores present.
Examples:
```python
user = execute("whoami") # This will print the username to STDOUT and set the user variable to it
user = execute("whoami", output="return") # This will set the user variable to the username but not print it
execute("""
cp file destination
mv destination destination-1
echo 'hello world'
""") # Example of a multiline script
execute("""
install -Dm755 program /usr/bin
install -Dm755 program.cfg /etc
""", concurrent=True) # Example of a concurrent multiline script
```
---
#### `getEnv()`
The getEnv function simply returns the value of the environment variable specified in its first argument.
Example:
```python
term = getEnv("TERM") # Sets variable term to value of $TERM
print("Nice " + term) # Prints "Nice $TERM"
```
---
#### `setEnv()`
The setEnv function sets an environment variable. It has three arguments.
The first is the key, it is the name of the environment variable.
The second is the new value, what the key should be set to.
The third is optional, it is `onlyIfUnset` and it can be set to `True` or `False`, default `False`
`onlyIfUnset` checks that the variable is not already set before setting it, this can be useful for
setting defaults.
Examples:
```python
setEnv("MY_ENV_VAR", "Hello, World") # Sets $MY_ENV_VAR to "Hello, World"
setEnv("CC", "gcc", onlyIfUnset=True) # Sets $CC to "gcc", but only if $CC is not already set
```
---
#### `expandFile()`
The expandFile function replaces all instances of $VAR with the value specified.
expandFile has two arguments. The first accepts a filename to modify.
The second accepts a dictionary to act as mappings for value replacements.
Example:
```python
expandFile("a.txt", {"A": "Hello", "B": "World"}) # Replace $A with Hello and $B with world in file a.txt
```
---
#### `download()`
The download function downloads a file at a URL.
download has two arguments. The first is a URL, and the second is an optional
argument called `filename`. If `filename` is not provided, the filename will
be taken from the URL.
Examples:
```python
download("https://www.arsenm.dev/logo-white.png") # Downloads logo-white.png
download("https://www.arsenm.dev/logo-white.png", filename="logo.png") # Downloads logo-white.png as logo.png
```
---
#### `lookPath()`
The lookPath function uses go's `exec.LookPath()` to find the absolute path of a command.
It has a single argument which is the command to look for. If a command is not found, lookPath
returns `-1`.
Examples:
```python
lookPath("sh") # /bin/sh
lookPath("nonExistentCommand") # -1
```
---
#### `userChoice()`
The userChoice function presents the user with a choice. It has two arguments. The first
is a prompt to be displayed to the user, and the second is a list of choices.
Example:
```python
userChoice("Choose command", ["find", "ls"])
# This returns:
# [1] "find"
# [2] "ls"
# Choose command:
```
The function will return the chosen object (if input to above is `1`, function returns `"find"`)
---
#### `input()`
The input function is a simple function that uses go's `fmt.Print()` and `fmt.Scanln()` to replicate
the functionality of python's `input()` function. It has a single argument, which is the prompt and returns
the inputted text.
Example:
```python
x = input("Name: ") # This will print "Name: " and then wait for input.
```
---
#### `fileExists()`
The fileExists function checks if a specified file exists and is accessible in the filesystem. It has a single
argument which is the path to the file being checked, and returns a boolean reflecting the state of the file.
Examples:
```python
if fileExists("/etc/passwd"):
print("/etc/passwd exists!") # /etc/passwd exists!
if fileExists("/abcdef"):
print("/abcdef exists!") # No output because /abcdef most likely does not exist
```
---
#### `getOS()`
The getOS function returns the value of `runtime.GOOS`. It has no arguments.
Example:
```python
if getOS() == "linux":
print("This is Linux!")
```
---
#### `getArch()`
The getArch function returns the value of `runtime.GOARCH`. It has no arguments.
Example:
```python
if getArch() == "386":
print("x86 32-bit")
```
---
#### `getCPUNum()`
The getCPUNum function returns the amount of CPUs available to AdvMake. It has no arguments.
Example:
```python
print(getCPUNum() + " CPUs available!")
```
---

View File

@@ -0,0 +1,50 @@
---
title: "Installation"
draft: false
description: "Installing AdvMake"
---
{{< button-gitea color="green" project="advmake" text="AdvMake" >}}
{{< button-gitlab color="OrangeRed" project="advmake" text="AdvMake" >}}
## Building from source
### Downloading
AdvMake is hosted on my Gitea instance. If that is down, it is also mirrored on Gitlab.
To download AdvMake, you can either use the download button on Gitea or Gitlab, or
you can use the git CLI
To clone AdvMake using the CLI, run one of the following commands:
```bash
git clone https://gitea.arsenm.dev/Arsen6331/advmake.git
OR
git clone https://gitlab.com/moussaelianarsen/advmake.git
```
### Building
AdvMake is written in Go. This means go must be installed on your computer. Most
linux distros call the package that provides it either `go` or `golang`.
Once go is installed, you can check that it runs by running
```bash
go version
```
To compile AdvMake, run
```bash
go build
```
### Installing
To install AdvMake, run:
```bash
sudo install -Dm755 advmake /usr/bin
```
Once the command completes, AdvMake should be ready and you can run the following to make sure it works:
```bash
advmake -h
```

View File

@@ -0,0 +1,8 @@
---
title: "KbdEmu Docs"
draft: true
description: "Documentation for KbdEmu, the HID emulator"
menu:
docs:
parent: "docs"
---

View File

@@ -0,0 +1,70 @@
---
title: "Installation"
draft: false
description: "Installing kbdemu"
---
{{< appveyor-ci project="kbdemu" projectID="km2f1wiy7enuh6il" >}}
{{< minio-s3 project="kbdemu" >}}
## Using precompiled binary
KbdEmu uses continuous integration to compile. You can find the binary by
clicking the CI badge above, selecting "Ubuntu2004" for the linux build or
"macOS" for the macOS build, and then going to the artifacts tab.
## Building from source
### Downloading
KbdEmu is hosted in two places, Gitea and Gitlab. Either one can be used as
it is mirrored from Gitea to Gitlab
{{< button-gitea color="green" project="kbdemu" text="KbdEmu" >}}
{{< button-gitlab color="OrangeRed" project="kbdemu" text="KbdEmu" >}}
To download kbdemu, you can either use the download button on one of the above, or
you can use the git command
To clone kbdemu using the command, run one of the following commands:
```bash
git clone https://gitea.arsenm.dev/Arsen6331/kbdemu
OR
git clone https://gitlab.com/moussaelianarsen/kbdemu
```
Now, you will want to `cd` into the root of this repo before completing the rest
of these instructions
### Building
Since KbdEmu is written in go, you will need go installed in order to compile it.
Most linux distros call the package providing it either `go` or `golang`.
Once go is installed, you can check that it runs by running
```bash
go version
```
To compile KbdEmu, run the following commands:
```bash
go get github.com/go-vgo/robotgo
go get github.com/BurntSushi/toml
go get github.com/rs/zerolog/log
source .envrc
go build
```
### Installing
To install kbdemu, run the following command:
```bash
sudo install -Dm755 kbdemu /usr/bin
```
Once this command completes, to test whether kbdemu was installed properly, run
this command:
```bash
kbdemu
```
You should get an error warning you that kbdemu cannot find a TOML file. If you do,
kbdemu is properly installed.

View File

@@ -0,0 +1,69 @@
---
title: "Usage"
draft: false
description: "Using kbdemu"
---
{{< appveyor-ci project="kbdemu" projectID="km2f1wiy7enuh6il" >}}
{{< minio-s3 project="kbdemu" >}}
This page assumes you have already installed KbdEmu. If not, follow the installation
instructions on the installation page.
{{< button text="Installation" link="../installation" color="blue">}}
### Configs
KbdEmu uses TOML configs to tell it what to do. This is the example config which
contains all supported features:
```toml
[[action]]
type = "var"
action = "set key to z"
[[action]]
type = "kbd"
action = "hold key @key@"
[[action]]
type = "misc"
action = "wait 1 second"
[[action]]
type = "kbd"
action = "release key @key@"
[[action]]
type = "kbd"
action = "press space"
[[action]]
type = "kbd"
action = "type AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
[[action]]
type = "mse"
action = "scroll up 5"
[[action]]
type = "mse"
action= "right click"
[[action]]
type = "mse"
action = "move to {0,0}"
[[action]]
type = "misc"
action = "show message Actions complete!"
```
As you can see, the configs are pretty simple. Here is a list of all the currently
supported features:
{{<table "f6 w-100 mw8 center">}}
| Var Type | Misc Type | Kbd Type | Mse Type |
|-------------------|-------------------|--------------|----------------|
| Setting Variables | Delays | Hold Keys | Scrolling |
| | Showing Messages | Release Keys | Mouse Clicks |
| | | Type Strings | Mouse Movement |
{{</table>}}

View File

@@ -0,0 +1,8 @@
---
title: "OpenSend Docs"
draft: false
description: "Documentation for the OpenSend file sharing program"
menu:
docs:
parent: "docs"
---

View File

@@ -0,0 +1,37 @@
---
title: "GUI"
draft: false
description: "Opensend fyne GUI"
---
{{< appveyor-ci project="opensend" projectID="wrv3bbuujw57578h" >}}
{{< minio-s3 project="opensend" >}}
This page assumes you have already installed Opensend. If not, follow the installation
instructions on the installation page.
{{< button text="Installation" link="../installation" color="blue">}}
### GUI Installation
Opensend GUI has been written in golang using [fyne](https://fyne.io). Its source code can be found here:
{{< button-gitea text="Opensend GUI" project="opensend-gui" owner="opensend" color="green" >}}
To download Opensend GUI, run the following command
```bash
git clone https://gitea.arsenm.dev/opensend/opensend-gui.git
```
To build Opensend GUI, `go` must be installed. The process for that is explained in the installation instructions for Opensend. Once `go` is installed, run:
```bash
go build
```
This may take a while as `go` downloads and compiles Opensend GUI and Fyne.
Once the build is complete, there should be a file named `opensend-gui` in the directory. Run this file to open the GUI which should look like this:
{{< image src="/opensend/gui_start.webp" alt="Opensend GUI on start" >}}

View File

@@ -0,0 +1,60 @@
---
title: "Installation"
draft: false
description: "Installing opensend"
---
{{< appveyor-ci project="opensend" projectID="wrv3bbuujw57578h" >}}
{{< minio-s3 project="opensend" >}}
## Using precompiled binary
Opensend uses continuous integration to compile. You can find the binary by clicking the download binary badge above.
## Building from source
### Downloading
Opensend is hosted on Gitea.
{{< button-gitea color="green" project="opensend" owner="opensend" text="Opensend" >}}
To download opensend, you can either use the download button on one of the above, or
you can use the git command
To clone opensend using the command, run the following command:
```bash
git clone https://gitea.arsenm.dev/opensend/opensend.git
```
Now, you will want to `cd` into the root of this repo before completing the rest
of these instructions
### Building
Since Opensend is written in go, you will need go installed in order to compile it.
Most linux distros call the package providing it either `go` or `golang`.
Once go is installed, you can check that it runs by running
```bash
go version
```
To compile Opensend, run the following command:
```bash
make
```
### Installing
To install opensend, run one of the following commands:
```bash
sudo make install # Linux
sudo make install-macos # macOS
```
Once this command completes, to test whether opensend was installed properly, run
this command:
```bash
opensend -h
```
You should get the usage for opensend.

View File

@@ -0,0 +1,53 @@
---
title: "Usage"
draft: false
description: "Using opensend"
---
{{< appveyor-ci project="opensend" projectID="wrv3bbuujw57578h" >}}
{{< minio-s3 project="opensend" >}}
This page assumes you have already installed Opensend. If not, follow the installation
instructions on the installation page.
{{< button text="Installation" link="../installation" color="blue">}}
### Configuration
Opensend allows configuration by TOML and by command line flags. It looks at the following paths for configs in the specified order:
#### Config files
1. Config path from `--config` flag
2. `~/.config/opensend.toml`
3. `/etc/opensend.toml`
#### Command line flags
```text
Usage of opensend:
-d string
Data to send
-dest-dir string
Destination directory for files or dirs sent over opensend (default "/home/arsen/Downloads")
-r Receive data
-s Send data
-send-to string
Use IP address of receiver instead of mDNS
-skip-mdns
Skip zeroconf service registration (use if mdns fails)
-t string
Type of data being sent
```
The purpose of the mdns-skipping flags is to account for the iSH app in iOS, as the mdns resolver and registration fails on it.
### Algorithms and software used
- RSA for asymmetric encryption
- AES for symmetric encryption
- Tar for archiving directories
- Zstandard for compression
- Base91 for encoding
- Gob for serialization
- JSON for serialization
- TCP sockets for transfer
- Zeroconf/mDNS for device discovery

View File

@@ -0,0 +1,8 @@
---
title: "Pak Docs"
draft: false
description: "Documentation for the Pak package manager wrapper"
menu:
docs:
parent: "docs"
---

View File

@@ -0,0 +1,42 @@
---
title: "Configuration"
draft: false
description: "Configuring pak"
---
{{< appveyor-ci project="pak" projectID="e4yacqd78gkte8a0" >}}
{{< minio-s3 project="pak" >}}
### Config file
Pak uses a custom config file at `/etc/pak.cfg`. For example, this is what the
apt config looks like:
```cfg
# Write the name of the package manager in all lowercase below
apt
# Write a comma separated list of commands from the manager below
install,remove,update,upgrade,search,download
# Write "yes" or "no" depending on whether you want to use root
yes
# Write command to use for root
sudo
# Write a comma separated list of shortcuts below
rm,inst
# Write a comma separated list of shortcut mappings from the manager below
remove,install
```
This file is read by pak to tell it what to do. The comments above each keyword
explain what it's for.
Here is a list of all the fields and their uses:
1. Command to invoke the package manager.
2. Comma-separated list of commands supported by the package manager.
3. Whether or not to invoke the root command.
4. Command to use for root invocation (`sudo`, `doas`, etc.)
5. Comma-separated list of shortcuts for pak to accept
6. Comma-separated list of shortcut mappings (what each shortcut sends to the
package manager). These do not necessarily need to be in the commands list.
Once you have made the config, just place it at `/etc/pak.cfg` and pak will
automatically use it.

View File

@@ -0,0 +1,91 @@
---
title: "Installation"
draft: false
description: "Installing pak"
---
{{< appveyor-ci project="pak" projectID="e4yacqd78gkte8a0" >}}
{{< minio-s3 project="pak" >}}
## Using precompiled binary
Pak uses continuous integration to compile. You can find the binary either by
clicking the CI badge above or by going to the gitlab repo using the button below and
navigating to the releases.
{{< button-gitlab color="OrangeRed" project="pak" text="Pak" >}}
## Using the AUR
If you are running an arch-based linux distro, you can use the Arch User Repository
to install pak. First, make sure the `yay` AUR helper is installed, then run the following:
```bash
yay -S pak
```
## Building from source
### Downloading
Pak is hosted on my Gitea instance. If that is down, it is also mirrored on Gitlab.
{{< button-gitea color="green" project="pak" text="Pak" >}}
{{< button-gitlab color="OrangeRed" project="pak" text="Pak" >}}
To download pak, you can either use the download button on Gitea or Gitlab, or
you can use the git CLI
To clone pak using the CLI, run one of the following commands:
```bash
git clone https://gitea.arsenm.dev/Arsen6331/pak
OR
git clone https://gitlab.com/moussaelianarsen/pak
```
### Building
Pak is written in Go. This means go must be installed on your computer. Most
linux distros call the package that provides it either `go` or `golang`.
Once go is installed, you can check that it runs by running
```bash
go version
```
To compile pak, run
```bash
make
```
Then, you will need to figure out which package manager you have. Here is a list
of package managers with ready to use configs:
- apt
- aptitude
- brew
- yay (with wrapper)
- pacman (with wrapper)
- zypper
- snap
If your package manager is not in the list, you can make a config for it. Go to
the Configuration page for more information.
### Installing
If your package manager is in the list, use one of these:
- apt: `sudo make aptinstall`
- aptitude: `sudo make aptitude`
- brew: `sudo make brewinstall`
- yay: `sudo make yayinstall`
- pacman: `sudo make pacinstall`
- zypper: `sudo make zyppinstall`
- snap: `sudo make snapinstall`
- custom: `sudo make installbinonly`
Once the command completes, unless you're using a custom config, pak should be ready
and you can run the following to make sure it works:
```bash
pak
```
Go to the Configuration page for instructions on making a custom config, you **must**
have a config for pak to function.

28
content/docs/pak/usage.md Normal file
View File

@@ -0,0 +1,28 @@
---
title: "Usage"
draft: false
description: "Using pak"
---
{{< appveyor-ci project="pak" projectID="e4yacqd78gkte8a0" >}}
{{< minio-s3 project="pak" >}}
Using pak is simple, just run `pak` and one of the commands from the config file.
Pak understands partial commands, so these commands will be identical:
```bash
pak in <package>
OR
pak inst <package>
OR
pak install <package>
```
The lack of `sudo` is intentional. Pak will not allow running from root by default
as it already invokes root internally. To bypass this, simply give pak the `-r` flag.
Using shortcuts in pak is just as simple as commands, just run `pak` and a shortcut,
like this:
```bash
pak rm <package>
```