Compare commits
8 Commits
7127ea6884
...
main
Author | SHA1 | Date | |
---|---|---|---|
7089222512 | |||
0c8c8854a4 | |||
61db53767c | |||
e0cf2a6059 | |||
31ee578f5f | |||
be3ae772cb | |||
306afed5f9 | |||
a12205c5ab |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
a.out
|
27
README.md
27
README.md
@ -1 +1,26 @@
|
|||||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
### About Me
|
||||||
|
- Student at 42 Angouleme
|
||||||
|
- Computer science enthusiast
|
||||||
|
#### Programming language
|
||||||
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/c.png" width="15" height="15"> C
|
||||||
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/python.png" width="15" height="15"> Python
|
||||||
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/c++.png" width="15" height="15"> C++
|
||||||
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/lua.png" width="15" height="15"> Lua
|
||||||
|
- [<img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/golem.png" width="15" height="15"> Golem](https://golem.re)
|
||||||
|
#### Skills
|
||||||
|
- Programmation
|
||||||
|
- Linux
|
||||||
|
- Hardware
|
||||||
|
- SysAdmin
|
||||||
|
#### Public SelfHosted Service
|
||||||
|
- [matrix](https://matrix.chauvet.pro)
|
||||||
|
- [element](https://element.chauvet.pro)
|
||||||
|
- [gitea](https://git.chauvet.pro)
|
||||||
|
- [vaultwarden](https://pass.chauvet.pro)
|
||||||
|
#### Projects
|
||||||
|
- [Minishell](https://git.chauvet.pro/starnakin/minishell): A simplified version of bash from scratch
|
||||||
|
- [IronGolem](https://git.chauvet.pro/starnakin/IronGOLEM): A library to the golem language (Memory allocator, print, trait string, etc)
|
||||||
|
- [PyMenuBOT](https://git.chauvet.pro/starnakin/PyMenuBOT): A bot discord to create greocery list
|
||||||
|
### Contact
|
||||||
|
discord: starnakin\
|
||||||
|
mail: camille@chauvet.pro
|
@ -1,11 +1,11 @@
|
|||||||
### About Me
|
### About Me
|
||||||
- Student at 42 Angouleme
|
- Student at 42 Angouleme
|
||||||
- Computer science enthusiast
|
- Computer science enthusiast
|
||||||
- I use arch btw
|
|
||||||
#### Programming language
|
#### Programming language
|
||||||
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/c.png" width="15" height="15"> C
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/c.png" width="15" height="15"> C
|
||||||
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/python.png" width="15" height="15"> Python
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/python.png" width="15" height="15"> Python
|
||||||
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/c++.png" width="15" height="15"> C++
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/c++.png" width="15" height="15"> C++
|
||||||
|
- <img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/lua.png" width="15" height="15"> Lua
|
||||||
- [<img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/golem.png" width="15" height="15"> Golem](https://golem.re)
|
- [<img src="https://git.chauvet.pro/starnakin/.profile/raw/branch/main/img/golem.png" width="15" height="15"> Golem](https://golem.re)
|
||||||
#### Skills
|
#### Skills
|
||||||
- Programmation
|
- Programmation
|
||||||
@ -16,11 +16,11 @@
|
|||||||
- [matrix](https://matrix.chauvet.pro)
|
- [matrix](https://matrix.chauvet.pro)
|
||||||
- [element](https://element.chauvet.pro)
|
- [element](https://element.chauvet.pro)
|
||||||
- [gitea](https://git.chauvet.pro)
|
- [gitea](https://git.chauvet.pro)
|
||||||
- [gitea](https://git.chauvet.pro)
|
|
||||||
- [vaultwarden](https://pass.chauvet.pro)
|
- [vaultwarden](https://pass.chauvet.pro)
|
||||||
#### Projects
|
#### Projects
|
||||||
- [Minishell](https://git.chauvet.pro/starnakin/minishell): A simplified version of bash from scratch
|
- [Minishell](https://git.chauvet.pro/starnakin/minishell): A simplified version of bash from scratch
|
||||||
- [IronGolem](https://git.chauvet.pro/starnakin/IronGOLEM): A library to the golem language (Memory allocator, print, trait string, etc)
|
- [IronGolem](https://git.chauvet.pro/starnakin/IronGOLEM): A library to the golem language (Memory allocator, print, trait string, etc)
|
||||||
|
- [PyMenuBOT](https://git.chauvet.pro/starnakin/PyMenuBOT): A bot discord to create greocery list
|
||||||
### Contact
|
### Contact
|
||||||
discord: starnakin\
|
discord: starnakin\
|
||||||
mail: camille@chauvet.pro
|
mail: camille@chauvet.pro
|
72
create_short.c
Normal file
72
create_short.c
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define BUTTON "\n### [More](https://urlz.fr/mqBB)"
|
||||||
|
#define TOTAL_SIZE 2272
|
||||||
|
#define MAX_SIZE TOTAL_SIZE - strlen(BUTTON)
|
||||||
|
|
||||||
|
char* read_file(const char* path)
|
||||||
|
{
|
||||||
|
char* content;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
fd = open(path, O_RDONLY);
|
||||||
|
if (fd == -1)
|
||||||
|
goto open_fail;
|
||||||
|
|
||||||
|
content = malloc((TOTAL_SIZE + 1) * sizeof(char));
|
||||||
|
if (content == NULL)
|
||||||
|
goto alloc_fail;
|
||||||
|
|
||||||
|
int written = read(fd, content, MAX_SIZE);
|
||||||
|
if (written == -1)
|
||||||
|
goto read_fail;
|
||||||
|
|
||||||
|
content[written] = '\0';
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return content;
|
||||||
|
|
||||||
|
read_fail:
|
||||||
|
alloc_fail:
|
||||||
|
free(content);
|
||||||
|
|
||||||
|
open_fail:
|
||||||
|
close(fd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int write_file(const char* path, const char* content)
|
||||||
|
{
|
||||||
|
int fd = open(path, O_WRONLY | O_TRUNC);
|
||||||
|
|
||||||
|
if (fd == -1)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return write(fd, content, strlen(content));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int ac, char **av)
|
||||||
|
{
|
||||||
|
char* path;
|
||||||
|
|
||||||
|
if (ac > 2)
|
||||||
|
path = av[1];
|
||||||
|
else
|
||||||
|
path = "README_COMPLET.md";
|
||||||
|
|
||||||
|
char* content = read_file(path);
|
||||||
|
if (content == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (strlen(content) == MAX_SIZE)
|
||||||
|
strcat(content, BUTTON);
|
||||||
|
|
||||||
|
int ret = write_file("README.md", content);
|
||||||
|
free(content);
|
||||||
|
return ret;
|
||||||
|
}
|
2
create_short.sh
Executable file
2
create_short.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
gcc -g -Wall -Werror -Wextra create_short.c &&
|
||||||
|
./a.out
|
BIN
img/lua.png
Normal file
BIN
img/lua.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 128 KiB |
Reference in New Issue
Block a user