Skip to content

Instantly share code, notes, and snippets.

View michaelaye's full-sized avatar

Michael Aye michaelaye

View GitHub Profile
@michaelaye
michaelaye / matplotlib_polar_log.py
Created September 11, 2024 14:09
example from claude for log polar plot...
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm # Add this import
# Generate some sample data
np.random.seed(42)
angles = np.random.uniform(0, 2*np.pi, 1000)
radii = np.random.normal(5, 1, 1000)
# Create a polar subplot
@michaelaye
michaelaye / shell.txt
Created November 1, 2022 09:51
Espanso cargo compile error
[1 million of these cargo warnings (more than my terminal cache allows]
cargo:warning= 657 | class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
cargo:warning= | ^~~~~~~~~~
cargo:warning=src/sys/form/form.cpp:315:9: error: invalid use of incomplete type ‘class wxKeyEvent’
cargo:warning= 315 | event.Skip();
cargo:warning= | ^~~~~
cargo:warning=In file included from /usr/include/wx-3.0/wx/wx.h:24,
cargo:warning= from src/sys/form/../common/common.h:27,
cargo:warning= from src/sys/form/form.cpp:22:
cargo:warning=/usr/include/wx-3.0/wx/event.h:657:28: note: forward declaration of ‘class wxKeyEvent’
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@michaelaye
michaelaye / create_env_file.py
Last active September 8, 2022 15:17
Create environment.yml from nbdev settings.ini
from configparser import ConfigParser
import subprocess
config = ConfigParser(delimiters=["="])
config.read("settings.ini")
cfg = config["DEFAULT"]
requirements = cfg.get("requirements", "").split()
with open("environment.yml", "w") as f:
f.write("name: testenv\n")
@michaelaye
michaelaye / conda_env_export.py
Created October 22, 2021 23:28 — forked from michael-ford/conda_env_export.py
Export a Conda environment with --from-history, but also append Pip-installed dependencies
"""
Export a Conda environment with --from-history, but also append
Pip-installed dependencies
Exports only manually-installed dependencies, excluding build versions, but
including Pip-installed dependencies.
Lots of issues requesting this functionality in the Conda issue tracker, no
sign of progress (as of March 2020).
[LabBuildApp] Building in /home/maye/miniconda3/envs/py38/share/jupyter/lab
[LabBuildApp] Node v16.10.0
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Building jupyterlab assets (production, minimized)
[LabBuildApp] > node /home/maye/miniconda3/envs/py38/lib/python3.8/site-packages/jupyterlab/staging/yarn.js install --non-interactive
[LabBuildApp] yarn install v1.21.1
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
@michaelaye
michaelaye / test_nbs.py
Created October 11, 2021 20:33
cloned from Nixtla/mlforecast
# taken from: https://raw.githubusercontent.com/pete88b/decision_tree/master/test_nbs.py
# We need a "test_" file with "test_" functions to make it easy to run with pytest
# couple of example "test_" functions
# import nbdev.test
# def test_run():
# print('running nbdev.test.test_nb("20_models.ipynb") ...')
@michaelaye
michaelaye / remotemd5.py
Created October 7, 2021 02:09 — forked from brianewing/remotemd5.py
Python MD5 of remote file (URL)
import os, hashlib, urllib2, optparse
def get_remote_md5_sum(url, max_file_size=100*1024*1024):
remote = urllib2.urlopen(url)
hash = hashlib.md5()
total_read = 0
while True:
data = remote.read(4096)
total_read += 4096
@michaelaye
michaelaye / my_speedtest.py
Created September 22, 2021 03:02
Adding a timestring to speedtest csv output and add to csv file.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime as dt
from pathlib import Path
from sh import speedtest
fname = Path("multiple_connections_triton.csv")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.