Initial commit
+ Contains base files and a resume file + More links are planned for the future + Might need some cleanup work and testing in the future
This commit is contained in:
		
						commit
						eb4876c739
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| /target | ||||
| **/*.rs.bk | ||||
							
								
								
									
										1176
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										1176
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										19
									
								
								Cargo.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Cargo.toml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| [package] | ||||
| name = "jsite" | ||||
| version = "0.1.0" | ||||
| authors = ["Joey Hines <joey@ahines.net>"] | ||||
| edition = "2018" | ||||
| 
 | ||||
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||||
| 
 | ||||
| [dependencies] | ||||
| rocket = "0.4.2" | ||||
| serde = "1.0" | ||||
| serde_derive = "1.0" | ||||
| serde_json = "1.0" | ||||
| 
 | ||||
| [dependencies.rocket_contrib] | ||||
| version = "0.4.2" | ||||
| default-features = false | ||||
| features = ["tera_templates", "serve"] | ||||
| 
 | ||||
							
								
								
									
										6
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| # My Website | ||||
| 
 | ||||
| A simplistic website written in Rust using the [Rocket]("https://rocket.rs/") using [Tera]("https://tera.netlify.com/") | ||||
| templates. | ||||
| 
 | ||||
| View the website at www.ahines.net  | ||||
							
								
								
									
										133
									
								
								src/main.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								src/main.rs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,133 @@ | ||||
| #![feature(proc_macro_hygiene, decl_macro)] | ||||
| 
 | ||||
| #[macro_use] extern crate rocket; | ||||
| #[macro_use] extern crate serde_derive; | ||||
| 
 | ||||
| use std::collections::HashMap; | ||||
| 
 | ||||
| use rocket::Request; | ||||
| use rocket_contrib::templates::Template; | ||||
| use rocket_contrib::serve::StaticFiles; | ||||
| use std::{fs, io}; | ||||
| use std::path::PathBuf; | ||||
| 
 | ||||
| #[derive(Serialize)] | ||||
| struct MDFile { | ||||
|     file_name: String, | ||||
|     link_name: String, | ||||
| } | ||||
| 
 | ||||
| /// Returns the rendered template of the index page of the website. This includes links and md
 | ||||
| /// pages included in `static/raw_md`
 | ||||
| #[get("/")] | ||||
| fn index() -> Template { | ||||
| 
 | ||||
|     let mut map: HashMap<&str, Vec<MDFile>> = HashMap::new(); | ||||
|     let mut links: Vec<MDFile> = Vec::new(); | ||||
| 
 | ||||
|     match get_pages(&mut links) { | ||||
|        Err(_) => (), | ||||
|         Ok(_) => (), | ||||
|     } | ||||
| 
 | ||||
|     map.insert("links", links); | ||||
|     Template::render("index", &map) | ||||
| } | ||||
| 
 | ||||
| /// Gets all the raw md pages contained in static/raw_md/
 | ||||
| ///
 | ||||
| /// The md page can start with a number
 | ||||
| ///
 | ||||
| /// # Arguments
 | ||||
| ///
 | ||||
| /// * `links` - A reference to a vector of string to insert the links into
 | ||||
| fn get_pages(links: &mut Vec<MDFile>) -> io::Result<()> { | ||||
|     // Gather all of the md files in static/raw_md/
 | ||||
|     let mut entries: Vec<PathBuf> =  fs::read_dir("static/raw_md/")? | ||||
|         .map(|res| res.map(|e| e.path())) | ||||
|         .collect::<Result<Vec<_>, io::Error>>()?; | ||||
| 
 | ||||
|     // Sort so they are always in the same order
 | ||||
|     entries.sort(); | ||||
| 
 | ||||
|     //
 | ||||
|     for entry in entries { | ||||
|         let file_name = entry.file_stem().unwrap().to_str().unwrap(); | ||||
|         let link_name; | ||||
|         if file_name.chars().next().unwrap().is_numeric() { | ||||
|             link_name = &file_name[1..]; | ||||
|         } | ||||
|         else { | ||||
|             link_name = file_name; | ||||
|         } | ||||
| 
 | ||||
|         let md_file = MDFile { | ||||
|             file_name: String::from(file_name), | ||||
|             link_name: String::from(link_name), | ||||
|         }; | ||||
| 
 | ||||
|         links.push(md_file); | ||||
|     } | ||||
| 
 | ||||
|     Ok(()) | ||||
| } | ||||
| 
 | ||||
| /// Returns a rendered template of a raw md page if it exists
 | ||||
| ///
 | ||||
| /// #Arguments
 | ||||
| ///
 | ||||
| /// * `page` - a string containing the name of the md file to look for
 | ||||
| #[get("/<page>")] | ||||
| fn md_page(page: String) -> Template { | ||||
|     let mut map = HashMap::new(); | ||||
|     let mut md_files: Vec<MDFile> = Vec::new(); | ||||
| 
 | ||||
|     match get_pages(&mut md_files) { | ||||
|       Err(_) => (), | ||||
|         Ok(_) => (), | ||||
|     }; | ||||
| 
 | ||||
|     let mut file_name = String::new(); | ||||
|     for md_file in md_files { | ||||
|         if md_file.link_name.eq_ignore_ascii_case(page.as_str()) { | ||||
|             file_name = md_file.file_name.clone(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     let mut contents = match fs::read_to_string(format!("static/raw_md/{}.md", file_name)) { | ||||
|         Ok(contents) => contents, | ||||
|         Err(_) => { | ||||
|             map.insert("error_page", page); | ||||
|             return Template::render("404", map) | ||||
|         }, | ||||
|     }; | ||||
| 
 | ||||
|     contents = contents.replace("\n", "<br>"); | ||||
|     contents = contents.replace("  ", "  "); | ||||
| 
 | ||||
|     map.insert("page", page); | ||||
|     map.insert("md_data", contents); | ||||
|     Template::render("md_page", &map) | ||||
| } | ||||
| 
 | ||||
| #[catch(404)] | ||||
| fn not_found(req: &Request<'_>) -> Template { | ||||
|     let mut map = HashMap::new(); | ||||
| 
 | ||||
|     map.insert("error_page", String::from(req.uri().path())); | ||||
| 
 | ||||
|     Template::render("404", &map) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| fn rocket() -> rocket::Rocket { | ||||
|     rocket::ignite() | ||||
|         .mount("/", routes![index, md_page], ) | ||||
|         .mount("/static", StaticFiles::from("static")) | ||||
|         .attach(Template::fairing()) | ||||
|         .register(catchers![not_found]) | ||||
| } | ||||
| 
 | ||||
| fn main() { | ||||
|     rocket().launch(); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								static/logo.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								static/logo.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 6.1 KiB | 
							
								
								
									
										27
									
								
								static/raw_md/1resume.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								static/raw_md/1resume.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| Joey Hines - joey@ahines.net - Auburn,AL | ||||
| ========================================= | ||||
| 
 | ||||
| Education | ||||
| --------- | ||||
| * Masters of Science in Electrical and Computer Engineering | ||||
|   * Auburn University, Auburn, AL. GPA: 4.0. Expected May 2021 | ||||
| * Bachelors of Science in Computer Engineering | ||||
|   * The University of Texas at Dallas, Richardson, TX. GPA: 3.59. May 2019 | ||||
| 
 | ||||
| Technical Skills | ||||
| ---------------- | ||||
| * Programing Languages: C, Python, Java, Rust, Verilog | ||||
| * Operating Systems: Linux, Windows | ||||
| * Version Control: Git, SVN | ||||
| 
 | ||||
| Work Experience | ||||
| --------------- | ||||
| Auburn University - Graduate Research and Teaching Assistant - August 2019 to Present | ||||
| * Command and Data Handling (CDHS) team lead for a cube satellite project | ||||
| * Collaborated with other team members to develop mission software | ||||
| * Instructed an embedded systems lab course covering the fundamentals of embedded programing on a microcontroller | ||||
| 
 | ||||
| Crestron Electronics - Intern - Firmware Engineering, BSP Group - Summer 2018 and 2019 | ||||
| * Worked with other engineers on U-boot and Linux kernel development for an embedded control system. | ||||
| * Adapted existing device drivers, including a UART driver, for use in the context of the control system. | ||||
| * Optimized Linux Kernel and user-space apps for memory usage. | ||||
							
								
								
									
										47
									
								
								static/style.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								static/style.css
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,47 @@ | ||||
| .blinking{ | ||||
|     animation:blinkingText 0.8s infinite; | ||||
| } | ||||
| @keyframes blinkingText{ | ||||
|     100%{  color: transparent; } | ||||
| } | ||||
| 
 | ||||
| .text { | ||||
|     font-family: "Ubuntu Mono", monospace; | ||||
|     color: whitesmoke; | ||||
| } | ||||
| 
 | ||||
| .body { | ||||
|     font-size: large; | ||||
| } | ||||
| 
 | ||||
| .heading { | ||||
|     font-family: "Ubuntu Mono", monospace; | ||||
|     color: limegreen; | ||||
| } | ||||
| 
 | ||||
| .no_underline { | ||||
|     text-decoration: none; | ||||
| } | ||||
| 
 | ||||
| .link { | ||||
|     color: #268BD2; | ||||
| } | ||||
| 
 | ||||
| .center { | ||||
|     max-width: 1250px; | ||||
|     margin: auto; | ||||
| } | ||||
| 
 | ||||
| .terminal { | ||||
|     background-color: #292929; | ||||
|     padding: 5px; | ||||
|     border-radius: 10px; | ||||
| } | ||||
| 
 | ||||
| .prompt { | ||||
|     color: limegreen; | ||||
| } | ||||
| 
 | ||||
| body { | ||||
|     background-color: black; | ||||
| } | ||||
							
								
								
									
										28
									
								
								templates/404.html.tera
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								templates/404.html.tera
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| {% extends "base" %} | ||||
| 
 | ||||
| {% block command %} | ||||
| ./error.sh | ||||
| {% endblock command %} | ||||
| 
 | ||||
| 
 | ||||
| {% block content %} | ||||
| </p> | ||||
| <pre class="text"> | ||||
|         ,--,                      ,--, | ||||
|       ,--.'|    ,----..         ,--.'| | ||||
|    ,--,  | :   /   /   \     ,--,  | : | ||||
| ,---.'|  : '  /   .     : ,---.'|  : ' | ||||
| ;   : |  | ; .   /   ;.  \;   : |  | ; | ||||
| |   | : _' |.   ;   /  ` ;|   | : _' | | ||||
| :   : |.'  |;   |  ; \ ; |:   : |.'  | | ||||
| |   ' '  ; :|   :  | ; | '|   ' '  ; : | ||||
| \   \  .'. |.   |  ' ' ' :\   \  .'. | | ||||
|  `---`:  | ''   ;  \; /  | `---`:  | ' | ||||
|       '  ; | \   \  ',  /       '  ; | | ||||
|       |  : ;  ;   :    /        |  : ; | ||||
|       '  ,/    \   \ .'         '  ,/ | ||||
|       '--'      `---`           '--' | ||||
| </pre> | ||||
| <p class="text body"> | ||||
| <br>Page: {{ error_page }} Not found...<br> | ||||
| {% endblock content %} | ||||
							
								
								
									
										27
									
								
								templates/base.html.tera
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								templates/base.html.tera
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| 
 | ||||
| <!DOCTYPE html> | ||||
| <link rel="stylesheet" type="text/css" href="/static/style.css" xmlns="http://www.w3.org/1999/html"> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
|     <title>Joey Hines.</title> | ||||
|     <link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono&display=swap" rel="stylesheet"> | ||||
|     <link rel='shortcut icon' href='/static/logo.png'/> | ||||
| </head> | ||||
| <body> | ||||
| 
 | ||||
| <div class="center"> | ||||
|     <a class="no_underline" href="/"> <h1 class="heading"> Joey Hines.</h1></a> | ||||
|         <div class="terminal"> | ||||
|             <p class="text body"> | ||||
|                 <span class="prompt">joey@ahines:~$</span> {% block command %}{% endblock command %} <br/> | ||||
|                 {% block content %}{% endblock content %} | ||||
|                 <br/> | ||||
|                 <span class="prompt">joey@ahines:~$</span> <span class="blinking">  ▊ </span> | ||||
|             </p> | ||||
|         </div> | ||||
|     <h6 class="text"> © <script type="text/javascript">document.write( new Date().getFullYear().toString());</script> Joey Hines</h6> | ||||
| </div> | ||||
| </body> | ||||
| </html> | ||||
| 
 | ||||
							
								
								
									
										21
									
								
								templates/index.html.tera
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								templates/index.html.tera
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| {% extends "base" %} | ||||
| 
 | ||||
| {% block command %} | ||||
| ./about.sh | ||||
| {% endblock command %} | ||||
| 
 | ||||
| {% block content %} | ||||
|     > Aspiring Embedded Software Engineer <br/> | ||||
|     > Electrical and Computer Engineering Masters Student at Auburn University <br/> | ||||
|     > Graduated from the University of Texas at Dallas with a BS in Computer Engineering <br/> | ||||
|     > Maker of Basic Websites <br/> | ||||
|     <br/> | ||||
| 
 | ||||
|     <span class="prompt">joey@ahines:~$</span> ls <br/> | ||||
|     {% for link in links %} | ||||
|     <a class="link" href="/{{ link.link_name }}">{{ link.link_name }}</a>   | ||||
|     {% endfor %} | ||||
|     <a class="link" href="https://www.github.com/joeyahines"> github</a>   | ||||
|     <a class="link" href="mailto:joey@ahines.net"> email</a>   | ||||
|     <a class="link" href="https://www.linkedin.com/in/joeyahines/"> linkedin</a>  <br/> | ||||
| {% endblock content %} | ||||
							
								
								
									
										11
									
								
								templates/md_page.html.tera
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								templates/md_page.html.tera
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| {% extends "base" %} | ||||
| 
 | ||||
| {% block command %} | ||||
| cat {{ page }}.md | ||||
| {% endblock command %} | ||||
| 
 | ||||
| 
 | ||||
| {% block content %} | ||||
| <br/> | ||||
| {{ md_data | safe }} | ||||
| {% endblock content %} | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user