Skip to content

Instantly share code, notes, and snippets.


Louis Beaumont louis030195

View GitHub Profile
louis030195 / SpawnThingsAboveGround.cs
Last active Jun 3, 2020
Unity helper to spawn object above ground or try to spawn objects above ground in a random sphere while keeping a given distance
View SpawnThingsAboveGround.cs
public static class Spatial
/// <summary>
/// Return position above ground relatively from the prefab size
/// Global position
/// </summary>
/// <param name="position"></param>
/// <param name="prefabHeight">Prefab height needed in order to place well on top of ground</param>
/// <param name="transform">Transform parent</param>
/// <param name="layerMask">Layers to ignore</param>
louis030195 / diamond.go
Created May 7, 2020
Diamond square algorithm in Golang
View diamond.go
package main
import (
// Copy pasta
// Originally was Java, then C# then Go ... have fun
////size of grid to generate, note this must be a
louis030195 / Makefile
Created May 1, 2020
Makefile to build Unity project for Linux (since Unity doesn't provides any documentation for Linux)
View Makefile
UNITY_PROJECT_PATH ?= $(HOME)/my/path/to/unity/project
NS ?= my_game_name
VERSION ?= 1.0.0
EDITOR_PATH ?= $(HOME)/my/path/to/unity/project
CUSTOM_BUILD_SCRIPT ?= MyNameSpace.MyClass.MyFunction
.PHONY: help build run
@echo ''
@echo 'Usage: make [TARGET]'
louis030195 / Dockerfile
Created Apr 30, 2020
Simulate Apache Kafka changes safely and cleanly before doing it in production
View Dockerfile
FROM debian:9
# Wget, ps, java
RUN apt-get update && apt-get install -y wget procps default-jdk
# Current version
View grpc_test.go
package main
import (
erutan ""
louis030195 /
Created Apr 14, 2020
Bash script to wait for an open port inside Docker container
while [ ! "$(docker exec -t -i $CONTAINER_NAME curl --write-out %{http_code} --silent --output /dev/null localhost:$PORT)" = "-ne 200" ] ; do
echo "Waiting for port $PORT to be opened ..."
sleep 20
louis030195 /
Last active Apr 21, 2020
JSON to YAML, one liner bash, usage: chmod +x && ./ my_json.json my_yaml.yml
python3 -m venv .my_super_env && # Yeah random name to avoid erasing local virtualenv
source .my_super_env/bin/activate &&
pip install pyyaml &&
python3 -c "import yaml, json, sys
sys.stdout.write(yaml.dump(json.load(sys.stdin)))" \
< $1 > $2
# Remove the temporary venv in any case
rm -rf .my_super_env
View protodef_example_split.json
"name": "myList",
"type": [
"count": ";",
"type": [
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
fn index() -> &'static str {
let coll = client.db("media").collection("movies");
coll.insert_one(doc!{ "title": "Back to the Future" }, None).unwrap();
coll.update_one(doc!{}, doc!{ "director": "Robert Zemeckis" }, None).unwrap();
coll.delete_many(doc!{}, None).unwrap();
// See
mod test {
use mongodb::{doc, error::Error, oid::ObjectId};
use rocket::http::{ContentType, Status};
use rocket::local::Client;
use rocket_contrib::json::Json;
use rustlang_rocket_mongodb::cats::Cat;
use rustlang_rocket_mongodb::rocket;
You can’t perform that action at this time.