Skip to content

Instantly share code, notes, and snippets.

View alexandrubagu's full-sized avatar
:octocat:

Alexandru Bogdan Bâgu alexandrubagu

:octocat:
View GitHub Profile
@kenjinp
kenjinp / rapierHeightfieldsFromImage.ts
Created December 11, 2021 16:46
Create a Rapier Heightfield Collider from an Image (Heightmap)
import getPixels from "get-pixels";
import { max, min } from "lodash";
import { NdArray } from "ndarray";
import { Vector3 } from "three";
// Example, use like:
const makeHeightfieldColliderFromImage = async () => {
const heightMapTexture = "myimage.png";
const xSubdivisions = 200;
const zSubdivisions = 200;
@ayamflow
ayamflow / rotate-uv.glsl
Created January 16, 2018 23:24
Rotate UV in GLSL
vec2 rotateUV(vec2 uv, float rotation)
{
float mid = 0.5;
return vec2(
cos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid,
cos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid
);
}
vec2 rotateUV(vec2 uv, float rotation, vec2 mid)
@alanpeabody
alanpeabody / my_app.ex
Last active February 19, 2025 16:29
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@denji
denji / nginx-tuning.md
Last active October 30, 2025 20:38
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.