Skip to content

Instantly share code, notes, and snippets.

@18alantom
18alantom / CODE_READABILITY.md
Last active July 29, 2024 12:20
A document on code quality and readability based off of the bad practices I've encounted in the last few weeks.

I often find myself getting frustrated with code—be it code written by me or by others. This, I find, is because that particular code disregards readability.

This frustration of mine often bubbles up in the form of colorfully disparaging commit messages. I decided that it would be more productive to instead type-down what I feel are some decent coding practices.

I've added examples where applicable and tried to explain the why behind the practices.

This document is prone to recency bias. The practices here come to mind because

FC Metrics Report 7th May, 24

Screenshot 2024-05-07 at 10 33 00

Time Period: 2024-04-30 to 2024-05-07
Period Average:  30 per day
Monthly Average: 27 per day

@18alantom
18alantom / fast_zeros.zig
Created October 8, 2023 10:03
Experiments
/// Run using
/// ```bash
/// zig run -O ReleaseFast fast_zeros.zig > /dev/null
/// ```
/// This program writes 0s to std out using a buffer.
/// Time taken, buffer size and number of loops are
/// written to stderr.
///
/// Purpose of this is to roughly check what size of
/// buffer allows for max throughput by measuring the
@18alantom
18alantom / configure_optimizer.py
Last active May 14, 2020 01:07
A set of functions to help update a pytorch optimizer's param groups wrt learning rate and to unlock last n layers of a pytorch model.
# Imports for Annotations
from torch.nn import Module
from torch.optim import Optimizer
from typing import Optional, Union, List
def get_layers(model:Module, rgrad:bool=False):
"""
Returns all layers of the model
that have no children ie will return the
contents of a sequential but not the Sequential