Skip to content

Instantly share code, notes, and snippets.

View perillo's full-sized avatar

Manlio Perillo perillo

  • Avellino, Italy
View GitHub Profile
@perillo
perillo / Workout.zig
Last active May 14, 2026 12:54
Schema for a Zon document
//! Implements a schema for an indoor cycling workout.
const Workout = @This();
pub const max_file_size = 2 * 4096;
const SingleStep = struct {
name: []const u8,
/// The mode used for the single step.
mode: Mode = .target_power,
note: ?[]const u8 = null,
@perillo
perillo / example.yml
Created August 10, 2025 14:21
workout file
workout:
name: aerobic-threshold
defaults:
mode: target-power
steps:
- name: "warm-up"
power: [100, 160]
cadence: [0, 95]
duration-minutes: 10
@perillo
perillo / config
Created November 13, 2024 11:15
sway bug report
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
#!/bin/sh
set -euo pipefail
# Build kcov
scripts/make.sh
printf "\n\n"
# Build tests
mkdir -p build-tests
cd build-tests
@perillo
perillo / distribution_specification.py
Last active December 8, 2023 17:21
Detect the Python distribution specification/format
def _get_dist_spec(dist):
"""Returns the specification used by the distribution.
The result is "dist-info", "egg-info", "egg" or "distutils-legacy".
"""
def is_dir():
return dist.path is not None and os.path.isdir(dist.path)
def is_file():
#!/usr/bin/env python
from math import nan
import sys
from garmin_fit_sdk import Decoder, Stream
import numpy as np
from numpy.lib.stride_tricks import sliding_window_view
def load(path):
def read_fit_header(path):
"""read_fit_header returns the FIT file header.
The FIT SDK has the `Decoder.read_file_header` method, but it cannot be
used because a local object can not be pickled and only the major version
is used, for both protocol_version and profile_version.
"""
stream = Stream.from_file(path)
header = {}
#!/bin/sh
if [ ! -d exercises ]; then
echo "Must be run from the project root directory."
exit 1
fi
build() {
zig build -Dhealed -Dhealed-path=patches/tmp -Dn="$1"
zig_ret=$?
const std = @import("std");
const root = @import("../build.zig");
const debug = std.debug;
const fmt = std.fmt;
const fs = std.fs;
const mem = std.mem;
const Allocator = std.mem.Allocator;
const Build = std.build;

Build file

const std = @import("std");
const tests = @import("tests-tmp.zig");

pub fn build(b: *std.Build) void {
    const test_step = b.step("test", "Run unit tests");
    test_step.dependOn(tests.addCliTests(b));
}