Skip to content

Instantly share code, notes, and snippets.

View Quentin18's full-sized avatar
🏠
Working from home

Quentin Deschamps Quentin18

🏠
Working from home
View GitHub Profile
@Quentin18
Quentin18 / train_test_split.py
Created March 16, 2022 17:26
Split dataset function for PyTorch
from typing import Optional, Tuple
import torch
from torch.utils.data import Dataset, random_split
def train_test_split(
dataset: Dataset,
test_ratio: float,
seed: Optional[int] = None,
/*
Pascal's triangle
https://en.wikipedia.org/wiki/Pascal%27s_triangle
Quentin Deschamps, 2020
*/
#include <iostream>
using namespace std;
long facto(long n)
@Quentin18
Quentin18 / permutations.cpp
Last active September 9, 2020 13:40
Heap's algorithm
/*
Heap's algorithm
https://en.wikipedia.org/wiki/Heap%27s_algorithm
Quentin Deschamps, 2020
*/
#include <iostream>
using namespace std;
void print(int array[], int size)
@Quentin18
Quentin18 / 21_game.rb
Created August 18, 2020 00:46
21 Game in Ruby
# 21 Game - an example in Ruby for Rosetta Code.
GOAL = 21
MIN_MOVE = 1
MAX_MOVE = 3
DESCRIPTION = "
*** Welcome to the 21 Game! ***
21 is a two player game.
Each player chooses to add 1, 2 or 3 to a running total.