initial commit

This commit is contained in:
Jay Robson 2024-03-01 12:51:23 +11:00
commit 53f06bd0c5
13 changed files with 4038 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "cpp-httplib"]
path = cpp-httplib
url = https://github.com/yhirose/cpp-httplib

18
CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.25)
project(Portfolio VERSION 1.0)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_FLAGS "-g")
if(NOT DEBUG_SET)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
endif()
message("Using cmake flags: ${CMAKE_CXX_FLAGS}")
file(GLOB_RECURSE SOURCES src/*.cpp)
add_executable(Portfolio ${SOURCES})
target_link_libraries(Portfolio PUBLIC stdc++)

1
cpp-httplib Submodule

@ -0,0 +1 @@
Subproject commit b4d26badf2544d6f3b749a55762eff96aefb2b19

20
src/files.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "files.hpp"
#include <fstream>
#include <sstream>
std::string Files::load(const char* path)
{
std::ifstream file(path);
std::stringstream ss;
char buff[1024];
while(!file.eof())
{
file.read(buff, 1024);
ss.write(buff, file.gcount());
}
return ss.str();
}

10
src/files.hpp Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include <string>
namespace Files
{
std::string load(const char* path);
}

24
src/main.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "../cpp-httplib/httplib.h"
#include "files.hpp"
#include <fstream>
#include <iostream>
std::string data_index = Files::load("../static/index.html");
httplib::Server svr;
int main()
{
svr.set_mount_point("/static", "../static/public/");
svr.Get("/", [](const httplib::Request& req, httplib::Response& res)
{
res.set_content(data_index, "text/html");
});
std::cout << "Listening on port 8080\n";
svr.listen("0.0.0.0", 8080);
}

48
static/index.html Normal file
View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<title>Jays Portfolio</title>
<link rel="stylesheet" href="/static/style.css" />
<script src="/static/htmx.min.js"></script>
</head>
<body>
<h1>Welcome to my portfolio website :)</h1>
<p>
Here you can see the (more notable) projects I have created and/or worked on.
</p>
<h2>Fast Nuclear Sim</h2>
<p>
The project was named this way after I built a command-line based nuclear reaction simulator
in C++ which simulated random events leading to decay chains and the radioactive isotopes themselves
(as whole integer amounts) in each simulated sample. Whilst I ended up with semi-realistic results,
with each sample containing radioactive isotopes known to be fission products, my simulation was
also far too slow and inprecise for it to actually be used in a nuclear power plant simulation.
</p>
<p>
Fast Nuclear Sim was created to be a faster, floating point based nuclear reaction simulator.
It doesn't try to approximate the isotopes themselves, but it instead approximates some of the
more key ones, such as both the uranium-235 and uranium-238 components of the fuel,
the waste products of nuclear fission, and the reduction in reactor power from xenon-135.
</p>
<img
src="/static/image/Fast-Nuclear-Sim.png"
alt="An in-game screenshot of Fast Nuclear Sim, showing the reactor core, displays for pumps, valves, the turbine, a synchroscope, as well as the plants controls."
/>
<p>
This project was created in C++ and is rendered using GLFW and OpenGL. The project is incomplete,
but still being worked on. The project is, and consists fully of, open source software.
</p>
<h3>Links</h3>
<ul>
<li><a href="https://github.com/jsrobson10/fast-nuclear-sim" target="_blank">Fast Nuclear Sim (GitHub)</a></li>
<li><a href="https://github.com/jsrobson10/nuclear-sim" target="_blank">Nuclear Sim (GitHub)</a></li>
</ul>
</body>
</html>

3905
static/public/htmx.js Normal file

File diff suppressed because it is too large Load Diff

1
static/public/htmx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 KiB

4
static/public/style.css Normal file
View File

@ -0,0 +1,4 @@
img {
width: 40%;
}

View File

@ -0,0 +1,2 @@
<p>Wowzers!</p>
<p>This thing is powerful! =)</p>