Skip to content

Instantly share code, notes, and snippets.

View lamalex's full-sized avatar

Alex Launi lamalex

View GitHub Profile
pub mod matrix {
use num_traits::Num;
pub struct Matrix<T> {
pub rows: usize,
pub cols: usize,
data: Vec<T>,
}
impl<T> Matrix<T>
where
@lamalex
lamalex / main.rs
Last active July 5, 2020 18:34
The civil war was definitely about slavery.
use regex::Regex;
use std::{env, fs};
use std::collections::HashMap;
fn main() {
let args: Vec<String> = env::args().collect();
let filename = &args[1];
let contents = fs::read_to_string(filename)
.expect("Something went wrong reading the file");
let re = Regex::new(r"\b[a-zA-z]*").unwrap();
@lamalex
lamalex / gist:5690235ab00f414fc6fdfadbce960929
Created October 16, 2020 22:44
Quick function to always print 4 decimal places
def print_precision_4(x: float):
print(f'{x:.4f}')
print_precision_4(123.12345678)
@lamalex
lamalex / lib.rs
Created November 18, 2021 19:24
Call her `bec!` you say?
#[macro_export]
macro_rules! bec {
// `()` indicates that the macro takes no argument.
() => {
"
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxxxkkkkkkkkkkkkkkxkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkxxkkkkkooddkkkkkkkkkkxxlcdkkkkkxkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
@lamalex
lamalex / 8kzenrecover.py
Created September 24, 2023 15:22 — forked from lkraav/8kzenrecover.py
8kzenrecover.py
#!/usr/bin/python
# Copyright 2007 by Tobia Conforto <tobia.conforto@gmail.com>
#
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License