Skip to content

Instantly share code, notes, and snippets.

View Zireael07's full-sized avatar

Zireael07

View GitHub Profile
@Cenness
Cenness / colors.json
Last active November 5, 2023 12:56
Print out color pairs with their contrast
[
{
"type": "colordef",
"BLACK": [ 33, 34, 37 ],
"RED": [ 254, 63, 22 ],
"GREEN": [ 60, 168, 103 ],
"BROWN": [ 223, 112, 30 ],
"BLUE": [ 0, 106, 170 ],
"MAGENTA": [ 235, 82, 177 ],
"CYAN": [ 7, 163, 167 ],
/*
* Copyright (c) 2023 Jacob Martin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
package main
import (
"bytes"
"compress/zlib"
"crypto/sha1"
"encoding/hex"
"fmt"
"io"
"log"
@dessalines
dessalines / MessagEase_LeftN
Created January 6, 2023 16:15
MessagEase Layout for the MultilingO keyboard
{
"title":"MessagEase_LeftN",
"onScreen":{
"main":[
"[4D:aæ[ALTGR]-[MC:and:][CAPS][MC:with]v$][][4D:n+^!l`´\\/][][4D:i?[SYM][MC:that]=[MC:in:]§€x][][4D:[HIDE][Left][Up][Right][Down]]",
"[4D:h( k {%_[][][4D:ocubd[MC:qu:]pjg][][4D:rm[SHIFT])[MC:tion]|}[RB]@][][4D:[123][UNDO][COPY][REDO][PASTE][CUT][ALL][VOICE][VOICE]]",
"[4D:t<¨*[MC:the:]~y[TAB]][][4D:eœwz.\"':,][][4D:s#&>[MC:of:]f°[MC:[3+2[Colon][RB][Left]:3+2];][][4D:[DEL][WDEL] [FDEL] [MC:[SHIFT][HOME][WDEL]:|«][MC:[SHIFT][END][WDEL]:»|]]",
"[TOOL][SPACE][][][][][][][][4D:[ENTER] [EMOJI][EMOJI]][]"
],
@rsubtil
rsubtil / XML2JSON.gd
Last active October 16, 2024 18:38
Converts XML to JSON in Godot
extends Node
class_name XML2JSON
# Author: @ev1lbl0w (https://github.com/ev1lbl0w)
#
# Converts an XML file into a JSON/Dictionary:
#
# var dict = XML2JSON.parse("example.xml") # "example.xml" in JSON/Dictionary format
#
@Chikanut
Chikanut / SeeThroughMask.hlsl
Last active September 20, 2022 01:22
This is HLSL code of See Through feature, all parameters of shader must be globally seted.
float2 WorldToScreenPos(float3 pos){
pos = normalize(pos - _WorldSpaceCameraPos)*(_ProjectionParams.y + (_ProjectionParams.z - _ProjectionParams.y))+_WorldSpaceCameraPos;
float2 uv =0;
float3 toCam = mul(unity_WorldToCamera, pos);
float camPosZ = toCam.z;
float height = 2 * camPosZ / unity_CameraProjection._m11;
float width = _ScreenParams.x / _ScreenParams.y * height;
uv.x = (toCam.x + width / 2)/width;
uv.y = (toCam.y + height / 2)/width;
return uv;
@spyoungtech
spyoungtech / 1.README.md
Last active March 18, 2025 13:22
Adaptive sound - Keyboard Inputs from audio pitch

How to use

(Windows only)

  1. Download the files from this gist
  2. Install Python (using default options is OK)
  3. In command prompt, type py -m pip install --prefer-binary -r C:\path\to\requirements.txt (replacing the actual path to the requirements.txt file you downloaded from this gist)
  4. In the command prompt, type py C:\path\to\adaptivesound.py -- in 5 seconds recording will start
  5. Open the window you want to send input to
@meloonics
meloonics / PolygonSnappingArea2D
Created June 20, 2022 15:01
Script for Area2D to wrap its CollisionPolygon2D around a given Polygon2D
#######################################################################################
# ~~~~~~~~ Polygon-Snapping Area2D - written by meloonics in Godot 3.4, 2022 ~~~~~~~~ #
# HOW TO USE: #
# 1. Make a scene which has Area2D as root and a CollisionPolygon2D as child. #
# Call it whatever, but don't rename the CollisionPolygon2D. #
# 2. Attach this script to the root. #
# 3. Add the scene as child to either Polygon2D or CollisionPolygon2D. Won't work otherwise, no idea why you think it would smh my head
# 4. Adjust offset, distance and thickness to your liking. #
# The CollisionShape of the Area2D should update automatically. #
# 5. Don't overdo it with the thickness in concave shapes, or the polygon will break #
@rasmusmerzin
rasmusmerzin / build.zig
Last active May 4, 2023 07:34
ABI Zig 🔗 Typescript
// see https://gitlab.com/merzin/mono/-/tree/mono/abi
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const mode = b.standardReleaseOptions();
const lib = b.addSharedLibrary("index", "index.zig", b.version(0, 0, 0));
lib.setBuildMode(mode);
lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
lib.setOutputDir("zig-out");
@huytd
huytd / stack-machine.rs
Created April 21, 2022 01:40
Stack machine in 150 lines of Rust
const STACK_SIZE: usize = 1024;
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
pub enum OpCode {
PUSH(i32),
ADD,
CMP, // 1 if equals, 0 if different
JMP_IF1(usize), // jump if top is 1
JMP(usize), // unconditionally jump
PRINT,