Skip to content

Instantly share code, notes, and snippets.

View zicklag's full-sized avatar
🛰️
Making awesome stuff!

Zicklag zicklag

🛰️
Making awesome stuff!
View GitHub Profile
@zicklag
zicklag / lib.rs
Created October 18, 2022 17:50
AssetHandle type I used to keep the asset path along with the asset handle for serializing over the network.
use std::sync::Arc;
use bevy::{
asset::{Asset, AssetPath, LoadState},
reflect::FromReflect,
};
use bevy_has_load_progress::{HasLoadProgress, LoadProgress, LoadingResources};
use crate::prelude::*;
@zicklag
zicklag / lib.rs
Last active October 8, 2022 14:02
Rapier Bevy Lyon Debug Renderer Plugin
use bevy::{
ecs::system::SystemParam,
prelude::*,
utils::{FloatOrd, HashMap},
};
use bevy_prototype_lyon::{entity::ShapeBundle, prelude::*, shapes::Line};
use bevy_rapier2d::{
prelude::*,
rapier::{
math::Point,
@zicklag
zicklag / mod.ts
Last active September 4, 2022 00:22
Deno Blurhash Generator Microservice
import { readerFromStreamReader, readAll } from "https://deno.land/[email protected]/streams/conversion.ts";
import { serve } from "https://deno.land/[email protected]/http/server.ts";
import { decode as decodeImage, Image } from "https://deno.land/x/[email protected]/mod.ts";
import { encode as encodeBlurhash } from "https://esm.sh/[email protected]";
function clientError(message: string): Response {
return new Response(message, {
status: 400, headers: {
'x-error': message,
}
@zicklag
zicklag / README.md
Last active August 30, 2022 22:16
Strip X-Frame-Options with simple Deno proxy

Usage

  1. Install Deno
  2. Install proxy:
deno install --name embed-proxy --allow-net https://gist.githubusercontent.com/zicklag/63e1d3e7d0bc7e99f5cf8e16d185d878/raw/c423f09215ab5a2c4de84e548dcc6dc575d54076/mod.ts
  1. Run Proxy
➜ embed-proxy --help
@zicklag
zicklag / main.ts
Last active January 25, 2024 07:58
Deno TLS Proxy Using Traefik `acme.json` File For Certificates
import { copy } from "https://deno.land/[email protected]/streams/conversion.ts";
const DATA_FILE = Deno.args[0];
const LISTEN_PORT = Deno.args[1];
const TARGET_ADDR = Deno.args[2];
const DOMAIN = Deno.args[3];
interface AcmeJsonFile {
letsencrypt: {
Certificates: {
@zicklag
zicklag / 00_example.rs
Last active August 7, 2022 15:27
Custom Command Queues in Bevy
use bevy::prelude::*;
use custom_commands::*;
struct MyPlugin;
// Create a marker type that represents our custom command queue
struct MyCmds;
impl Plugin for MyPlugin {
fn build(app: &mut App) {
@zicklag
zicklag / player_state.rs
Last active August 3, 2022 17:09
Punchy player state work-in-progress POC
use std::collections::VecDeque;
use std::marker::PhantomData;
use bevy::{
ecs::{
entity::Entities,
system::{CommandQueue, SystemParam},
},
prelude::*,
reflect::FromType,
@zicklag
zicklag / custom3d_wgpu.rs
Created May 26, 2022 19:59
Egui WGPU custom rendering example
use std::sync::Arc;
use eframe::{
egui_wgpu::{self, wgpu},
wgpu::util::DeviceExt,
};
pub struct Custom3d {
angle: f32,
}
@zicklag
zicklag / base58-to-array.ts
Created December 6, 2021 19:07
Base58 decode to array for Solana key from Phantom
import bs58 from "https://cdn.skypack.dev/bs58";
const bytes = bs58.decode(Deno.args[0]);
console.log(JSON.stringify(Array.from(bytes)));
@zicklag
zicklag / index.template.gitignore.html
Created October 8, 2021 14:18
WebGL lint setup for WGPU
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
</head>
<script
src="./webgl-lint.gitignore.js"
data-gman-debug-helper='
{
"throwOnError": false
}