Skip to content

Instantly share code, notes, and snippets.

@bednie
bednie / svec_macro.rs
Last active August 27, 2024 00:07
Rust svec! macro: Ergonomic Vec<String> creation
// Custom macro for easy Vec<String> creation
// Keywords: vec, String, to_string, macro, Rust, convert, collection
// svec! simplifies creating Vecs of Strings from various types
macro_rules! svec {
($($element:expr),* $(,)?) => {
vec![$($element.to_string()),*]
};
}
use std::any::{Any, TypeId};
@bednie
bednie / cnn.h5.svg
Created May 4, 2024 15:41
1D CNN Netron Viz
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bednie
bednie / InceptionResnetV1.tflite.svg
Created May 4, 2024 14:52
InceptionResnetV1 Netron Viz
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bednie
bednie / gist:213d699b84778efaca37beadeb2de187
Created April 17, 2024 15:33
Example conftest.py for Flask app testing
import pytest
from app import create_app
@pytest.fixture()
def app():
app = create_app()
app.config.update({
"TESTING": True,
})
# other setup can go here
@bednie
bednie / pytest.yml
Last active February 19, 2024 18:56
Pytest GitHub Action
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: pytest - Python unit tests
on:
push:
branches: [ "master", "main"]
pull_request:
branches: [ "master", "main" ]
@bednie
bednie / .pre-commit-config.yaml
Last active February 14, 2024 16:47
Ruff pre-commit config
# https://github.com/astral-sh/ruff-pre-commit
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
hooks:
# Run the linter.
- id: ruff
args: [ --fix -v ]
# Run the formatter.
@bednie
bednie / ruff.yml
Last active February 19, 2024 18:55
Use Ruff to check and format with GitHub Actions
name: Ruff - Python Code Quality and Formatting
on: [push, pull_request]
jobs:
lint-and-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}