Skip to content

Instantly share code, notes, and snippets.

View sortofsleepy's full-sized avatar

Joe sortofsleepy

View GitHub Profile
@sortofsleepy
sortofsleepy / archnotes.md
Last active October 17, 2024 03:08
Arch installation notes

Notes on installing Arch

  • This is based on the offical wiki
  • This will install Arch, KDE and Grub.
  • This is just a minimal example with no real special customizations. The point is to remove some of the extra info the typical user likely won't need to worry about (yet)
  • This assumes you've alrady downloaded the Arch iso.
  • Some things may look a bit different for you; trying this on a Hyper-V virtual machine in Windows first.
  • Secure boot will need to be disabled during install. On Hyper-V I'm not sure what the right way is to re-enable but if you're doing an actual install, these are the provided notes

All in all, despite what you may have heard, installing Arch isn't actually that bad as long as you have a basic understanding of the terminal, there's just a lot of things to do to get a basic setup working which you should "hopefully" have at the end of thi

@sortofsleepy
sortofsleepy / timer.rs
Last active October 14, 2024 11:40
setInterval-like behavior in Rust
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
#[derive(Clone)]
struct Cube {
i: Arc<Mutex<i32>>,
}
impl Cube {
@sortofsleepy
sortofsleepy / scale.js
Last active September 23, 2024 13:09
Basic Image scaling
function scaleImage(img, ctx, targetWidth, targetHeight) {
const widthRatio = targetWidth / img.width;
const heightRatio = targetHeight / img.height;
const scale = Math.max(widthRatio, heightRatio);
let finalWidth = img.width * scale;
let finalHeight = img.height * scale;
// calcualte overlap, if any, between final width and contianer with
@sortofsleepy
sortofsleepy / spritesheet.glsl
Created September 10, 2024 21:51
glsl spritesheet helper
// A helper to sample a section of a texture. useful for things like spritesheets.
// texCoord - uvs of the surface you're rendering to
// imageSize - the size of the patch you want to sample
// fulLTextureSize - the full dimensions of the texture you're sampling from
// imageCoord - the x/y value of the section to sample from.
// Sourced from @Gabor on Disccord in the @creativecode server.
vec2 sample_section(
vec2 texCoord,
vec2 imageSize,
@sortofsleepy
sortofsleepy / refs.glsl
Last active August 20, 2024 13:27
Vulkan Buffer Reference basics
// ... version, etc
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
struct SceneDataTable {
uint64_t vertices;
};
layout(buffer_reference, scalar) buffer Vertices { vec4 v[]; };
@sortofsleepy
sortofsleepy / grid_helper.glsl
Last active September 1, 2024 12:52
Grid position helper functions
// some general helpers on how to sample a 1D grid.
// returns the x/y coordinate of value inside of an 1D array/grid.
// pass in the desired index. size refers to the "width" of the grid.
// note that you may have to round/floor the value depending on your needs, ivec2 is only available in glsl.
ivec2 get_coord(int index, int size){
return ivec2(index % size, index / size);
}

Rollup / SSR / Phoenix LiveView notes

(IN PROGRESS)

Rollup can be configured to build the necessary parts to do SSR with JS frameworks. I've only tested w/ Solid but with some modifications, you can also adapt the following for things like Svelte and perhaps other frameworks.

This is actually based largely off of LiveSvelte but I wanted to use something more common these days like Rollup - this is however just

@sortofsleepy
sortofsleepy / .gitlab-ci.yml
Last active May 20, 2024 13:12
Gitlab CI deploy to cloudflare example
image: node:latest
cache:
paths:
- node_modules/
stages:
- build
compile:
@sortofsleepy
sortofsleepy / Unreal notes.md
Last active April 10, 2024 01:13
Web/OpenGL -> Unreal Engine

Some general observations about Unreal. Note that I am dumb and some mistakes / misinformation might be present.

Units

1 "unit" in unreal for setting something is approximately setting that object to 0.01 scale.

For example, for the default 100x100x100 cube, to make it 1x1x1, you set the scale of that to 0.01

I believe things are "technically" in cm, but don't quote me on that.

@sortofsleepy
sortofsleepy / .gitdepsignore
Last active March 19, 2024 16:14
Setup UE w/ some excluded dependencies
/Engine/Extras/VisualStudioDebugging/**
/Engine/Extras/VisualStudioSnippets/**
/Engine/Extras/Maya_AnimationRiggingTools/**
/Engine/Extras/MayaVelocityGridExporter/**
/Engine/Plugins/Online/**