Compare commits

..

No commits in common. "175c2347b9e02eedced4128c4df10fbb81945f5f" and "c978b2a777dcf7a98e88f4ace413b219a3fa2fed" have entirely different histories.

4 changed files with 61 additions and 68 deletions

View File

@ -217,40 +217,41 @@ int process_md(article_info article, char **out)
while (buff[i + 2 + n] != ']') while (buff[i + 2 + n] != ']')
n++; n++;
if (buff[i + 2 + n + 1] == '(') { if (buff[i + 2 + n + 1] != '(')
int k = 0; continue;
while (buff[i + 2 + n + 2 + k] != ')')
k++;
char *internal_text = malloc(n + 1); int k = 0;
memcpy(internal_text, buff + i + 2, n); while (buff[i + 2 + n + 2 + k] != ')')
internal_text[n] = '\0'; k++;
char *src = malloc(k + 1); char *internal_text = malloc(n + 1);
memcpy(src, buff + i + 2 + n + 2, k); memcpy(internal_text, buff + i + 2, n);
src[k] = '\0'; internal_text[n] = '\0';
size_t append_line_length = snprintf(NULL, 0, "<a href=\"%s\"><img src=\"%s\" alt=\"%s\"></a>", src, src, internal_text) + 1; char *src = malloc(k + 1);
char *append = malloc(append_line_length); memcpy(src, buff + i + 2 + n + 2, k);
char *tmp_out = realloc(*out, strlen(*out) + append_line_length); src[k] = '\0';
if (append == NULL || tmp_out == NULL)
{
perror("Couldn't allocate memory for new element");
continue;
}
*out = tmp_out;
snprintf(append, append_line_length, "<a href=\"%s\"><img src=\"%s\" alt=\"%s\"></a>", src, src, internal_text);
strcat(*out, append);
i += 2 + n + 2 + k;
free(append);
free(src);
free(internal_text);
size_t append_line_length = snprintf(NULL, 0, "<a href=\"%s\"><img src=\"%s\" alt=\"%s\"></a>", src, src, internal_text) + 1;
char *append = malloc(append_line_length);
char *tmp_out = realloc(*out, strlen(*out) + append_line_length);
if (append == NULL || tmp_out == NULL)
{
perror("Couldn't allocate memory for new element");
continue; continue;
} }
*out = tmp_out;
snprintf(append, append_line_length, "<a href=\"%s\"><img src=\"%s\" alt=\"%s\"></a>", src, src, internal_text);
strcat(*out, append);
i += 2 + n + 2 + k;
free(append);
free(src);
free(internal_text);
continue;
} }
if (buff[i] == '[') if (buff[i] == '[')
@ -259,40 +260,41 @@ int process_md(article_info article, char **out)
while (buff[i + 1 + n] != ']') while (buff[i + 1 + n] != ']')
n++; n++;
if (buff[i + 1 + n + 1] == '(') { if (buff[i + 1 + n + 1] != '(')
int k = 0; continue;
while (buff[i + 1 + n + 2 + k] != ')')
k++;
char *internal_text = malloc(n + 1); int k = 0;
memcpy(internal_text, buff + i + 1, n); while (buff[i + 1 + n + 2 + k] != ')')
internal_text[n] = '\0'; k++;
char *href = malloc(k + 1); char *internal_text = malloc(n + 1);
memcpy(href, buff + i + 1 + n + 2, k); memcpy(internal_text, buff + i + 1, n);
href[k] = '\0'; internal_text[n] = '\0';
size_t append_line_length = snprintf(NULL, 0, "<a href=\"%s\">%s</a>", href, internal_text) + 1; char *href = malloc(k + 1);
char *append = malloc(append_line_length); memcpy(href, buff + i + 1 + n + 2, k);
char *tmp_out = realloc(*out, strlen(*out) + append_line_length); href[k] = '\0';
if (append == NULL || tmp_out == NULL)
{
perror("Couldn't allocate memory for new element");
continue;
}
*out = tmp_out;
snprintf(append, append_line_length, "<a href=\"%s\">%s</a>", href, internal_text);
strcat(*out, append);
i += 1 + n + 2 + k;
free(append);
free(href);
free(internal_text);
size_t append_line_length = snprintf(NULL, 0, "<a href=\"%s\">%s</a>", href, internal_text) + 1;
char *append = malloc(append_line_length);
char *tmp_out = realloc(*out, strlen(*out) + append_line_length);
if (append == NULL || tmp_out == NULL)
{
perror("Couldn't allocate memory for new element");
continue; continue;
} }
*out = tmp_out;
snprintf(append, append_line_length, "<a href=\"%s\">%s</a>", href, internal_text);
strcat(*out, append);
i += 1 + n + 2 + k;
free(append);
free(href);
free(internal_text);
continue;
} }
size_t len = strlen(*out); size_t len = strlen(*out);

View File

@ -5,7 +5,7 @@ Firstly, mount your Windows disk C: on Linux. For it, run:
``` ```
sudo pacman -S ntfs-3g sudo pacman -S ntfs-3g
sudo mkdir -p /mnt/c sudo mkdir -p /mnt/c
sudo mount /dev/&lt;Windows partition name> /mnt/c sudo mount /dev/<Windows partition name> /mnt/c
``` ```
WSL filesystem is stored as .vhdx file, so we will use qemu-nbd to mount it as usual disk drive. WSL filesystem is stored as .vhdx file, so we will use qemu-nbd to mount it as usual disk drive.
@ -26,7 +26,7 @@ sudo pacman -S qemu
Connect .vhdx file to nbd device: Connect .vhdx file to nbd device:
``` ```
sudo qemu-hbd -c /dev/nbd0 /mnt/c/&lt;path to .vhdx file> sudo qemu-hbd -c /dev/nbd0 /mnt/c/<path to .vhdx file>
``` ```
By default, path must look like Users/[user]/AppData/Local/Packages/[distro]/LocalState/[distroPackageName]/ext4.vhdx By default, path must look like Users/[user]/AppData/Local/Packages/[distro]/LocalState/[distroPackageName]/ext4.vhdx

View File

@ -11,7 +11,7 @@ sudo dnf install v4l2loopback
Next, after reboot, we're ready to start the stream with ffmpeg: Next, after reboot, we're ready to start the stream with ffmpeg:
```bash ```bash
sudo ffmpeg -f mjpeg -r 5 -i "http://&lt;Phone IP>:8080/cam.mjpeg?fps=10" -r 10 -pix_fmt yuv420p -f v4l2 /dev/video0 sudo ffmpeg -f mjpeg -r 5 -i "http://<Phone IP>:8080/cam.mjpeg?fps=10" -r 10 -pix_fmt yuv420p -f v4l2 /dev/video0
``` ```
My Wi-Fi connection speed was enough for such stream. But it is still possible to use it with adb port forwarding over usb: My Wi-Fi connection speed was enough for such stream. But it is still possible to use it with adb port forwarding over usb:

View File

@ -83,15 +83,6 @@ main li {
line-height: 30px; line-height: 30px;
} }
main pre {
font-size: 17px;
overflow-x: auto;
}
main code {
font-family: monospace;
}
main a:hover { main a:hover {
text-decoration: none; text-decoration: none;
} }