Skip to content

Instantly share code, notes, and snippets.

View enimiste's full-sized avatar

NOUNI El bachir enimiste

View GitHub Profile
@enimiste
enimiste / Dockerfile
Last active November 26, 2023 10:44
Docker file for run scala dev env (latest java and scala versions)
FROM mcr.microsoft.com/devcontainers/base:jammy
USER vscode
RUN curl -s "https://get.sdkman.io" | bash
RUN chmod +x "$HOME/.sdkman/bin/sdkman-init.sh"
RUN "$HOME/.sdkman/bin/sdkman-init.sh"
# Java Env
@enimiste
enimiste / watch_tests_files.py
Last active November 8, 2023 23:29
Run continuously running test files on changes
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import os
import sys
from os import path
import re
"""
Requirements :
@enimiste
enimiste / game_of_life_console.py
Created November 4, 2023 22:05
Runnable Console Version of Game of Life
# Coderetreat @2023 - Arolla
# vivant + <=1 voisin ----> Meurt
# vivant + >=4 voisins ----> Meurt
# vivant + {2, 3} voisins ----> Conserve son statut
# vide + 3 voisins ----> Survit
# Business
# Il nous a demandé de modéliser la grille :
# - en gardant uniquement les cellules vivantes
# - rille sans bornes
@enimiste
enimiste / test_gameoflife_iter4.py
Created November 4, 2023 16:22
Gameoflife - Coderetreat @2023 - Arolla
# Coderetreat @2023 - Arolla
# Authors : NEB + AMEH
# vivant + <=1 voisin ----> Meurt
# vivant + >=4 voisins ----> Meurt
# vivant + {2, 3} voisins ----> Conserve son statut
# vide + 3 voisins ----> Survit
# Business
NEXT_STATE = {
0: (lambda _ : 0),
@enimiste
enimiste / test_gameoflife_iter5.py
Last active November 4, 2023 20:32
Gameoflife - Coderetreat @2023 - Arolla
# Coderetreat @2023 - Arolla
# Authors : NEB + AMEH
# vivant + <=1 voisin ----> Meurt
# vivant + >=4 voisins ----> Meurt
# vivant + {2, 3} voisins ----> Conserve son statut
# vide + 3 voisins ----> Survit
# Business
# Il nous a demandé de modéliser la grille :
# - en gardant uniquement les cellules vivantes
@enimiste
enimiste / SensorsSolution.java
Created October 23, 2023 12:54
AtCoder.jp problem - Sensors Solution
import java.util.*;
import java.lang.*;
public class Main {
record XY(int x, int y){}
public static void main(final String[] args) throws Exception {
//Variables
int H=0, W=0;
int[][] grid=null;
//Read inputs
@enimiste
enimiste / WorldMeeting_Solution.java
Last active October 23, 2023 11:41
atCoder.jp problem : World Meeting Solution
import java.util.*;
import java.lang.*;
public class Main {
final static int S=9;
final static int E=18;
final static int D=24;
public static void main(final String[] args) throws Exception {
//Variables
//############## Bi-Directional ManyToMany JPA relationship #################################
class UsageCaseOne {
@Entity
class Foo {
@Id
private Long id;
@ManyToMany(mappedBy = "foos")
private Set<Bar> bars = new HashSet<>();
/*SELECT sum(t.tablename, c.column_name) AS total
FROM pg_catalog.pg_tables as t
join information_schema.columns as c on c.table_name=t.tablename and c.data_type='integer'
WHERE schemaname != 'pg_catalog' AND
schemaname != 'information_schema';*/
-- SELECT 0 AS total;
CREATE OR REPLACE FUNCTION pg_catalog.calcTotal ()
RETURNS BIGINT AS $$
@enimiste
enimiste / flowersgame.js
Created October 23, 2019 14:00
Flowers growing game using p5js library
function Flowers(flowers, ww, wh, initH, maxH, maxR) {
this.flowers = flowers;
this.size = flowers.length;
this.right = this.flowers[0];
this.left = this.flowers[this.size - 1];
this.windWidth = ww;
this.windHeight = wh;
this.initHeight = initH;
this.maxHeight = maxH;
this.maxR = maxR;