Skip to content

Instantly share code, notes, and snippets.

View ChrisPritchard's full-sized avatar
🍻
...

Christopher Pritchard ChrisPritchard

🍻
...
View GitHub Profile
@ChrisPritchard
ChrisPritchard / CubeTest.cs
Last active October 12, 2025 23:49
Godot node script to generate cubes using two different approaches.
using System.Collections.Generic;
using Godot;
public partial class CubeTest : Node3D
{
private MeshInstance3D meshInstance;
private static readonly Color[] colour_set = [Colors.Red, Colors.Green, Colors.Blue, Colors.Yellow];
const int tower_width = 20;
@ChrisPritchard
ChrisPritchard / circuit.gdshader
Created October 11, 2025 04:16
A godot shader that generates a moving circuit like pattern.
shader_type canvas_item;
uniform float aspect_ratio: hint_range(0.1, 1.9, 0.1) = 1.0;
group_uniforms line_characteristics;
uniform float line_width: hint_range(0.001, 0.1) = 0.01;
uniform int segment_count: hint_range(0, 10, 1) = 5;
uniform float segment_length: hint_range(0.1, 1.0, 0.01) = 0.2;
uniform float tail_lag: hint_range(0.1, 1.0, 0.01) = 0.4;
@ChrisPritchard
ChrisPritchard / NoiseAtlasGenerator.cs
Created October 7, 2025 00:18
A Godot script that can generate a sprite atlas from 3D noise, to reduce runtime computation needs
using Godot;
[Tool]
public partial class NoiseAtlasGenerator : Node
{
[Export]
public NoiseTexture3D NoiseGenerator { get; set; }
[Export(PropertyHint.SaveFile, hintString: "*.png")]
public string SavePath { get; set; }
@ChrisPritchard
ChrisPritchard / ConfigLoader.cs
Created October 4, 2025 05:06
An example config loader node script in Godot (C#) making use of my yamlrecords project
[Tool]
public partial class ConfigLoader : Node
{
public static GameConfig Config { get; private set; }
private string config_path;
[Export(PropertyHint.File, hintString: "*.yml")]
public string ConfigPath
{
get => config_path; set
@ChrisPritchard
ChrisPritchard / edge-glow.gdshader
Created October 4, 2025 00:47
edge glow shader
shader_type canvas_item;
uniform vec4 line_colour : source_color = vec4(1.0); // default = white
uniform float line_thickness : hint_range(0, 0.1) = 0.04; // the max distance from a transparent fragment to search for an opaque pixel - effectively the line width as named
uniform float border_visibility : hint_range(0, 1) = 1.0; // control to fade border in and out
uniform float gradient_intensity : hint_range(0, 5) = 3; // controls how quickly the gradient falls off
uniform float gradient_steps : hint_range(1, 20) = 10; // controls the 'fineness' of the gradient
// the directions to search for an opaque pixel - each a point on the unit circle (full distance multiplies this by line_thickness)
// more directions = more accurate detection = better results around curved edges or corners
shader_type spatial;
render_mode blend_mix, depth_draw_always, cull_back, unshaded;
group_uniforms textures;
uniform sampler2D albedo_texture;
group_uniforms hologram;
uniform float opacity : hint_range(0.0, 1.0) = 0.35;
@ChrisPritchard
ChrisPritchard / godot-viewport-tips.md
Created September 20, 2025 20:30
godot-viewport-tips

to ensure the output from a viewport is high quality, scale up its content:

quad viewport content

if your content is 800x400, apply a scale of 4 to it (resulting in 3200x1600) set the viewport to the same size the quad mesh doesnt need to change size - it will scale down the viewport texture. but because its much higher resolution, the quality will be much better

import requests
import string
url = "http://localhost:8080/login.php"
headers = {"Host": "localhost:8080", "Authorization": "Basic YWRtaW46WTN0aVN0YXJDdXIhb3VzcGFzc3dvcmQ9YWRtaW4="}
cookies = {}
possible_chars = list(string.ascii_letters) + list(string.digits) + ["\\"+c for c in string.punctuation+string.whitespace ]
def get_usernames(prefix):
usernames = []
@ChrisPritchard
ChrisPritchard / Cargo.toml
Last active November 9, 2023 19:54
Capture Returns solver
[package]
name = "capture-returns"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
base64 = "0.21.5"
eval = "0.4.3"