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 / 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": {
@samyranavela
samyranavela / Example health-check script with systemd socket activation
Created April 18, 2018 12:56 — forked from kouk/Example health-check script with systemd socket activation
Simple HTTP health-check by abusing systemd socket activation with shell scripts
$ curl --dump-header - localhost:12345
HTTP/1.0 404 Not Found
Content-Type: text/html
Content-Length: 43
Date: Fri, 05 Dec 2014 17:48:56 +0000
<html>
<body>
<h1>WUT</h1>
</html>