Skip to content

Instantly share code, notes, and snippets.

View Rickodesea's full-sized avatar

Alrick Grandison (Algodal) Rickodesea

View GitHub Profile
@patriciogonzalezvivo
patriciogonzalezvivo / include.py
Last active January 14, 2024 23:38
Resolve includes for GLSL, HLSL and metal on Python
import re
from os.path import join, abspath, dirname, basename
def load_source( folder: str, filename: str, dependencies = []):
path = abspath( join(folder, filename) )
if path in dependencies:
return ""
else:
dependencies.append( path )
@scivision
scivision / AddGitSubmodule.cmake
Last active March 18, 2024 14:02
CMake: init/update a Git submodule and add_subdirectory()
find_package(Git REQUIRED)
function(add_git_submodule dir)
# add a Git submodule directory to CMake, assuming the
# Git submodule directory is a CMake project.
#
# Usage: in CMakeLists.txt
#
# include(AddGitSubmodule.cmake)
# add_git_submodule(mysubmod_dir)
@samsch
samsch / .md
Created January 21, 2021 14:23
Express-session isn't saving cookies, or cookie seems to be ignored?

Common issues

Multiple origins

By default, the cookies express-session sets will not work if your server's url isn't the same origin as your front end page where you are making requests from. For example, if you are using Create React App's server on localhost:3000, and your server is running at localhost:8000, cookies won't be saved without extra configuration for CORS.

If you can avoid multiple origins, I recommend doing that. A single origin avoids CORS configuration which tends to be troublesome. Most front end build tools (including Create React App) have options to proxy requests to your backend server. Even better are tools which build your front end to files that can be directly served by your backend (such as using Parcel's watch command).

The CORS configuration will include:

  • Setting SameSite on your cookie options to none.
@RichardBray
RichardBray / glsl_circle.frag
Last active March 19, 2024 19:14
Simple GLSL circle example
#ifdef GL_ES
precision mediump float;
#endif
// Being in values from the CPU
// Read only value sent to all the threads/processes
uniform vec2 u_resolution; // Global vector shader variable
float circleShape(float radius, vec2 position) {
// distance(p1, p2) - returns the distance between two points
@YukiSnowy
YukiSnowy / main.cpp
Last active March 20, 2024 19:10
example SDL2 Vulkan application
// g++ *.cpp -o vulkan -lSDL2main -lSDL2 -lvulkan-1
// https://vulkan-tutorial.com/
#include <iostream>
using namespace std;
#include <SDL2/SDL.h>
SDL_Window *window;
char* window_name = "example SDL2 Vulkan application";
@camh-
camh- / eol-at-eof.md
Created March 7, 2020 04:41
Please add newlines at end of files

See https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

A newline in a text file is a terminator, not a separator. This means each line should have a newline at the end of it, including the last line of the file.

Many editors automatically add the newline at the end of the file. Some do not. If you can configure your editor to ensure there is always a newline at the end of every line, please do so.

Because many editors do add this newline, if you commit a text file without it, when someone else edits the file, their editor will (correctly) add the newline. This causes a spurious diff in the file. Spurious

@Erfan-Ahmadi
Erfan-Ahmadi / rendering_engine.md
Last active March 19, 2024 03:46
Rendering Engine Development

1. What does the Rendering Engine Need?

  • Rendering Engine
    • Support for Multiple Graphics APIs : OpenGL | Vulkan | DirectX12 | DirectX11 | Metal
    • Content Export Pipeline : Create Maya/Max Plugins to export meshes based on Renderers needs. (Assimp Commercial Licence -> Pay)
    • Texture Compression Libraries
    • Material System : Artists Configure shaders, textures, parameters to import in game
    • Game-side Manager of Models/Materials/Lights
    • Good Visibility System (Frustum/Occlusion) (VisibilityBuffers?)
    • Multi-Threded Submission System to reduce cost of submission to GPU
  • Lighting/Shadow Rendering System
@zhanglongqi
zhanglongqi / setup_WPA2_with_hidden_SSID.md
Last active June 12, 2023 10:44
Connect to WPA2 Personal with hidden SSID using command line on Linux

This command will add your network parameters to the configuration file of wpa_supplicant

sudo -s
wpa_passphrase YOUR_SSID YOUR_PASSWORD >> /etc/wpa_supplicant/wpa_supplicant.conf

If the SSID of the network is hidden additional step need to be done:

sudo vim /etc/wpa_supplicant/wpa_supplicant.conf

Update what you just added scan_ssid=1 in your network parameters, such as from

@adituv
adituv / main.cpp
Created February 16, 2017 23:31
SDL Gamepad Input Stuff
#include <cstdio>
#include <string>
#include <vector>
#include <SDL.h>
void logJoystickEvent(SDL_Event e);
std::string showHatState(Uint8 hat);
int main(int argc, char* argv[]) {
// Detect first gamepad on which a key is pressed, then log its events.
@Gumichan01
Gumichan01 / circle.cpp
Last active April 1, 2024 14:56
[SDL2] Draw and fill a circle
int
SDL_RenderDrawCircle(SDL_Renderer * renderer, int x, int y, int radius)
{
int offsetx, offsety, d;
int status;
CHECK_RENDERER_MAGIC(renderer, -1);