Skip to content

Instantly share code, notes, and snippets.

View imerghichi's full-sized avatar
:electron:
Focusing

Imane Merghichi imerghichi

:electron:
Focusing
View GitHub Profile
@imerghichi
imerghichi / kardashian_index.ipynb
Created September 13, 2024 15:41
Kardashian_index.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imerghichi
imerghichi / Codec.java
Last active June 23, 2023 15:36
Encode and Decode TinyURL from leetCode problem: https://leetcode.com/problems/encode-and-decode-tinyurl/
public class Codec {
HashMap<String, String> mapping = new HashMap<>();
String letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
String baseUrl = "http://tinyurl.com/";
int lengthSuffix = 8;
public String encode(String longUrl) {
String res;
do {
StringBuilder sb = new StringBuilder(lengthSuffix);
for (int i = 0; i < lengthSuffix; i++) {
@imerghichi
imerghichi / Shamirs secret sharing.ipynb
Last active April 6, 2023 14:44
Shamir secret sharing.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imerghichi
imerghichi / mc-walk-viz.ipynb
Last active January 5, 2023 16:52
Monte carlo walk simulation visualisation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imerghichi
imerghichi / converter.py
Created January 5, 2023 16:01
RDF/XML to JSON converter
import rdflib
import json
def owl_to_json(owl_file):
g = rdflib.Graph()
result = g.parse(owl_file, format="application/rdf+xml")
json_str = json.dumps(result.serialize(format='json-ld'))
return json.loads(json_str)
@imerghichi
imerghichi / index.pug
Created June 30, 2022 19:51
mouse parallax demo
#parallax
.layer(data-depth="0.6")
.some-space
h1 TARIK 7AZEQ
.layer(data-depth="0.4")
#particles-js
class RomanNumbersIntoInteger {
public int romanToInt(String s) {
Map<Character,Integer> romanMap = new HashMap<>();
romanMap.put('I',1);
romanMap.put('V',5);
romanMap.put('X',10);
romanMap.put('L',50);
romanMap.put('C',100);
romanMap.put('D',500);
romanMap.put('M',1000);
@imerghichi
imerghichi / exploring-ibmq-with-qiskit.ipynb
Created December 24, 2020 16:39
Exploring IBMQ with Qiskit.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imerghichi
imerghichi / joget.sh
Created December 23, 2020 01:04
A script to install Joget Community Edition on Linux (Works on Ubuntu and Debian)
sudo apt-get update
sudo apt-get install default-jre
sudo apt-get install mysql-server
sudo service mysql start
mkdir joget
cd joget
wget -O joget.tar.gz http://sourceforge.net/projects/jogetworkflow/files/joget-linux-7.0.12.tar.gz/download
tar xvfz joget.tar.gz -C
cd joget-linux-7.0.12
./tomcat8.sh start
@imerghichi
imerghichi / AST.c
Last active February 19, 2020 22:40
Generation d'une expression aleatoire pour les asts
#include "ast.h"
#include "tablesymb.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
AST generation_rand_expression(int maxd, methode m){
if (maxd==0 || (m=grow && rand()<0.5)) {
int choix = (int*)(rand()* 4)+1;
switch (choix){