Skip to content

Instantly share code, notes, and snippets.

View samyranavela's full-sized avatar

Samy RANAVELA samyranavela

  • Soustons, France
View GitHub Profile
@samyranavela
samyranavela / markovjr_tech_notes.md
Created May 15, 2025 10:30 — forked from dogles/markovjr_tech_notes.md
Markov Jr. Technical Notes

Introduction

Markov Jr. is an open source C# application that creates procedural content primarily via applying Markov rewrite rules to a 2D or 3D grid. A rewrite rule has an input and output pattern, which essentially specifies what pattern to look for in the existing grid, and what to replace it with.

For example, given a 2D grid, this would replace any white dot with a white cross:

***/*W*/*** :: *W*/WWW/*W*

The left hand side is the rule input, and the right hand side is the output. The / character is used to delimit rows, and space is used to delimit Z-layers (in 3D grids). The input rule above translates to the 2D pattern:

@samyranavela
samyranavela / TerrainDataCloner.cs
Created February 3, 2023 23:01 — forked from Eldoir/TerrainDataCloner.cs
Helper to deep-copy a TerrainData object in Unity3D
using UnityEngine;
/// <summary>
/// Provides means to deep-copy a TerrainData object because Unitys' built-in "Instantiate" method
/// will miss some things and the resulting copy still shares data with the original.
/// </summary>
public class TerrainDataCloner
{
/// <summary>
/// Creates a real deep-copy of a TerrainData
# Extension package to add on Ubuntu 14.04
sudo apt-get install libxml2-dev libbz2-dev libmcrypt-dev libreadline-dev libxslt1-dev autoconf -y
# Extension package to add on Ubuntu 18.04
sudo apt-get install libssl-dev
# Extension package to add on Ubuntu 20.04
sudo apt install -y pkg-config libssl-dev libsqlite3-dev libbz2-dev libxml2-dev libcurl4-openssl-dev libonig-dev libpq-dev libreadline-dev libxslt1-dev libzip-dev libsodium-dev libwebp-dev
# +apxs2
sudo apt-get install apache2-dev -y
@samyranavela
samyranavela / xdebug-mac.md
Created February 29, 2020 06:22 — forked from ankurk91/xdebug-mac.md
php xDebug on Ubuntu/Mac and phpStorm 2019

🪲 Install and Configure xDebug on MacOS for PhpStorm 🐘

⚠️ This guide only applies to Homebrew v1.6+

  • Check your version brew --version before proceeding

  • Assuming that you have already installed php and apache via Homebrew v1.6+

  • Install xDebug php extension

pecl channel-update pecl.php.net
pecl clear-cache
@samyranavela
samyranavela / Colibris_2018-04-06_CQRS.md
Created September 14, 2019 11:04 — forked from seb-martin/Colibris_2018-04-06_CQRS.md
Des ressources sur CQRS ainsi que sur le DDD et l'Event Sourcing

Intro CQRS et plus (DDD, ES)

CQRS (Command and Queries Responsibility Segregation)

Le modèle CQRS tel que j'ai essayé de vous le décrire, en mieux.

@samyranavela
samyranavela / bash.sh
Created July 25, 2019 13:40
Rename a Database in MySQL
mysql -u dbUsername -p"dbPassword" oldDatabase -sNe 'show tables' | while read table; do mysql -u dbUsername -p"dbPassword" -sNe "RENAME TABLE oldDatabase.$table TO newDatabase.$table"; done
@samyranavela
samyranavela / Instructions.md
Created October 4, 2018 10:12 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

@samyranavela
samyranavela / gist:9f8a313e71726e8acd21b00ede3b865b
Created October 4, 2018 10:09 — forked from pironim/gist:2f578c60afb67f156136
git pre-commit hook to check branch name
#!/bin/bash
#
# Pre-commit hooks
# Check branch name
BRANCH_NAME_LENGTH=`git rev-parse --abbrev-ref HEAD | grep -E '^t[0-9]{2,16}\_.*_[A-Za-z]{2,2}$' | wc -c`
if [ ${BRANCH_NAME_LENGTH} -eq 0 ] ; then
echo -e '\E[37;44m'"\033[1mERROR\033[0m in pre-commit hook: vim /export/web/.git/hooks/pre-commit"
echo "Branch name should be like t00000_blah_blah_CA - brand is two letters"
@samyranavela
samyranavela / queries_lorrainejug_gist.js
Created August 29, 2018 09:08 — forked from lucianprecup/queries_lorrainejug_gist.js
Quelques requêtes Elasticsearch utilisées lors de la démonstration Lucene @LorraineJug
//-- pertinence et idf (Jean-Claude Jean après ville=Rueil)
{
"query": {
"bool": {
"should": [
{
"text": {
"nom": "jean"
}
},
@samyranavela
samyranavela / gist:44a4144813fab3a410632a500ae027ca
Created July 26, 2018 13:14
ou can use a top_hits aggregation that groups on the country field, returns 1 doc per group, and orders the docs by the collected date descending: https://stackoverflow.com/questions/29016271/how-to-get-latest-values-for-each-group-with-an-elasticsearch-query
POST /test/_search?search_type=count
{
"aggs": {
"group": {
"terms": {
"field": "country"
},
"aggs": {
"group_docs": {
"top_hits": {