Compare commits
19 Commits
43ba680da8
...
master
Author | SHA1 | Date | |
---|---|---|---|
111aeb645a
|
|||
bd6cf38af1
|
|||
3efbddd3ee
|
|||
d7fe6cd476
|
|||
df3502ad40 | |||
9eea574547
|
|||
19ededd901
|
|||
be1de50862
|
|||
734557395d
|
|||
0bcee6162b
|
|||
84aa11f7c0
|
|||
578106404a
|
|||
175c2347b9
|
|||
a7d1d58a9c
|
|||
521bed1d55
|
|||
c978b2a777
|
|||
615ae35a0e
|
|||
0be879c3cb
|
|||
f6a9b7a405
|
4
.clang-format
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
IndentWidth: 4
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
ColumnLimit: 0
|
||||||
|
SortIncludes: false
|
1
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
tmp/
|
tmp/
|
||||||
build/
|
build/
|
||||||
.vscode/
|
|
||||||
a.out
|
a.out
|
||||||
test_*
|
test_*
|
||||||
**/exif.?
|
**/exif.?
|
24
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "C makefile launch",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"targetArchitecture": "x64",
|
||||||
|
"program": "${workspaceRoot}/build/server",
|
||||||
|
"args": ["5000"],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceRoot}",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": true,
|
||||||
|
"linux": {
|
||||||
|
"MIMode": "gdb",
|
||||||
|
},
|
||||||
|
"miDebuggerArgs": ""
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"utils.h": "c"
|
||||||
|
}
|
||||||
|
}
|
12
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build makefile project",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "make"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
Dockerfile
@ -4,7 +4,9 @@ RUN apk add --no-cache build-base
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY Makefile .
|
||||||
|
COPY src src/
|
||||||
|
COPY include include/
|
||||||
|
|
||||||
RUN make
|
RUN make
|
||||||
|
|
||||||
@ -12,8 +14,8 @@ FROM alpine
|
|||||||
|
|
||||||
WORKDIR /srv
|
WORKDIR /srv
|
||||||
|
|
||||||
COPY --from=builder /app .
|
COPY static static/
|
||||||
|
|
||||||
RUN apk add --no-cache gcompat
|
COPY --from=builder /app/build/server .
|
||||||
|
|
||||||
CMD ["build/server", "5000"]
|
CMD ["./server", "5000"]
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
void err_msg(char *msg);
|
void err_msg(char *msg);
|
||||||
char *concat_to_front(char **str1, char *str2);
|
char *prepend(char *dest, const char *prefix);
|
||||||
char *get_status_message(int status_code);
|
char *get_status_message(int status_code);
|
||||||
char *to_lower(char *str);
|
char *to_lower(char *str);
|
||||||
char *trim(char *str);
|
char *trim(char *str);
|
||||||
|
@ -45,7 +45,7 @@ int list_articles(article_info **articles)
|
|||||||
else
|
else
|
||||||
(*articles)[articles_amount - 1].title = strdup("No title");
|
(*articles)[articles_amount - 1].title = strdup("No title");
|
||||||
|
|
||||||
(*articles)[articles_amount - 1].content = malloc(0);
|
(*articles)[articles_amount - 1].content = NULL;
|
||||||
|
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ void free_article_info_arr(article_info **articles, int length)
|
|||||||
// /* Only for testing purposes */
|
// /* Only for testing purposes */
|
||||||
// int main()
|
// int main()
|
||||||
// {
|
// {
|
||||||
// article_info *articles = malloc(0);
|
// article_info *articles = NULL;
|
||||||
|
|
||||||
// int n = list_articles(&articles);
|
// int n = list_articles(&articles);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ int gen_html_article_list(article_info *articles, int n, char **out)
|
|||||||
// /* Only for testing purposes */
|
// /* Only for testing purposes */
|
||||||
// int main ()
|
// int main ()
|
||||||
// {
|
// {
|
||||||
// article_info *articles = malloc(0);
|
// article_info *articles = NULL;
|
||||||
|
|
||||||
// int n = list_articles(&articles);
|
// int n = list_articles(&articles);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ int process_md(article_info article, char **out)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snippet = "<pre><code>\n";
|
snippet = "<pre><code>";
|
||||||
is_in_code = 1;
|
is_in_code = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,9 +217,8 @@ 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] == '(')
|
||||||
continue;
|
{
|
||||||
|
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (buff[i + 2 + n + 2 + k] != ')')
|
while (buff[i + 2 + n + 2 + k] != ')')
|
||||||
k++;
|
k++;
|
||||||
@ -253,6 +252,7 @@ int process_md(article_info article, char **out)
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (buff[i] == '[')
|
if (buff[i] == '[')
|
||||||
{
|
{
|
||||||
@ -260,9 +260,8 @@ 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] == '(')
|
||||||
continue;
|
{
|
||||||
|
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (buff[i + 1 + n + 2 + k] != ')')
|
while (buff[i + 1 + n + 2 + k] != ')')
|
||||||
k++;
|
k++;
|
||||||
@ -296,6 +295,7 @@ int process_md(article_info article, char **out)
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
size_t len = strlen(*out);
|
size_t len = strlen(*out);
|
||||||
char *tmp_out = realloc(*out, len + 2);
|
char *tmp_out = realloc(*out, len + 2);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "../../include/file_op/file.h"
|
#include "../../include/file_op/file.h"
|
||||||
#include "../../include/utils_op/utils.h"
|
#include "../../include/utils_op/utils.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generate file path from request path provided
|
* @brief Generate file path from request path provided
|
||||||
@ -21,12 +22,31 @@ char *gen_file_path(char *req_path)
|
|||||||
path = strcat(path, "index.html");
|
path = strcat(path, "index.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *webroot = "static";
|
char webroot[PATH_MAX];
|
||||||
|
if (getcwd(webroot, PATH_MAX) == NULL)
|
||||||
|
goto exit_error;
|
||||||
|
|
||||||
path = realloc(path, strlen(path) + strlen(webroot) + 1);
|
if (PATH_MAX < strlen(webroot) + strlen("/static"))
|
||||||
path = concat_to_front(&path, webroot);
|
goto exit_error;
|
||||||
|
|
||||||
|
strcat(webroot, "/static");
|
||||||
|
|
||||||
|
path = prepend(path, webroot);
|
||||||
|
|
||||||
|
char resolved_path[PATH_MAX];
|
||||||
|
if (realpath(path, resolved_path) == NULL)
|
||||||
|
goto exit_error;
|
||||||
|
|
||||||
|
if (strncmp(resolved_path, webroot, strlen(webroot)) != 0)
|
||||||
|
{
|
||||||
|
goto exit_error;
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
|
exit_error:
|
||||||
|
free(path);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
char *get_mime_type(char *file_path)
|
char *get_mime_type(char *file_path)
|
||||||
{
|
{
|
||||||
char *ext = strchr(file_path, '.');
|
char *ext = strrchr(file_path, '.');
|
||||||
|
|
||||||
if (ext == NULL)
|
if (ext == NULL)
|
||||||
{
|
{
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
*/
|
*/
|
||||||
gallery_t *get_album_list()
|
gallery_t *get_album_list()
|
||||||
{
|
{
|
||||||
gallery_t *list = NULL, *curr = list;
|
gallery_t *list = NULL, *curr;
|
||||||
|
|
||||||
char **albums_titles_list = malloc(0);
|
char **albums_titles_list = NULL;
|
||||||
|
|
||||||
ssize_t albums_am = get_dir_list(&albums_titles_list, GALLERY_ROOT);
|
ssize_t albums_am = get_dir_list(&albums_titles_list, GALLERY_ROOT);
|
||||||
|
|
||||||
@ -50,18 +50,18 @@ gallery_t *get_album_list()
|
|||||||
*/
|
*/
|
||||||
void free_albums_list(gallery_t *albums_list)
|
void free_albums_list(gallery_t *albums_list)
|
||||||
{
|
{
|
||||||
gallery_t *curr_item = albums_list;
|
|
||||||
|
|
||||||
while (curr_item != NULL)
|
while (albums_list != NULL)
|
||||||
{
|
{
|
||||||
free(curr_item->title);
|
free(albums_list->title);
|
||||||
for (int i = 0; i < curr_item->img_am; i++)
|
for (int i = 0; i < albums_list->img_am; i++)
|
||||||
free_img_item(curr_item->images[i]);
|
free_img_item(albums_list->images[i]);
|
||||||
free(curr_item->images);
|
free(albums_list->images);
|
||||||
curr_item = curr_item->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
gallery_t *next_item = albums_list->next;
|
||||||
free(albums_list);
|
free(albums_list);
|
||||||
|
albums_list = next_item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,7 +154,17 @@ int get_album_imgs(img_t **images_arr, int *size, char *title)
|
|||||||
char *gen_gallery_html()
|
char *gen_gallery_html()
|
||||||
{
|
{
|
||||||
FILE *album_template_fp = fopen("static/gallery/album.html", "r");
|
FILE *album_template_fp = fopen("static/gallery/album.html", "r");
|
||||||
|
if (album_template_fp == NULL)
|
||||||
|
{
|
||||||
|
return "500 Internal Error\n";
|
||||||
|
}
|
||||||
|
|
||||||
FILE *image_template_fp = fopen("static/gallery/image.html", "r");
|
FILE *image_template_fp = fopen("static/gallery/image.html", "r");
|
||||||
|
if (image_template_fp == NULL)
|
||||||
|
{
|
||||||
|
fclose(album_template_fp);
|
||||||
|
return "500 Internal Error\n";
|
||||||
|
}
|
||||||
|
|
||||||
size_t album_file_size = get_file_size(album_template_fp) + 1;
|
size_t album_file_size = get_file_size(album_template_fp) + 1;
|
||||||
char *album_template = calloc(1, album_file_size);
|
char *album_template = calloc(1, album_file_size);
|
||||||
@ -218,12 +228,12 @@ char *gen_gallery_html()
|
|||||||
|
|
||||||
free(album_content);
|
free(album_content);
|
||||||
free(album_html);
|
free(album_html);
|
||||||
free(image_template);
|
|
||||||
|
|
||||||
albums_list_item = albums_list_item->next;
|
albums_list_item = albums_list_item->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(album_template);
|
free(album_template);
|
||||||
|
free(image_template);
|
||||||
free_albums_list(albums_list);
|
free_albums_list(albums_list);
|
||||||
|
|
||||||
return gallery_content;
|
return gallery_content;
|
||||||
|
@ -72,12 +72,13 @@ int get_listener_socket(char *port)
|
|||||||
*
|
*
|
||||||
* @param {struct sockaddr*} sa
|
* @param {struct sockaddr*} sa
|
||||||
* @return void*
|
* @return void*
|
||||||
*/
|
*/
|
||||||
void *get_in_addr(struct sockaddr *sa)
|
void *get_in_addr(struct sockaddr *sa)
|
||||||
{
|
{
|
||||||
if (sa->sa_family == AF_INET) {
|
if (sa->sa_family == AF_INET)
|
||||||
return &(((struct sockaddr_in*)sa)->sin_addr);
|
{
|
||||||
|
return &(((struct sockaddr_in *)sa)->sin_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return &(((struct sockaddr_in6*)sa)->sin6_addr);
|
return &(((struct sockaddr_in6 *)sa)->sin6_addr);
|
||||||
}
|
}
|
@ -16,6 +16,13 @@
|
|||||||
void res_404(int fd, char *path)
|
void res_404(int fd, char *path)
|
||||||
{
|
{
|
||||||
FILE *fp = fopen("static/404.html", "r");
|
FILE *fp = fopen("static/404.html", "r");
|
||||||
|
|
||||||
|
if (fp == NULL)
|
||||||
|
{
|
||||||
|
res_500(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const ssize_t fsize = 512;
|
const ssize_t fsize = 512;
|
||||||
char *buff = malloc(fsize), *msg = malloc(fsize);
|
char *buff = malloc(fsize), *msg = malloc(fsize);
|
||||||
|
|
||||||
@ -102,6 +109,13 @@ int send_response(int fd, char *req_path)
|
|||||||
{
|
{
|
||||||
char *file_path = gen_file_path(req_path);
|
char *file_path = gen_file_path(req_path);
|
||||||
|
|
||||||
|
if (file_path == NULL)
|
||||||
|
{
|
||||||
|
res_404(fd, req_path);
|
||||||
|
free(file_path);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct file_s *file = get_file_info(file_path);
|
struct file_s *file = get_file_info(file_path);
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
@ -121,6 +135,8 @@ int send_response(int fd, char *req_path)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int return_code = 0;
|
||||||
|
|
||||||
char *mime_type = get_mime_type(file_path);
|
char *mime_type = get_mime_type(file_path);
|
||||||
|
|
||||||
struct header_s *header = gen_header(200, file->size, mime_type);
|
struct header_s *header = gen_header(200, file->size, mime_type);
|
||||||
@ -130,15 +146,18 @@ int send_response(int fd, char *req_path)
|
|||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
{
|
{
|
||||||
err_msg("couldn't send header");
|
err_msg("couldn't send header");
|
||||||
return -1;
|
return_code = -1;
|
||||||
|
goto exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (send_file(fd, file) < 0)
|
if (send_file(fd, file) < 0)
|
||||||
{
|
{
|
||||||
err_msg("couldn't send file");
|
err_msg("couldn't send file");
|
||||||
return -1;
|
return_code = -1;
|
||||||
|
goto exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit_code:
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
free(header->str);
|
free(header->str);
|
||||||
@ -146,7 +165,8 @@ int send_response(int fd, char *req_path)
|
|||||||
|
|
||||||
free(file);
|
free(file);
|
||||||
free(file_path);
|
free(file_path);
|
||||||
return 0;
|
|
||||||
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,9 +207,9 @@ void handle_get_request(int fd, char *request)
|
|||||||
|
|
||||||
fread(template, file_size, 1, fp);
|
fread(template, file_size, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
template[file_size-1] = '\0';
|
template[file_size - 1] = '\0';
|
||||||
|
|
||||||
article_info *articles = malloc(0);
|
article_info *articles = NULL;
|
||||||
int amount = list_articles(&articles);
|
int amount = list_articles(&articles);
|
||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
{
|
{
|
||||||
@ -245,7 +265,7 @@ void handle_get_request(int fd, char *request)
|
|||||||
}
|
}
|
||||||
free(id_str);
|
free(id_str);
|
||||||
|
|
||||||
article_info *articles = malloc(0);
|
article_info *articles = NULL;
|
||||||
int amount = list_articles(&articles);
|
int amount = list_articles(&articles);
|
||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
{
|
{
|
||||||
@ -255,6 +275,7 @@ void handle_get_request(int fd, char *request)
|
|||||||
|
|
||||||
if (id > amount - 1)
|
if (id > amount - 1)
|
||||||
{
|
{
|
||||||
|
free_article_info_arr(&articles, amount);
|
||||||
res_404(fd, path);
|
res_404(fd, path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ char *gen_project_html()
|
|||||||
fread(template, template_file_size, 1, template_fp);
|
fread(template, template_file_size, 1, template_fp);
|
||||||
fclose(template_fp);
|
fclose(template_fp);
|
||||||
|
|
||||||
project_t *list = malloc(0);
|
project_t *list = NULL;
|
||||||
size_t length = read_list(&list);
|
size_t length = read_list(&list);
|
||||||
|
|
||||||
char *content = strdup("");
|
char *content = strdup("");
|
||||||
|
@ -70,10 +70,10 @@ void handle_process_termination(int signum)
|
|||||||
int status;
|
int status;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
pid = waitpid(-1, &status, WNOHANG);
|
pid = waitpid(-1, &status, WNOHANG);
|
||||||
}
|
} while (pid > 0);
|
||||||
while (pid > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @brief Prints error
|
* @brief Prints error
|
||||||
*
|
*
|
||||||
* @param {char *} msg
|
* @param {char *} msg
|
||||||
*/
|
*/
|
||||||
void err_msg(char *msg)
|
void err_msg(char *msg)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: %s\n", msg);
|
fprintf(stderr, "Error: %s\n", msg);
|
||||||
@ -17,16 +17,18 @@ void err_msg(char *msg)
|
|||||||
* @param str2
|
* @param str2
|
||||||
* @return char*
|
* @return char*
|
||||||
*/
|
*/
|
||||||
char *concat_to_front(char **str1, char *str2)
|
char *prepend(char *dest, const char *prefix)
|
||||||
{
|
{
|
||||||
char *tmp = strdup(*str1);
|
size_t orig_len = strlen(dest);
|
||||||
|
size_t prefix_len = strlen(prefix);
|
||||||
|
|
||||||
strcpy(*str1, str2);
|
dest = realloc(dest, orig_len + prefix_len + 1);
|
||||||
strcat(*str1, tmp);
|
|
||||||
|
|
||||||
free(tmp);
|
memmove(dest + prefix_len, dest, orig_len + 1);
|
||||||
|
|
||||||
return *str1;
|
memcpy(dest, prefix, prefix_len);
|
||||||
|
|
||||||
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<title>About</title>
|
<title>About</title>
|
||||||
|
<link href="https://pub.dm1sh.ru/@dm1sh" rel="me">
|
||||||
|
|
||||||
<link rel="stylesheet" href="/style.css">
|
<link rel="stylesheet" href="/style.css">
|
||||||
</head>
|
</head>
|
||||||
@ -19,25 +20,27 @@
|
|||||||
<main>
|
<main>
|
||||||
<h1>About me</h1>
|
<h1>About me</h1>
|
||||||
<p>
|
<p>
|
||||||
Hello, I'm Shishkov Dmitriy. I'm 17 years old computer programmer. I'm also do photography as a hobby. As
|
Hello, my name is Dmitriy Shishkov. I am a 17-year-old computer programmer. I
|
||||||
for autumn 2021, I'm studying in "Saint Petersburg Electrotechnical University "LETI".
|
also do photography as a hobby. As for autumn 2021, I study radiotechnics
|
||||||
|
at "Saint Petersburg Electrotechnical University "LETI".
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
My specialization is frontend web development. All web services and application I deploy on my own. For it
|
I consider myself a full-stack web developer. All web services and applications
|
||||||
I've used <a href="https://www.docker.com">Docker</a> and <a
|
I deploy on my home server, powered by Fedora Server. For it, I use Podman,
|
||||||
href="https://docs.docker.com/compose">docker-compose</a> for deployment on my VPS.
|
Ansible, and Cockpit. I have also used PaaSes such as <a href="https://vercel.com">
|
||||||
Currently my server is powered with <a href="https://dokku.com">Dokku</a>. For
|
Vercel Now</a> or <a href="https://heroku.com">Heroku</a> for previews or small
|
||||||
smaller projects I also used some PaaS like <a href="https://heroku.com">Heroku</a> and <a
|
projects.
|
||||||
href="https://vercel.com">Vercel Now</a>.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
I also do in for C development. In <a href="/projects">projects</a> section you can see some of my
|
I also do some C/C++ development for my workspace tools and to better
|
||||||
developments in this langualge. Even this site is powered by page generator written in C.
|
understand how the software I use works. You can see some examples in the
|
||||||
|
<a href="/projects">projects</a> section. Even this site is powered by a page
|
||||||
|
generator written in C.
|
||||||
</p>
|
</p>
|
||||||
<p>More formally, this is my stack:</p>
|
<p>Some of the technologies I have worked with:</p>
|
||||||
|
<ul>
|
||||||
|
<li>JS
|
||||||
<ul>
|
<ul>
|
||||||
<li>JS <ul>
|
|
||||||
<li><a href="https://nodejs.org">NodeJS</a></li>
|
|
||||||
<li><a href="https://www.typescriptlang.org">TypeScript</a></li>
|
<li><a href="https://www.typescriptlang.org">TypeScript</a></li>
|
||||||
<li><a href="https://reactjs.org">React</a>:
|
<li><a href="https://reactjs.org">React</a>:
|
||||||
<ul>
|
<ul>
|
||||||
@ -47,8 +50,15 @@
|
|||||||
<li><a href="https://styled-components.com">Styled Components</a></li>
|
<li><a href="https://styled-components.com">Styled Components</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li>Web APIs:
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API">Service Worker</a></li>
|
||||||
|
<li><a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components">Web Components</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li><a href="https://redux.js.org">Redux</a></li>
|
<li><a href="https://redux.js.org">Redux</a></li>
|
||||||
<li><a href="https://nextjs.org">Next.js</a></li>
|
<li><a href="https://nextjs.org">Next.js</a></li>
|
||||||
|
<li><a href="https://nodejs.org">NodeJS</a></li>
|
||||||
<li><a href="https://graphql.org">Graphql</a>:
|
<li><a href="https://graphql.org">Graphql</a>:
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://www.apollographql.com">Apollo</a></li>
|
<li><a href="https://www.apollographql.com">Apollo</a></li>
|
||||||
@ -63,19 +73,29 @@
|
|||||||
<li><a href="https://www.postgresql.org">PostgreSQL</a>
|
<li><a href="https://www.postgresql.org">PostgreSQL</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://node-postgres.com">Node-postgres</a></li>
|
<li><a href="https://node-postgres.com">Node-postgres</a></li>
|
||||||
|
<li><a href="https://typeorm.io">TypeORM</a></li>
|
||||||
|
<li><a href="https://www.cockroachlabs.com/product">CockroachDB</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Styling:
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://mui.com/material-ui">Material UI</a></li>
|
||||||
|
<li><a href="https://getbootstrap.com/">Bootstrap:
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://react-bootstrap.github.io/">React Bootstrap</a></li>
|
||||||
|
</ul>
|
||||||
|
</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="https://www.npmjs.com/package/jsonwebtoken">jsonwebtoken</a></li>
|
<li><a href="https://www.npmjs.com/package/jsonwebtoken">jsonwebtoken</a></li>
|
||||||
<li><a href="https://sendgrid.com">SendGrid</a></li>
|
<li><a href="https://sendgrid.com">SendGrid</a></li>
|
||||||
<li><a href="https://github.com/jakearchibald/idb">IndexedDB</a></li>
|
<li><a href="https://github.com/jakearchibald/idb">idb</a></li>
|
||||||
|
<li><a href="https://github.com/websockets/ws">ws</a></li>
|
||||||
<li><a href="https://immerjs.github.io/immer">Immer</a></li>
|
<li><a href="https://immerjs.github.io/immer">Immer</a></li>
|
||||||
<li><a href="https://expressjs.com">ExpressJS</a></li>
|
<li><a href="https://expressjs.com">ExpressJS</a></li>
|
||||||
<li>Web APIs: <ul>
|
<li>Dev environment:
|
||||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API">Service Worker</a></li>
|
<ul>
|
||||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components">Web Components</a></li>
|
<li><a href="https://vitejs.dev">Vite</a></li>
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Dev environment: <ul>
|
|
||||||
<li><a href="https://eslint.org">ESLint</a></li>
|
<li><a href="https://eslint.org">ESLint</a></li>
|
||||||
<li><a href="https://prettier.io">Prettier</a></li>
|
<li><a href="https://prettier.io">Prettier</a></li>
|
||||||
<li><a href="https://jestjs.io">Jest</a></li>
|
<li><a href="https://jestjs.io">Jest</a></li>
|
||||||
@ -89,30 +109,49 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Deployment: <ul>
|
<li>Deployment:
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://podman.io">Podman</a></li>
|
||||||
<li><a href="https://www.docker.com">Docker</a></li>
|
<li><a href="https://www.docker.com">Docker</a></li>
|
||||||
<li><a href="https://docs.docker.com/compose">docker-compose</a></li>
|
<li><a href="https://docs.docker.com/compose">docker-compose</a></li>
|
||||||
|
<li><a href="https://www.ansible.com">Ansible</a></li>
|
||||||
|
<li><a href="https://kubernetes.io">Kubernetes</a></li>
|
||||||
<li><a href="https://dokku.com">Dokku</a></li>
|
<li><a href="https://dokku.com">Dokku</a></li>
|
||||||
<li><a href="https://heroku.com">Heroku</a></li>
|
<li><a href="https://heroku.com">Heroku</a></li>
|
||||||
<li><a href="https://www.oracle.com/cloud">Oracle Cloud Infrastructure</a></li>
|
|
||||||
<li><a href="https://vercel.com">Vercel Now</a></li>
|
<li><a href="https://vercel.com">Vercel Now</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>C</li>
|
|
||||||
<li><a href="https://www.python.org">Python</a>
|
<li><a href="https://www.python.org">Python</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><a href="https://ipython.org/notebook.html">Jupyter Notebook</a></li>
|
||||||
|
<li><a href="https://matplotlib.org">Matplotlib</a></li>
|
||||||
|
<li><a href="https://numpy.org">Numpy</a></li>
|
||||||
<li><a href="https://fastapi.tiangolo.com">FastAPI</a></li>
|
<li><a href="https://fastapi.tiangolo.com">FastAPI</a></li>
|
||||||
|
<li><a href="https://palletsprojects.com/p/jinja">Jinja2</a></li>
|
||||||
|
<li><a href="https://www.sqlalchemy.org">SQLAlchemy</a></li>
|
||||||
|
<li><a href="https://pytorch.org">PyTorch</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="http://www.lua.org">Lua</a></li>
|
<li>C</li>
|
||||||
|
<li>C++:
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://www.wxwidgets.org">wxWidgets</a></li>
|
||||||
|
<li><a href="https://www.arduino.cc">Arduino</a></li>
|
||||||
|
<li><a href="https://learn.microsoft.com/en-us/cpp/mfc/mfc-desktop-applications">MFC</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="https://go.dev">Golang</a></li>
|
||||||
|
<li><a href="https://www.lua.org">Lua</a></li>
|
||||||
<li>C#
|
<li>C#
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://dotnet.microsoft.com/">.NET Core</a></li>
|
<li><a href="https://dotnet.microsoft.com">.NET Core</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="https://kotlinlang.org">Kotlin</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>See <a href="/contacts">contacts</a> to get in touch with me.</p>
|
<p>See <a href="/contacts">contacts</a> to get in touch with me.</p>
|
||||||
<p>You can reach my resume following <a href="https://github.com/dm1sh/dm1sh/blob/main/resume.md">this link</a>
|
<p>You can reach my resume by following
|
||||||
|
<a href="https://git.dm1sh.ru/dm1sh/dm1sh/src/branch/main/resume.md">this link</a>.
|
||||||
</p>
|
</p>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
35
static/articles/APK_modification/APK_modification.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
First, decompile apk file with [apktool](https://apktool.org):
|
||||||
|
|
||||||
|
```
|
||||||
|
apktool d <file_name>.apk
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace assets or edit *Manifest.xml*. [smali2java](https://github.com/AlexeySoshin/smali2java) can be of use for code modifications.
|
||||||
|
|
||||||
|
Recompile apk:
|
||||||
|
|
||||||
|
```
|
||||||
|
apktool b <file_name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Alignment is necessary for modern android versions (I believe, 30+ SDK):
|
||||||
|
|
||||||
|
```
|
||||||
|
zipalign -v -f -p 4 <file_name>/dist/<file_name>.apk aligned-<file_name>.apk
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a signing key. Fields values do not matter. Especially for personal use.
|
||||||
|
|
||||||
|
```
|
||||||
|
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 1000
|
||||||
|
```
|
||||||
|
|
||||||
|
Actually sign apk with it:
|
||||||
|
|
||||||
|
```
|
||||||
|
apksigner.jar sign -ks my-release-key.keystore --ks-key-alias alias_name aligned-<file_name>.apk
|
||||||
|
```
|
||||||
|
|
||||||
|
It will overwrite the provided apk with a signed one.
|
||||||
|
|
||||||
|
We're awesome!
|
@ -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/<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,16 +26,16 @@ sudo pacman -S qemu
|
|||||||
Connect .vhdx file to nbd device:
|
Connect .vhdx file to nbd device:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo qemu-hbd -c /dev/nbd0 /mnt/c/<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
|
||||||
|
|
||||||
Finally, mount ndb device:
|
Finally, mount nbd device:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo mkdir /mnt/wsl
|
sudo mkdir /mnt/wsl
|
||||||
sudo mount /dev/ndb0 /mnt/wsl
|
sudo mount /dev/nbd0 /mnt/wsl
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you can transfer files or chroot into it.
|
Now you can transfer files or chroot into it.
|
@ -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://<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:
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<title>%s</title>
|
<title>%s</title>
|
||||||
|
<link href="https://pub.dm1sh.ru/@dm1sh" rel="me">
|
||||||
|
|
||||||
<link rel="stylesheet" href="/style.css">
|
<link rel="stylesheet" href="/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
1594048366 My_first_article_on_this_site
|
1594048366000 My_first_article_on_this_site
|
||||||
1606819380000 Ugra_Hantaton
|
1606819380000 Ugra_Hantaton
|
||||||
1619034957605 Stack_VM_V1.0
|
1619034957605 Stack_VM_V1.0
|
||||||
1627839955679 Publite_-_an_Ebook_reader
|
1627839955679 Publite_-_an_Ebook_reader
|
||||||
1646570601234 Mount_WSL_partition_on_Arch_Linux
|
1646570601234 Mount_WSL_partition_on_Arch_Linux
|
||||||
1653350638050 Use_phone_as_camera_for_linux_desktop
|
1653350638050 Use_phone_as_camera_for_linux_desktop
|
||||||
1694581049776 Use_phone_camera_for_linux_desktop_(2023)
|
1694581049776 Use_phone_camera_for_linux_desktop_(2023)
|
||||||
|
1738537323514 APK_modification
|
@ -6,6 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<title>Contacts</title>
|
<title>Contacts</title>
|
||||||
|
<link href="https://pub.dm1sh.ru/@dm1sh" rel="me">
|
||||||
|
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
@ -20,8 +21,9 @@
|
|||||||
<h1>Contacts:</h1>
|
<h1>Contacts:</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://t.me/dm1sh">Telegram</a></li>
|
<li><a href="https://t.me/dm1sh">Telegram</a></li>
|
||||||
<li><a href="https://vk.com/dm1sh">VK</a></li>
|
|
||||||
<li><a href="mailto:me@dmitriy.icu">Mail (me@dmitriy.icu)</a></li>
|
<li><a href="mailto:me@dmitriy.icu">Mail (me@dmitriy.icu)</a></li>
|
||||||
|
<li><a rel="me" href="https://pub.dm1sh.ru/@dm1sh">Mastodon</a></li>
|
||||||
|
<li><a href="https://vk.com/dm1sh">VK</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6010.jpg
Normal file
After Width: | Height: | Size: 178 KiB |
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6021.jpg
Normal file
After Width: | Height: | Size: 192 KiB |
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6157.jpg
Normal file
After Width: | Height: | Size: 282 KiB |
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6223.jpg
Normal file
After Width: | Height: | Size: 156 KiB |
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6331.jpg
Normal file
After Width: | Height: | Size: 292 KiB |
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6375.jpg
Normal file
After Width: | Height: | Size: 206 KiB |
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6390.jpg
Normal file
After Width: | Height: | Size: 322 KiB |
BIN
static/gallery/albums/Vladivostok_and_Russky_island/IMG_6562.jpg
Normal file
After Width: | Height: | Size: 308 KiB |
@ -6,6 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<title>Gallery</title>
|
<title>Gallery</title>
|
||||||
|
<link href="https://pub.dm1sh.ru/@dm1sh" rel="me">
|
||||||
|
|
||||||
<link rel="stylesheet" href="/style.css">
|
<link rel="stylesheet" href="/style.css">
|
||||||
</head>
|
</head>
|
||||||
@ -17,6 +18,7 @@
|
|||||||
title="If you have modern browser, you can visit more fancy version of my site">Modernize</a> -->
|
title="If you have modern browser, you can visit more fancy version of my site">Modernize</a> -->
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
<h1>Gallery</h1>
|
||||||
<p>Heare are some of my photos.</p>
|
<p>Heare are some of my photos.</p>
|
||||||
%s
|
%s
|
||||||
</main>
|
</main>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<title>Shishkov Dmitriy</title>
|
<title>Shishkov Dmitriy</title>
|
||||||
|
<link href="https://pub.dm1sh.ru/@dm1sh" rel="me">
|
||||||
|
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<title>Projects</title>
|
<title>Projects</title>
|
||||||
|
<link href="https://pub.dm1sh.ru/@dm1sh" rel="me">
|
||||||
|
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
|
@ -83,6 +83,15 @@ 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;
|
||||||
}
|
}
|
||||||
|