From 249080a8ab799f654276596d19311b0445495c0a Mon Sep 17 00:00:00 2001 From: Theo-Hafsaoui Date: Sat, 31 Aug 2024 13:58:35 +0200 Subject: [PATCH] WIP --- .gitignore | 1 + Makefile | 3 + assets/latex/template/template.tex | 164 +---------------------------- cmd/generate.go | 50 +++++++++ cmd/root.go | 19 ++++ cv/eng/education.md | 12 ++- cv/eng/project.md | 13 ++- cv/eng/work.md | 28 ++--- go.mod | 7 +- go.sum | 10 ++ internal/parser/latex_test.go | 5 +- internal/parser/markdown.go | 8 +- internal/walker/cv.go | 2 +- internal/walker/cv_test.go | 2 +- main.go | 9 ++ 15 files changed, 140 insertions(+), 193 deletions(-) create mode 100644 cmd/generate.go create mode 100644 cmd/root.go create mode 100644 main.go diff --git a/.gitignore b/.gitignore index f40e964..4ba4eb9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Binaries for programs and plugins +anemon *.exe *.exe~ *.dll diff --git a/Makefile b/Makefile index 1b8c007..2a6dfa8 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ run: echo "Not yet complete" +build: + go build + lint: golangci-lint run ./... diff --git a/assets/latex/template/template.tex b/assets/latex/template/template.tex index 1e25d3b..5e1c309 100644 --- a/assets/latex/template/template.tex +++ b/assets/latex/template/template.tex @@ -1,163 +1 @@ -%------------------------- -% Resume in Latex -% Author : Jake Gutierrez -% Based off of: https://github.com/sb2nov/resume -% License : MIT -%------------------------ - -\documentclass[letterpaper,11pt]{article} - -\usepackage{latexsym} -\usepackage[empty]{fullpage} -\usepackage{titlesec} -\usepackage{fontawesome5} -\usepackage{xfakebold} -\usepackage{marvosym} -\usepackage[usenames,dvipsnames]{color} -\usepackage{verbatim} -\usepackage{enumitem} -\usepackage[hidelinks]{hyperref} -\usepackage{fancyhdr} -\usepackage{xcolor} -\usepackage[english]{babel} -\usepackage{tabularx} -\definecolor{Nblack}{HTML}{3b4252} - \definecolor{NBLACK}{HTML}{2e3440} - \definecolor{Nwhite}{HTML}{eceff4} - \definecolor{nwhite}{HTML}{e5e9f0} - \definecolor{Nblue}{HTML}{5e81ac} - \definecolor{Nurl}{HTML}{8fbcbb} - \definecolor{nblue}{HTML}{005A92} -\input{glyphtounicode} - - -%----------FONT OPTIONS---------- -% sans-serif -% \usepackage[sfdefault]{FiraSans} -% \usepackage[sfdefault]{roboto} -% \usepackage[sfdefault]{noto-sans} -% \usepackage[default]{sourcesanspro} - -% serif -% \usepackage{CormorantGaramond} -% \usepackage{charter} - - -\pagestyle{fancy} -\fancyhf{} % clear all header and footer fields -\fancyfoot{} -\renewcommand{\headrulewidth}{0pt} -\renewcommand{\footrulewidth}{0pt} - -% Adjust margins -\addtolength{\oddsidemargin}{-0.5in} -\addtolength{\evensidemargin}{-0.5in} -\addtolength{\textwidth}{1in} -\addtolength{\topmargin}{-.5in} -\addtolength{\textheight}{1.0in} - \hypersetup{ - filecolor=magenta, - urlcolor=Nblack, - pdftitle={Overleaf Example}, - pdfpagemode=FullScreen, - } -\urlstyle{same} - -\raggedbottom -\raggedright -\setlength{\tabcolsep}{0in} - -% Sections formatting -\titleformat{\section}{ - \vspace{-4pt}\scshape\raggedright\large -}{}{0em}{}[\color{black}\titlerule \vspace{-5pt}] - -% Ensure that generate pdf is machine readable/ATS parsable -\pdfgentounicode=1 - -%------------------------- -% Custom commands -\newcommand{\resumeItem}[1]{ - \item\small{ - {#1 \vspace{-2pt}} - } -} - -\newcommand{\resumeSubheading}[4]{ - \vspace{-2pt}\item - \begin{tabular*}{0.97\textwidth}[t]{l@{\extracolsep{\fill}}r} - \textbf{#1} & #2 \\ - \textit{\small#3} & \textit{\small #4} \\ - \end{tabular*}\vspace{-7pt} -} - -\newcommand{\resumeSubSubheading}[2]{ - \item - \begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r} - \textit{\small#1} & \textit{\small #2} \\ - \end{tabular*}\vspace{-7pt} -} - -\newcommand{\resumeProjectHeading}[2]{ - \item - \begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r} - \small#1 & #2 \\ - \end{tabular*}\vspace{-7pt} -} - -\newcommand{\resumeSubItem}[1]{\resumeItem{#1}\vspace{-4pt}} - -\renewcommand\labelitemii{$\vcenter{\hbox{\tiny$\bullet$}}$} - -\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=0.15in, label={}]} -\newcommand{\resumeSubHeadingListEnd}{\end{itemize}} -\newcommand{\resumeItemListStart}{\begin{itemize}} -\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}} - -%------------------------------------------- -%%%%%% RESUME STARTS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%% - - -\begin{document} - -\begin{center} - \textbf{\Huge \scshape \textcolor{nblue}{Hafsaoui Theo}} \\ \vspace{1pt} - \small +33 6 26 26 50 07 $|$ \href{mailto:theo.ha@pm.me}{\underline{theo.ha@pm.me}} \\ - \href{https://linkedin.com/in/theo-dev/}{\underline{linkedin.com/in/theo-dev}} $|$ - \href{https://github.com/Theo-Hafsaoui}{\underline{github.com/Theo-Hafsaoui}} -\end{center} - - -%-----------EDUCATION----------- -\section{EDUCATION} -\resumeSubHeadingListStart -%EDUCATION_SECTIONS% -\resumeSubHeadingListEnd - - -%-----------EXPERIENCE----------- -\section{EXPERIENCE} -\resumeSubHeadingListStart -%EXPERIENCE_SECTIONS% -\resumeSubHeadingListEnd - - - -%-----------PROJECTS----------- -\section{Projects} -\resumeSubHeadingListStart -%PROJECTS_SECTIONS% -\resumeSubHeadingListEnd - - - -% -%-----------PROGRAMMING SKILLS----------- -\section{Technical Skills} -\begin{itemize}[leftmargin=0.15in, label={}] - \small{\item{ - }} -\end{itemize} - -%------------------------------------------- -\end{document} +Hello World \ No newline at end of file diff --git a/cmd/generate.go b/cmd/generate.go new file mode 100644 index 0000000..1c1db98 --- /dev/null +++ b/cmd/generate.go @@ -0,0 +1,50 @@ +package cmd + +import ( + "anemon/internal/walker" + "anemon/internal/parser" + "errors" + "os" + "strings" + + "github.com/spf13/cobra" +) + +var generateCmd = &cobra.Command{ + Use: "generate", + Short: "Generate a CV", + Long: `Generate a CV using the CV at the current work directory`, + RunE: func(cmd *cobra.Command, args []string) error{ + dir, err := os.Getwd() + if err != nil{ + return err + } + cv_path := dir+"/cv" + _, err = os.Stat(cv_path) + if err != nil{ + if os.IsNotExist(err) { return errors.New("No `cv` directory found at:"+cv_path) } + return err + } + result, err := walker.WalkCV(cv_path) + md_per_language := make(map[string]map[string]string) + if err != nil{ + return err + } + for k := range result{ + k_split := strings.Split(k,"/") + md_per_language[k_split[0]]=result + } + for _,p := range strings.Split(result["eng/project"], "\n\n"){ + section, err := parser.Parse(p) + if err != nil{ + return err + } + println(section.String()) + } + return nil + }, +} + +func init() { + rootCmd.AddCommand(generateCmd) +} diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..8ae1e7e --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,19 @@ +package cmd + +import ( + "os" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "anemon", + Short: "a CV genrator", + Long: `This CLI tool, written in Go, automates the generation of customized CVs from Markdown files based on a specified configuration. It parses CV sections in + multiple languages, prioritizes key skills or features as defined in an output.yml file, and outputs LaTeX files for each CV version, ready for compilation.`, +} + +func Execute() { + if err := rootCmd.Execute(); err != nil { + os.Exit(1) + } +} diff --git a/cv/eng/education.md b/cv/eng/education.md index 3c0cb49..faf3d70 100644 --- a/cv/eng/education.md +++ b/cv/eng/education.md @@ -1,5 +1,9 @@ -- [Master's in Computer Science, Software and Data Engineering](https://www.univ-tln.fr/Master-Informatique-parcours-Developpement-et-Ingenierie-des-Donnees.html) - - University of Toulon, 2024 +# Master's in Computer Science, Software and Data Engineering +## https://www.univ-tln.fr/Master-Informatique-parcours-Developpement-et-Ingenierie-des-Donnees.html +### University of Toulon +#### 2024 -- [Bachelor's in Computer Science](https://www.univ-tln.fr/Licence-Informatique-parcours-Informatique.html) - - University of Toulon, 2022 +# Bachelor's in Computer Science +## https://www.univ-tln.fr/Licence-Informatique-parcours-Informatique.html +### University of Toulon +#### 2024 diff --git a/cv/eng/project.md b/cv/eng/project.md index 1147380..0a033e4 100644 --- a/cv/eng/project.md +++ b/cv/eng/project.md @@ -1,15 +1,14 @@ -**Agenda** -*Java, JavaFX, PostgreSQL, Github [GitHub Repository](https://github.com/MasterDID2022/sopra-project-LHD)* - +# Agenda +## Java, JavaFX, PostgreSQL, Github +### https://github.com/MasterDID2022/sopra-project-LHD - Developed in Java and JavaFX, using PostgreSQL for database management. - Project executed in an agile environment, emphasizing GitHub Flow, Pull Requests, Kanban, and Continuous Integration for effective collaboration. -**Epigraphy Tools** -*Java, Hibernate, Docker, REST, JWT [GitHub Repository](https://github.com/MasterDID2022/epicTool)* - +# Epigraphy Tools +## Java, Hibernate, Docker, REST, JWT +### https://github.com/MasterDID2022/epicTool - Designed and developed an epigraphy annotation tool for deep learning using Java, Docker, REST, and JWT. - Separated the front-end and back-end using Docker with container orchestration via Docker-Compose. - Established secure communication between the front-end and back-end through a RESTful API with JWT tokens. - Worked as a team in an agile context, utilizing the SCRUM method and applying DevOps practices for efficient and collaborative development. - diff --git a/cv/eng/work.md b/cv/eng/work.md index 7c95d50..b09be06 100644 --- a/cv/eng/work.md +++ b/cv/eng/work.md @@ -1,20 +1,20 @@ -**Back-End Intern** -*February 2024 -- August 2024* -[Qonto](https://qonto.com/en) -*End of studies internship* - +# Back-End Intern +## February 2024 -- August 2024 +### [Qonto](https://qonto.com/en) +#### End of studies internship + - Contributed within a Cross Functional Team (CFT) to the standardization and extension of the onboarding process for four new markets (Austria, Netherlands, Belgium, Portugal). From design to implementation, in coordination with stakeholders (Risk, AML, Product), to ensure a smooth and compliant integration, with deployment scheduled for August. -- Led the extraction of back-office logic from a *Ruby* monolith into a microservice, deploying in a trunk-based development environment. Collaborated closely with the Ops teams throughout the process. Monitored production using **Grafana, Sentry, ArgoCD, and Kibana** to ensure quality and reliability, enhancing system maintainability by decoupling microservices. +- Led the extraction of back-office logic from a Ruby monolith into a microservice, deploying in a trunk-based development environment. Collaborated closely with the Ops teams throughout the process. Monitored production using Grafana, Sentry, ArgoCD, and Kibana to ensure quality and reliability, enhancing system maintainability by decoupling microservices. - Improved the reliability and observability of microservices by completing the tracing mechanisms and implementing Service Level Objectives (SLOs). -**Full Stack Developer** -*June 2023 -- September 2023* -[Coexel](https://www.coexel.com/en) -*Internship then Fixed-Term Contract* +# Full Stack Developer +## June 2023 -- September 2023 +### [Coexel](https://www.coexel.com/en) +#### Internship then Fixed-Term Contract -- Designed and developed a Python service for Named Entity Recognition (**NER**) using spaCy to efficiently identify named entities in 92M+ documents. Utilization of **Elasticsearch** for storage and optimized document search, enabling users to gain further insights into monitored themes. -- Rewrote an old website monitoring system created in Java to **Python**, enhancing maintainability and system performance. -- Implemented a **RESTful** API in Python using **FastAPI**, providing increased flexibility and scalability for data management and requests. -- Created a deployment pipeline with **Docker** and Github Actions, streamlining the deployment process and enabling faster and more robust updates. +- Designed and developed a Python service for Named Entity Recognition (NER) using spaCy to efficiently identify named entities in 92M+ documents. Utilization of Elasticsearch for storage and optimized document search, enabling users to gain further insights into monitored themes. +- Rewrote an old website monitoring system created in Java to Python, enhancing maintainability and system performance. +- Implemented a RESTful API in Python using FastAPI, providing increased flexibility and scalability for data management and requests. +- Created a deployment pipeline with Docker and Github Actions, streamlining the deployment process and enabling faster and more robust updates. - Significantly improved performance by reducing the number of GET requests from 5 to 1, resulting in an 85% faster display diff --git a/go.mod b/go.mod index f9b9f73..bee154a 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,9 @@ module anemon go 1.22.0 -require github.com/google/go-cmp v0.6.0 // indirect +require ( + github.com/google/go-cmp v0.6.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect +) diff --git a/go.sum b/go.sum index 5a8d551..64a1fe3 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,12 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/parser/latex_test.go b/internal/parser/latex_test.go index fd4070a..8d34f4e 100644 --- a/internal/parser/latex_test.go +++ b/internal/parser/latex_test.go @@ -8,7 +8,9 @@ import ( "github.com/google/go-cmp/cmp" ) -func TestReadLatex(t *testing.T) { + +func TestIO(t *testing.T) { +t.Run("Count returns 1 lines with just one line", func (t *testing.T) { dir := filepath.Join("../../assets", "latex", "template") templateFile := filepath.Join(dir, "template.tex") backupFile := filepath.Join(dir, "save.tex") @@ -39,6 +41,7 @@ func TestReadLatex(t *testing.T) { t.Fatalf("Failed to rename save.tex back to template.tex: %v", err) } } +}) } func TestWriteLatex(t *testing.T) { diff --git a/internal/parser/markdown.go b/internal/parser/markdown.go index ea1f29a..eb621a4 100644 --- a/internal/parser/markdown.go +++ b/internal/parser/markdown.go @@ -2,7 +2,8 @@ package parser import ( "errors" - "regexp" + "regexp" + "fmt" "strings" ) @@ -17,6 +18,11 @@ type Section struct { description []string } +func (s Section) String() string { + return fmt.Sprintf("1: %s\n2: %s\n3: %s\n4: %s\nitems: %v", + s.first,s.second,s.third,s.fourth,s.description) +} + /* Parse parses a Markdown-like `paragraph` into a `Section`, extracting headings and description based on the number of leading hashtags. Returns an error if the format is invalid. */ diff --git a/internal/walker/cv.go b/internal/walker/cv.go index 332ece5..fc777b5 100644 --- a/internal/walker/cv.go +++ b/internal/walker/cv.go @@ -9,7 +9,7 @@ import ( // walkCV traverses the directory tree starting at root and returns a map where // the keys are the relative paths without the .md extension and the values are // the contents of the markdown files. -func walkCV(root string) (map[string]string, error) { +func WalkCV(root string) (map[string]string, error) { fileMap := make(map[string]string) err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if err != nil { diff --git a/internal/walker/cv_test.go b/internal/walker/cv_test.go index 37e36a1..bb19445 100644 --- a/internal/walker/cv_test.go +++ b/internal/walker/cv_test.go @@ -28,7 +28,7 @@ func TestWalkCV(t *testing.T) { } } - result, err := walkCV(rootDir) + result, err := WalkCV(rootDir) if err != nil { t.Fatalf("walkCV failed: %v", err) } diff --git a/main.go b/main.go new file mode 100644 index 0000000..ddfa18b --- /dev/null +++ b/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "anemon/cmd" +) + +func main() { + cmd.Execute() +}