Skip to content

Instantly share code, notes, and snippets.

View Allakazan's full-sized avatar
👽

Bruno Marques Allakazan

👽
View GitHub Profile
@Allakazan
Allakazan / colorCorrectionUtils.frag
Created January 6, 2025 13:17
Some color correction functions for WebGL
vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
}
vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
}
vec4 sRGBToLinear( in vec4 value ) {
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
@Allakazan
Allakazan / ChessPiece.tsx
Created January 3, 2025 14:30
How to use useCursor with invisible hitbox
import { Color } from "three";
import { ChessPieceModel, GLTFResult } from "./ChessPieceModel";
import { useState } from "react";
import { useCursor } from "@react-three/drei";
interface BaseChessPieceProps {
piece: keyof GLTFResult["nodes"];
color: "white" | "black";
position: [number, number];
}
@Allakazan
Allakazan / walk_array.php
Created December 17, 2020 18:32 — forked from mlconnor/walk_array.php
php function to walk an array/object recursively
/**
* works for json objects. will replace all
* keys and values with the result of the
* closure.
*/
function walk_recursive($obj, $closure) {
if ( is_object($obj) ) {
$newObj = new stdClass();
foreach ($obj as $property => $value) {
$newProperty = $closure($property);
@Allakazan
Allakazan / install_voices.sh
Created October 22, 2020 01:48 — forked from kastnerkyle/install_voices.sh
Install festival and festival voices in Ubuntu
# https://ubuntuforums.org/archive/index.php/t-751169.html
sudo apt-get install -y festival festlex-cmu festlex-poslex festlex-oald libestools1.2 unzip
sudo apt-get install -y festvox-don festvox-rablpc16k festvox-kallpc16k festvox-kdlpc16k
mkdir cmu_tmp
pushd .
cd cmu_tmp/
wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_awb_arctic-0.90-release.tar.bz2
wget -c http://www.speech.cs.cmu.edu/cmu_arctic/packed/cmu_us_bdl_arctic-0.95-release.tar.bz2
@Allakazan
Allakazan / your-project.service
Last active March 16, 2020 01:54
Node Js service on Systemd
# this file need to be on /etc/systemd/system/
[Unit]
Description=Your Node Service
After=network.target
[Service]
User=root
WorkingDirectory=/path/to/your/node-project
ExecStart=/usr/bin/node /path/to/your/node-project/index.js