Skip to content

Instantly share code, notes, and snippets.

View suvayu's full-sized avatar

Suvayu Ali suvayu

View GitHub Profile
@suvayu
suvayu / bench-1.md
Created September 20, 2023 21:32
Compare BenchmarkCI.jl formatting
Benchmark result

Judge result

Benchmark Report for /home/runner/work/TulipaEnergyModel.jl/TulipaEnergyModel.jl

Job Properties

  • Time of benchmarks:
    • Target: 13 Sep 2023 - 15:14
  • Baseline: 13 Sep 2023 - 15:15
@suvayu
suvayu / preview
Last active April 8, 2022 16:31
Preview list of files
#!/bin/bash
# License: GPLv2
# set -o xtrace
if [[ -t 0 ]]; then
echo no stdin
exit 1
elif [[ ! -f $(which fzf 2> /dev/null) ]]; then
@suvayu
suvayu / friendly-data-workshop-agenda.md
Created November 15, 2021 16:31
Agenda for the upcoming Friendly data workshop

Introduction - 20 mins

  • What is Friendly data trying to solve?
    • example workflows from 1-1s
  • Show example datasets
    • explain index & value columns
    • note only flat column names are supported

Friendly data - 20 mins

@suvayu
suvayu / attrdict.py
Created December 4, 2020 02:44
A minimal attribute dictionary implementation using `defaultdict`
from collections import defaultdict
class _attrdict(defaultdict):
__getattr__ = defaultdict.__getitem__
__setattr__ = defaultdict.__setitem__
def update(self, other):
super().update(
(k, v) for k, v in other.items() if not issubclass(type(v), dict)
@suvayu
suvayu / types.py
Created March 12, 2020 17:42
Types for numeric types with units and date ranges
from typing import Type
from pydantic import confloat, conint
"""
**kwargs for conint / confloat
strict: bool = False,
gt: float = None,
ge: float = None,
@suvayu
suvayu / test_high_failures.py
Created July 25, 2019 06:25
Hypothesis generates large number of invalid examples
from datetime import datetime, time
import pytest
from hypothesis import given, assume, strategies as st
from hypothesis import settings, Verbosity
_cities = [f"city{i}" for i in range(4)]
_dt = st.shared(
st.datetimes(
@suvayu
suvayu / id-quirks.md
Created May 28, 2019 04:50
Quirks about `id`

Quirks about id

Integers

In [1]: a = 5
In [2]: b = a
In [3]: a is b
Out[3]: True
In [4]: c = 5

In [5]: a is c

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@suvayu
suvayu / test.md
Last active March 19, 2019 09:55
Test Markdown heading achors

Top level heading

Some text

A sub-heading

Some text refering to another heading

Another sub-heading

@suvayu
suvayu / myfuncs.py
Last active February 27, 2019 10:47
Logging to a package's logger
import logging
import dask
logger = logging.getLogger(__name__)
@dask.delayed
def times(arg, mult):
logger.info(f"Multiplying: {arg} * {mult}")
return arg * mult