Skip to content

Instantly share code, notes, and snippets.

View HyroVitalyProtago's full-sized avatar
💭
🦾 🧠

HyroVitalyProtago

💭
🦾 🧠
View GitHub Profile
// sensor via https://wiki.postmarketos.org/wiki/PINE64_PinePhone_(pine64-pinephone)#Sensors
const x_path = "/sys/bus/iio/devices/iio:device3/in_accel_x_raw"
const y_path = "/sys/bus/iio/devices/iio:device3/in_accel_y_raw"
const z_path = "/sys/bus/iio/devices/iio:device3/in_accel_z_raw"
var fs = require("fs");
var express = require('express');
var app = express();
// could be WSS but fast enough on LAN as-is
@KenneyNL
KenneyNL / CircularMenu.cs
Last active June 23, 2022 19:41
Circular menu sample code for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CircularMenu : MonoBehaviour{
public float radius = 100.0f;
public float offset = 0.0f;
void Start(){
@madjin
madjin / crosslink.md
Last active April 13, 2022 16:36
Cross-Linking Virtual Worlds
@cwervo
cwervo / outline-geometry-component.js
Last active February 13, 2020 22:27
A < 20 line (Hack-ish) A-Frame Outline Geometry component
AFRAME.registerComponent('outline-geometry', {
schema : {
margin : { default : 1.025 },
color: { default : 'red' },
},
init : function () {
var p = this.el;
var p_prime = p.cloneNode(true);
p_prime.removeAttribute('outline-geometry')
p_prime.setAttribute('material', 'color', this.data.color)
@xDavidLeon
xDavidLeon / UnityStandardBRDF.cginc
Created March 26, 2016 10:38
UnityStandardBRDF modification for Cel Shading.
#ifndef UNITY_STANDARD_BRDF_INCLUDED
#define UNITY_STANDARD_BRDF_INCLUDED
#include "UnityCG.cginc"
#include "UnityStandardConfig.cginc"
#include "UnityLightingCommon.cginc"
//-------------------------------------------------------------------------------------
// Legacy, to keep backwards compatibility for (pre Unity 5.3) custom user shaders:
#define unity_LightGammaCorrectionConsts_PIDiv4 (IsGammaSpace()? (UNITY_PI/4)*(UNITY_PI/4): (UNITY_PI/4))
@DashW
DashW / ScreenRecorder.cs
Last active April 28, 2025 07:38
ScreenRecorder - High Performance Unity Video Capture Script
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
class BitmapEncoder
{
public static void WriteBitmap(Stream stream, int width, int height, byte[] imageData)
@oliver-dew
oliver-dew / Component system
Last active April 15, 2016 14:30
Component System using Mix-ins for Codea / Lua
--# Main
-- Component System by Utsira. uses runtime mix-ins to add component's methods to entities (ie not a pure entity - component - system model).
-- TO USE:
-- Entity is a superclass that adds the method :add, for adding (including) components to game objects(entities).
-- Components are tables, but use : to name their methods.
-- If component has an iterator table then it is a system. Iterate will run through every entity that is part of that system
-- If component has an :init function, this will not be added to the entity, but will instead be run when the component is added
-- Use this function to perform your initial setup
function setup()
@gafferongames
gafferongames / delta_compression.cpp
Last active April 28, 2025 22:48
Delta Compression
/*
Delta Compression by Glenn Fiedler.
This source code is placed in the public domain.
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/
*/
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
@chrisjz
chrisjz / MyoUnityRawEmg
Last active January 3, 2022 14:03
EMG Raw Data access for Myo Unity package in SDK for Windows version 0.8.0
Patch for Myo Unity package for SDK Windows 0.8.0 to access EMG raw data.
@leegrey
leegrey / TileMapPathField.ts
Last active May 4, 2020 12:52
Pathfinding on a Grid with Flow Fields
// Copyright Lee Grey, 2014
// License: MIT
module lg.tileSystem {
import Vector2D = lg.math.geometry.Vector2D;
export class FieldInfo {
distanceFromTarget: number = -1;