Skip to content

Instantly share code, notes, and snippets.

View johnfredcee's full-sized avatar
🚀
On an intergalactic cruise

John Connors johnfredcee

🚀
On an intergalactic cruise
View GitHub Profile
$scope = "Process"
$pathElements = @([Environment]::GetEnvironmentVariable("PATH", $scope) -split ";")
$pathElements += "D:\Dev\msys64\mingw64\bin"
$pathElements += "D:\Dev\msys64\usr\bin"
$newPath = $pathElements -join ";"
[Environment]::SetEnvironmentVariable("PATH", $newPath, $scope)
[System.Diagnostics.Process]::Start("D:\Apps\emacs\bin\runemacs.exe", "--debug-init");
@johnfredcee
johnfredcee / Nez.DotnetCore.csproj
Created September 2, 2020 15:45
Project file to build Nez with dotnetcore3.1
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>Nez</AssemblyName>
<RootNamespace>Nez</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG</DefineConstants>
@johnfredcee
johnfredcee / dotnet.csproj
Last active September 2, 2020 15:43
Monogame App csproj using local dlls for dotnet core3.1
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishReadyToRun>false</PublishReadyToRun>
<TieredCompilation>false</TieredCompilation>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
@johnfredcee
johnfredcee / vec.cpp
Last active September 23, 2019 16:00
C++17 generic vector class
#include <cstddef>
#include <array>
#include <tuple>
template <typename T, std::size_t N>
struct Vec
{
std::array<T, N> m;
$scope = "Process"
$pathElements = @([Environment]::GetEnvironmentVariable("PATH", $scope) -split ";")
$pathElements += "D:\Dev\Go\bin"
$pathElements += "D:\Dev\msys64\mingw64\bin"
$newPath = $pathElements -join ";"
[Environment]::SetEnvironmentVariable("PATH", $newPath, $scope)
[Environment]::SetEnvironmentVariable("GOROOT", "D:\Dev\Go", $scope)
[Environment]::SetEnvironmentVariable("GOPATH", "D:\Dev\projects\myGo", $scope)
[Environment]::SetEnvironmentVariable("CGO_ENABLED", "1", $scope)
@johnfredcee
johnfredcee / wxApp.cpp
Created June 11, 2019 13:51
wxWidgets Hello World
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
class App : public wxApp
{
public:
bool OnInit();
@johnfredcee
johnfredcee / CMakeLists.txt
Created June 11, 2019 13:50
CMake for wxWidgets HelloWorld
cmake_minimum_required(VERSION 3.1)
project(wxApp CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(wxWidgets_USE_LIBS)
find_package(wxWidgets)
include(${wxWidgets_USE_FILE})
@johnfredcee
johnfredcee / facelist.py
Created January 2, 2019 16:13
Mesh representation - with edges.
# if you can't rely on euclid, what can you rely on?
import euclid
from euclid import Vector3
class Mesh:
def __init__(self, vertices=[], faces=[]):
"""Initialises a vertex with a list of faces. Vertex array is a list of Vector3. Face array is a list of 3 tuple indexes into vertex array."""
self.vertex_list = vertices
self.face_list = faces
@johnfredcee
johnfredcee / facelist.py
Created December 31, 2018 09:43
Slightly less naive mesh represenation
# if you can't rely on euclid, what can you rely on?
import euclid
from euclid import Vector3
class Mesh:
def __init__(self, vertices=[], faces=[]):
"""Initialises a vertex with a list of faces. Vertex array is a list of Vector3. Face array is a list of 3 tuple indexes into vertex array."""
self.vertex_list = vertices
self.face_list = faces
@johnfredcee
johnfredcee / vertlist.py
Last active December 31, 2018 09:43
Naive mesh representation
import euclid
from euclid import Vector3
# naive first attempt at a mesh representation
# a straight list of vertices
class Mesh:
def __init__(self, vertices=[]):