Skip to content

Instantly share code, notes, and snippets.

View VBaratham's full-sized avatar

Vyassa Baratham VBaratham

  • United States
View GitHub Profile
@VBaratham
VBaratham / idetik-formatted.css
Created February 18, 2026 17:31
@idetik/react-prerelease@5.0.0 CSS - formatted for readability (overrides SDS accent colors to blue)
@media (prefers-color-scheme: light){:root {
--sds-border-accent-default: 1px solid #1a6cef;
--sds-border-accent-focused: 1px solid #1a6cef;
--sds-border-accent-hover: 1px solid #0041b9;
--sds-border-accent-open: 1px solid #1a6cef;
--sds-border-accent-pressed: 1px solid #002d90;
--sds-border-accent-selected: 1px solid #1a6cef;
--sds-border-base-default: 1px solid #969696;
--sds-border-base-disabled: 1px solid #c3c3c3;
@VBaratham
VBaratham / findgrep.sh
Created March 14, 2019 23:02
Find and grep files by name
#!/bin/bash
set -e
# find files matching a given expression,
# execute grep on them for a given string,
# print matches and filenames
if [ $# -eq 2 ]; then
FILEPATTERN="$1"
SEARCH="$2"
@VBaratham
VBaratham / AllGatherv_unknown_shape.py
Created March 14, 2019 22:32
AllGatherv for arrays of unknown shape
def AllGatherv_unknown_shape(data, comm, rank, n_threads, mpi_dtype, axis=1):
"""
Use MPI to compute shape of result array by asking every thread for their chunk's shape,
then perform the AllGatherv operation (concatenating along the given axis) and return the result.
"""
if axis != 1:
data = np.swapaxes(data, axis, 1)
# Require row-major order for concatenation along axis 0
@VBaratham
VBaratham / broadcast_from_zero.py
Last active March 15, 2019 03:07
Decorate a function to run on one rank and broadcast the result
# Return a decorator that runs the function only if rank == 0,
# otherwise waits for a broadcast from rank 0
def broadcast_from_zero(rank, comm, root=0):
def decorator(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
if comm is None:
return func(*args, **kwargs)