Skip to content

Instantly share code, notes, and snippets.

View alberto-santini's full-sized avatar
👨‍🏫
Teaching semester. Expect delays in answers!

Alberto Santini alberto-santini

👨‍🏫
Teaching semester. Expect delays in answers!
View GitHub Profile
@alberto-santini
alberto-santini / column_transformer_twice.py
Last active February 18, 2022 09:59
Error when using ColumnTransformer twice
from sklearn.datasets import fetch_openml
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.compose import ColumnTransformer, make_column_selector
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder, FunctionTransformer
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.model_selection import train_test_split
from mlxtend.regressor import StackingRegressor
@alberto-santini
alberto-santini / arch-install-notes.md
Last active May 27, 2020 12:53
Notes for next time I install arch

Download and burn the Arch ISO

I get the ISO, which is about 530MB large, and burn it on the USB key.

$ lsblk
NAME                MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                   8:0    1   3.8G  0 disk  
└─sda1                8:1    1   3.8G  0 part  
@alberto-santini
alberto-santini / client.cpp
Created April 21, 2019 14:51
Send work to a server via a pipe, and get the result again via a pipe
#include <ext/stdio_filebuf.h> // For stdio_filebuf
#include <unistd.h> // For pipe, close
#include <cstdlib> // For _Exit
#include <memory> // For unique_ptr
#include <sys/types.h> // For pid_t
#include <sys/wait.h> // For waitpid
#include <stdio.h> // For perror
#include <iostream>
#include <cassert>
#include <string>
@alberto-santini
alberto-santini / local-minima-and-maxima.py
Created November 25, 2018 21:06
Detect local minima and maxima in a Python list
def flatten(a):
return sum(a, [])
def local_minima(a):
if len(a) < 2:
return list(range(len(a)))
lmin = True
curr = list()
local_minima = list()
#include <iostream>
#include <string>
#include <typeinfo>
#include <cxxabi.h>
std::string classname(const std::type_info& ti) {
int status;
return abi::__cxa_demangle(ti.name(), 0, 0, &status);
}
@alberto-santini
alberto-santini / accumulate-sequential-vs-parallel.cpp
Last active December 12, 2021 14:12
Sequential vs parallel accumulate
#include <algorithm>
#include <chrono>
#include <functional>
#include <future>
#include <iomanip>
#include <iostream>
#include <random>
#include "pcg_random.hpp" // Random number generator