Skip to content

Instantly share code, notes, and snippets.

View kazimuth's full-sized avatar
🕷️
numbers aren't real

james gilles kazimuth

🕷️
numbers aren't real
  • Detroit, MI
View GitHub Profile
@kazimuth
kazimuth / bitotal_relations.rs
Last active November 10, 2023 06:16
Counting nonsense
use std::collections::HashMap;
fn main() {
println!("Counting bitotal relations R: 1..n |<>| 1..m");
println!("i.e. id <= R ; R^T and id <= R^T ; R");
println!("(see: https://en.wikipedia.org/wiki/Relation_algebra, book: Algebra of Programming by Bird and Moore)");
println!();
println!("Equivalently, counting bipartite graphs between node sets of size n and m,");
println!("where every vertex has degree at least 1.");
println!();
@kazimuth
kazimuth / rename_music.py
Created August 12, 2012 22:26
Python script to rename your music files!
#James Gilles, 2012
#DWTFYWWI License
from mutagen.easyid3 import EasyID3
import os
print "input directory for processing: "
path = raw_input()
os.chdir(path)
@kazimuth
kazimuth / mathbox.d.ts
Last active May 7, 2021 09:00
MathBox 2 Typescript type declaration file
/** MathBox type declarations (autogenerated) */
/** Matrix width */
declare interface MBArea {
/** Use (fast) integer lookups */
aligned?: boolean;
/** Axis pair */
axes?: number[];
/** Matrix buffer height */
bufferHeight?: number;
using Plots, ForwardDiff, StaticArrays, Distributions, Test
g(x) = sin.(x)
function newton(g, x0, n=10)
out = zeros(length(x0), n)
x = x0
for i in 1:n
out[:, i] = x
dg = ForwardDiff.jacobian(g, x)
@kazimuth
kazimuth / test.swift
Last active September 29, 2019 20:54
import Glibc
setenv("SWIFT_TENSORFLOW_ENABLE_DEBUG_LOGGING", "true", 1)
let s = "grpc://\(String(cString: getenv("COLAB_TPU_ADDR")!))"
setenv("SWIFT_TENSORFLOW_SERVER_ADDRESS", s, 1)
print("SWIFT_TENSORFLOW_SERVER_ADDRESS:", String(cString: getenv("SWIFT_TENSORFLOW_SERVER_ADDRESS")!))
import TensorFlow
func runTestComputation() -> Tensor<Float> {
// Create two 1000x1000 tensors sampled from a random normal distribution.
@kazimuth
kazimuth / lgconfig.sh
Last active May 25, 2019 07:48
git lg
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@kazimuth
kazimuth / persist.py
Created May 8, 2019 05:08
filesystem persistence for python science stuff
from typing import Any, Union
import hashlib
import pandas
import numpy as np
import json
import os
from pathlib import Path
def _load_json(path: Path):
return json.load(path.open('r'))
@kazimuth
kazimuth / all-tvm-packedfuncs.txt
Created April 9, 2019 05:06
all the tvm packedfuncs and their types (if given), bc4285ddbede86a59c2d88befcacb67d041e0f76
Range: UNKNOWN
_Array: UNKNOWN
_ArrayGetItem: UNKNOWN
_ArraySize: UNKNOWN
_AttrsListFieldInfo: UNKNOWN
_BijectiveLayout: tvm::BijectiveLayout(tvm::Layout, tvm::Layout, )
_BijectiveLayout: tvm::BijectiveLayout(tvm::Layout, tvm::Layout, )
_BijectiveLayoutBackwardIndex: tvm::Array<HalideIR::Expr, void>(tvm::BijectiveLayout, tvm::Array<HalideIR::Expr, void>, )
_BijectiveLayoutBackwardIndex: tvm::Array<HalideIR::Expr, void>(tvm::BijectiveLayout, tvm::Array<HalideIR::Expr, void>, )
_BijectiveLayoutBackwardShape: tvm::Array<HalideIR::Expr, void>(tvm::BijectiveLayout, tvm::Array<HalideIR::Expr, void>, )
same oh
big oh
hat oh
worm oh
mood oh
oh same
big same
hat same
worm same
mood same
@kazimuth
kazimuth / system_macro.rs
Last active May 22, 2018 08:51
System impl macro for specs
use specs::System;
// Tired of writing out a bunch of giant tuples by hand?
// I have the macro for you!
struct BananaSystem;
system! {
BananaSystem;