Skip to content

Instantly share code, notes, and snippets.

View guidorice's full-sized avatar

Alex G Rice guidorice

View GitHub Profile
@guidorice
guidorice / alpine-linux-notes.md
Created February 14, 2025 15:48
Alpine linux- not worth the risk

When using Alpine linux on a server or Alpine-based container deployment, what are some well known bugs or gotchas? Include one section for MUSL libc issues, and a section for other. I am aware of the DNS issue on Kubernetes, so include that one in the MUSL section.

MUSL libc Issues:

  • DNS resolution failures in Kubernetes due to MUSL's resolver not supporting search domains properly. Workaround: Use CoreDNS or external DNS servers
  • No support for NSS modules, affecting LDAP/NIS authentication
  • Incomplete locale support causing string sorting/comparison issues
  • Limited threading model can impact high-concurrency applications
  • Some compiled binaries may fail due to glibc dependencies
  • No support for dlopen() on static binaries
@guidorice
guidorice / postgres-run-docker.sh
Last active January 16, 2025 17:06
Start Postgres + PostGIS in a docker container
#!/usr/bin/bash
# docker image names and version tags are here: https://github.com/postgis/docker-postgis
# remember: set password and home directory
mkdir -p ~/pgdata
docker run --detach \
--name postgres-dev \
-p 5432:5432 \
@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