Skip to content

Instantly share code, notes, and snippets.

View elfefe's full-sized avatar
💭
Mmmmh... Ah !

elfefe elfefe

💭
Mmmmh... Ah !
View GitHub Profile
@elfefe
elfefe / ConsoleToFile.md
Created December 2, 2022 09:18
Output console to file in bash

###Overview:

Please note that the n.e. in the syntax column means "not existing".
There is a way, but it's too complicated to fit into the column. You can find a helpful link in the List section about it.

          || visible in terminal ||   visible in file   || existing
  Syntax  ||  StdOut  |  StdErr  ||  StdOut  |  StdErr  ||   file   

==========++==========+==========++==========+==========++===========

@elfefe
elfefe / genetic_algorithm.py
Created November 27, 2022 19:42
A genetic algorithm for science experiment tests purpose
import random
EQUATION_PARAMETERS_ITERATIONS = 1000
EQUATION_PARAMETERS_RANGES = [
[0, 10],
[0, 10]
]
EQUATION_PARAMETERS_MAX_DECIMALS = 2
EQUATION_RESULT_ITERATIONS = 10000
@elfefe
elfefe / commands.sh
Created October 5, 2022 10:06
Git commands
# Get every commits where "file" as been modified
git log --follow -- path/to/your/file
@elfefe
elfefe / libraries
Created September 8, 2022 13:38
Usefull JS libraries
o https://greensock.com/
o https://threejs.org/
@elfefe
elfefe / logs.py
Last active September 1, 2022 08:50
Logs data in file and in console
import os
import datetime
import traceback
import logging
date = datetime.datetime.now().strftime('%Y-%m-%d')
os.mkdir("logs")
logging.basicConfig(
handlers=[logging.FileHandler(filename=f'logs/{date}.log', encoding='utf-8', mode='a+')],
format="%(asctime)s %(levelname)s: %(message)s",
@elfefe
elfefe / dragWidth.kt
Last active April 13, 2023 07:15
Jetpack Compose
@Composable
protected fun Card(
modifier: Modifier,
content: @Composable RowScope.() -> Unit
) {
var draggedAmount by remember { mutableStateOf(0f) }
val contentWidth by animateFloatAsState(targetValue = max(min(draggedAmount, 256f), 0f))
return Card(
modifier = Modifier
@elfefe
elfefe / FractalBrownianMotion.frag
Created November 3, 2021 08:10
Shader generating a fractal brownian motion
// Title: fBM
#ifdef GL_ES
precision highp float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
@elfefe
elfefe / shader.frag
Last active September 1, 2022 08:48
Shader training, an animated gradiant circle at mouse position.
// Author:
// Title:
#ifdef GL_ES
precision highp float;
#endif
#define PI 3.1415926538
uniform vec2 u_resolution;
@elfefe
elfefe / sinusoid.kt
Last active November 2, 2021 10:16
Equations
// Check https://www.desmos.com/ for tests
// speed = inverse length of a period
// (cos((x * speed * PI) + PI) * 0.5) + 0.5
val sinusoid = (((valuef) / 2f) * cos((index / (((index.max) / 2f) / acos(-1f))) + acos(-1f))) +
((valuef) / 2f)
//Parabole
// normal
@elfefe
elfefe / LayerUtils.sh
Created December 5, 2020 09:40
Unity avoid layers with Ray
public static int AvoidLayers(params int[] layers)
{
int mask = (1 << layers[0]);
for(int i = 1;i < layers.Length;i++) {
mask |= (1 << layers[i]);
}
return ~mask;
}