Skip to content

Instantly share code, notes, and snippets.

View THeK3nger's full-sized avatar
😪

Davide Aversa THeK3nger

😪
View GitHub Profile
@THeK3nger
THeK3nger / ElevenlabsAPI.cs
Last active April 3, 2024 19:49
Unity script for using ElevenLabs TTS service
/**
* An example script on how to use ElevenLabs APIs in a Unity script.
*
* More info at https://www.davideaversa.it/blog/elevenlabs-text-to-speech-unity-script/
*/
using System;
using System.Collections;
using System.Text;
using Newtonsoft.Json;
@THeK3nger
THeK3nger / signal.ts
Last active July 3, 2022 11:02
Example TypeScript Event System
/**
MIT License
Copyright (c) 2022 Davide Aversa
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
@THeK3nger
THeK3nger / find-old-binaries.rb
Last active May 6, 2020 13:31
Find old binary blobs in Git repository. Usage example `ruby find-old-binaries.rb master 0.5 true`
#!/usr/bin/env ruby -w
head, treshold, only_orphans = ARGV
only_orphans ||= false
head ||= 'HEAD'
Megabyte = 1000 ** 2
treshold = (treshold || 0.1).to_f * Megabyte
# Usage:
# ruby find-old-binaries.rb <branch> <size limit in MB> <show only orphans?>
#
@THeK3nger
THeK3nger / .gitconfig
Created November 6, 2018 14:32
Some things I need to remember on my git configuration
[user]
name = <name>
email = <email>
[core]
autocrlf = true
excludesfile =
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f

Keybase proof

I hereby claim:

  • I am thek3nger on github.
  • I am thek3nger (https://keybase.io/thek3nger) on keybase.
  • I have a public key ASBeq890Cwv4T8V9KPhlUVQ42_gYNfrS5pP1HEu-8uqBAgo

To claim this, I am signing this object:

@THeK3nger
THeK3nger / ShaderLoader.js
Created October 27, 2016 09:29
THREE.js Asynchronous Shader Loader
// This is a basic asyncronous shader loader for THREE.js.
function ShaderLoader(vertex_url, fragment_url, onLoad, onProgress, onError) {
var vertex_loader = new THREE.XHRLoader(THREE.DefaultLoadingManager);
vertex_loader.setResponseType('text');
vertex_loader.load(vertex_url, function (vertex_text) {
var fragment_loader = new THREE.XHRLoader(THREE.DefaultLoadingManager);
fragment_loader.setResponseType('text');
fragment_loader.load(fragment_url, function (fragment_text) {
onLoad(vertex_text, fragment_text);
});
@THeK3nger
THeK3nger / binaryheap.ts
Last active May 30, 2021 14:00
TypeScript BinaryHeap
// Original JavaScript Code from Marijn Haverbeke (http://eloquentjavascript.net/1st_edition/appendix2.html)
export class BinaryHeap<T> {
content: T[];
scoreFunction: (x: T) => number;
constructor(scoreFunction: (x: T) => number) {
this.content = [];
this.scoreFunction = scoreFunction;
}
@THeK3nger
THeK3nger / img2movingai.py
Created February 8, 2016 21:12
Convert an image into a MovingAI .map file.
# Convert an image into a MovingAI .map file.
# @author Davide Aversa <thek3nger@gmail.com>
# @version 1.0.0
import sys
from PIL import Image
def load_image(filename):
"""
class NameGenerator {
static string[] NameDatabase1 = { "Ba","Bax","Dan","Fi","Fix","Fiz","Gi","Gix","Giz","Gri","Gree","Greex","Grex",
"Ja","Jax","Jaz","Jex","Ji","Jix","Ka","Kax","Kay","Kaz","Ki","Kix","Kiz","Klee","Kleex","Kwee","Kweex",
"Kwi","Kwix","Kwy","Ma","Max","Ni","Nix","No","Nox","Qi","Rez","Ri","Ril","Rix","Riz","Ro","Rox","So","Sox",
"Vish","Wi","Wix","Wiz","Za","Zax","Ze","Zee","Zeex","Zex","Zi","Zix","Zot" };
static string[] NameDatabase2 = { "b","ba","be","bi","d","da","de","di","e","eb","ed","eg","ek","em","en","eq",
"ev","ez","g","ga","ge","gi","ib","id","ig","ik","im","in","iq","iv","iz","k","ka","ke","ki","m","ma","me","mi",
"n","na","ni","q","qa","qe","qi","v","va","ve","vi","z","za","ze","zi","","","","","","","","","","","","","" };