Skip to content

Instantly share code, notes, and snippets.

View guidorice's full-sized avatar

Alex G Rice guidorice

View GitHub Profile
@guidorice
guidorice / try_auto_paramaterization.mojo
Last active December 9, 2023 16:47
parameter deduction in mojo (0.6) without traits
@value
struct Wrappee[dtype: DType = DType.float16]:
"""
Stores an int as a SIMD value.
Defaults to float16.
"""
var value: SIMD[dtype]
fn __init__(inout self, x: Int):
self.value = x
@guidorice
guidorice / try_auto_paramaterization.mojo
Last active December 9, 2023 16:28
try mojo auto-parameterization (mojo 0.6)
trait Wrappable:
"""
A nonsensical trait- which can be initialized with an int, or copied.
"""
fn __init__(inout self, x: Int):
...
fn __copyinit__(inout self, existing: Self):
...
@value
@guidorice
guidorice / mojo_python_overhead.mojo
Created December 4, 2023 02:52
mojo <-> python overhead?
from benchmark import run
from python import Python
fn main():
@parameter
fn try_import():
try:
_ = Python.import_module("numpy")
except:
@guidorice
guidorice / test.yaml
Created November 19, 2023 22:44
github action for mojo + conda
name: Run Tests
on:
pull_request:
types: [opened, reopened]
push:
branches:
- 'main'
@guidorice
guidorice / flush-dns-cache.sh
Last active September 15, 2023 16:28
macos 10+ flush DNS cache
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
@guidorice
guidorice / comments.js
Last active September 15, 2023 15:14
mojo .vscode/launch.json
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
# This example demonstrates the ability to pass artifacts
# from one step to the next.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: artifact-passing-
annotations:
workflows.argoproj.io/description: |
guidorice testing
spec:
@guidorice
guidorice / Tensor_plotting.md
Last active August 6, 2023 00:24
Mojo Tensor + plotting
from DType import DType
from Tensor import Tensor, TensorShape
from List import VariadicList
from Random import rand

alias height = 256
alias width = 256
alias channels = 3
@guidorice
guidorice / graphql-upload-example.sh
Created February 5, 2023 11:03
graphql-upload-example
# curl -v http://dev.mlhub.earth:8080/gql \
curl -v http://dev.mlhub.earth:3000/api/gql \
-F operations='{ "query": "mutation ($file: Upload!) { upload_dataset_ingest_file( input: { dataset_id: \"guidorice_dataset1\", ingest_filetype: pdf }, blob: $file) { error size message } } ", "variables": { "file": null } }' \
-F map='{ "0": ["variables.file"] }' \
-F 0=@test.pdf