Skip to content

Instantly share code, notes, and snippets.

View mcourteaux's full-sized avatar

Martijn Courteaux mcourteaux

View GitHub Profile
@mcourteaux
mcourteaux / sane_chunking.py
Created April 25, 2022 10:00
Starting point for chunking algorithm to replace TS Flex chunking.
import pandas as pd
import numpy as np
from typing import Dict, List, Union, Tuple, Optional
df1 = pd.read_parquet("smartphone_acceleration.parquet")
df2 = pd.read_parquet("wearable_acceleration.parquet")
df1.set_index("timestamp", inplace=True)
df2.set_index("timestamp", inplace=True)
df1.rename(columns={str(x) : str(x) + "_A" for x in df1.columns}, inplace=True)
df2.rename(columns={str(x) : str(x) + "_B" for x in df2.columns}, inplace=True)
#!/bin/bash
if [ -e /usr/local/bin/youtube-dl ]; then
echo "Already installed"
else
#sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
#sudo chmod a+rx /usr/local/bin/youtube-dl
sudo pip3 install --upgrade youtube_dl
fi
@mcourteaux
mcourteaux / remap_fr_apple_keyboard_virtualbox.sh
Created April 5, 2018 10:55
Switches the < > key with the @ # key for a French/Flemish Macbook Pro keyboard layout on Ubuntu running in VirtualBox.
#!/bin/bash
xmodmap -e "keycode 94 = at numbersign"
xmodmap -e "keycode 49 = less greater"
include(CMakeParseArguments)
function(halide_use_image_io TARGET)
target_include_directories(${TARGET} PRIVATE "${HALIDE_ROOT_DIR}/tools")
foreach(PKG PNG JPEG)
# It's OK to call find_package() for the same package multiple times.
find_package(${PKG} QUIET)
if(${PKG}_FOUND)
target_compile_definitions(${TARGET} PRIVATE ${${PKG}_DEFINITIONS})
target_include_directories(${TARGET} PRIVATE ${${PKG}_INCLUDE_DIRS})
@mcourteaux
mcourteaux / chooser.rs
Created December 16, 2016 10:26
Cycles - Gerwin Dox
use std::collections::HashSet;
use std::iter::FromIterator;
pub fn reduce(cycles : &Vec<Vec<usize>>, node_size : usize) -> Vec<usize> {
let mut set : Vec<HashSet<usize>> = cycles.iter().map(|v| HashSet::from_iter(v.iter().map(|&a| a))).collect();
let mut importance : Vec<usize> = set.iter().map(|v| v.len()).collect();
let mut counter = node_size;
let mut res = Vec::new();
while counter > 0 {
let max_index = importance.iter().enumerate().map(|(n, &s)| (s, n)).max().unwrap().1;
@mcourteaux
mcourteaux / disco.cpp
Created November 5, 2016 21:22
MacBook Pro 8,1 Disco Lights
#include <chrono>
#include <cmath>
#include <fstream>
#include <iostream>
#include <string>
#include <thread>
#include <vector>
struct light_dev {
virtual void set_brighness(float fraction) = 0;