Skip to content

Instantly share code, notes, and snippets.

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

Gabriel St-Pierre-Lemieux Spationaute

🏠
Working from home
View GitHub Profile
@Spationaute
Spationaute / MultiSHA.kt
Created October 28, 2021 15:31
Parallel sha256 checksum with kotlin
import java.io.File
import java.security.MessageDigest
import kotlinx.coroutines.*
val digester = MessageDigest.getInstance("SHA-256")
suspend fun check(file_path: String, checksum_in: String) = withContext(Dispatchers.Default){
val target_file = File(file_path)
if(target_file.isFile){
@Spationaute
Spationaute / covid-plot-data-from-jhu.py
Created April 23, 2020 14:22
Small script to plot data from the Johns Hopkins CSSE github
#/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
import pandas as ps
import itertools as it
plt.ion()
data = ps.read_csv('time_series_covid19_confirmed_global.csv',parse_dates=True)
data_death = ps.read_csv('time_series_covid19_deaths_global.csv',parse_dates=True)
data_healt = ps.read_csv('time_series_covid19_recovered_global.csv',parse_dates=True)
@Spationaute
Spationaute / Linear-Regression
Last active August 13, 2019 17:05
Mathematic with Matlab
function rFunction = regress( x, y, power )
%REGRESS Fait la régression à la puissance power d'une série de points x,y
% Préparer la matrice
for i=0:power
for j=0:power
exposant=(2*power-i)-j;
matriceA(i+1,j+1)=sum(x.^exposant)
end
matriceR(i+1)=sum(y.*x.^(power-i))
@Spationaute
Spationaute / Kelvin and Weaire–Phelan structure
Created August 13, 2019 16:41
Kelvin et Weaire-Phelon Polygon on python.
#!/usr/bin/python3
"""
Kelvins truncated Thetrahedron and Weare-Phelan polyhedron.
"""
import numpy as np
import itertools as it
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from mpl_toolkits import mplot3d
@Spationaute
Spationaute / cesar.hs
Created March 6, 2018 14:09
Haskell Fun Cesar Cypher
-- import Data.List
import Data.Char
import Data.Maybe
import System.Environment
-- import System.IO
import Control.Monad
import Text.Read
-- Evaluate if a value is between two other
between :: (Ord a) => a -> a -> a -> Bool
@Spationaute
Spationaute / vernam.c
Created March 1, 2018 14:36
Simple Vernam Encryption C Snippet
/** Algorithme de cryptage Vernam
*** Grabriel Lemieux
***
**/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@Spationaute
Spationaute / BowlingBall.py
Last active March 1, 2018 14:39
Pythons snippets computing the time needed for a bowling ball to reach the bottom of the mariana trench (XKCD)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
#Fonction donnat la friction pour un reynolds donné
re_friction = lambda x:(np.sqrt(24/x)+0.5406)**2
#Fonction trouvant la vélocité d'une bulle de diamètre X dans