Skip to content

Instantly share code, notes, and snippets.

View jamesdavidson's full-sized avatar

James Davidson jamesdavidson

View GitHub Profile
# apache-tvm==0.14.dev273
# numpy==1.26.4
# pytest==8.3.5
from __future__ import absolute_import, print_function
import tvm
import tvm.testing
from tvm import te
import numpy as np
@jamesdavidson
jamesdavidson / Program.cs
Created April 16, 2025 00:24
ClojureJVM repl inside .NET via IKVM
using java.net; // yes this is weird, it is IKVM magic
var homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
var workDir = Environment.CurrentDirectory;
var urls = new URL[] {
new URL($"file:{homeDir}/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar"),
new URL($"file:{homeDir}/.m2/repository/org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar"),
new URL($"file:{homeDir}/.m2/repository/org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar"),
};
@jamesdavidson
jamesdavidson / Program.cs
Created March 4, 2025 06:44
datomic-pro-0.9.6045 running on .net8 via IKVM
using java.net; // yes this is weird, it is IKVM magic
var homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
var workDir = Environment.CurrentDirectory;
var urls = new URL[] {
new URL($"file:{homeDir}/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar"),
new URL($"file:{homeDir}/.m2/repository/org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar"),
new URL($"file:{homeDir}/.m2/repository/org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar"),
@jamesdavidson
jamesdavidson / proj.cljr
Last active November 8, 2024 06:48
Using PROJ from ClojureCLR on .NET 8 for fun and profit (at your own risk, no implied warranty etc)
;; Using proj from ClojureCLR on .NET 8 for fun and profit (at your own risk, no implied warranty etc)
;;
;; Inspired by https://ericsink.com/entries/native_library.html
;; Tested on Ubuntu 22.04 with libproj-dev 8.2.1
;
;<Project Sdk="Microsoft.NET.Sdk">
; <PropertyGroup>
; <OutputType>Exe</OutputType>
; <TargetFramework>net8.0</TargetFramework>
; <ImplicitUsings>enable</ImplicitUsings>
@jamesdavidson
jamesdavidson / get_from_s3.cljr
Created August 9, 2024 04:07
Playing around with making API calls to Amazon S3 from Clojure CLR using the AwsSignatureVersion4 library from Nuget
;; <PackageReference Include="AwsSignatureVersion4" Version="4.0.1" />
(ns get_from_s3
(:import [Amazon.Runtime EnvironmentVariablesAWSCredentials SessionAWSCredentials]
[System.Net.Http HttpClient GetAsyncExtensions HttpCompletionOption]
[System Uri])
;(:use clojure.pprint clojure.repl clojure.reflect)
(:require [clojure.clr.io :as io]))
;(assembly-load "AWSSDK.Core")
;(assembly-load "AwsSignatureVersion4")
@jamesdavidson
jamesdavidson / gzipper.clj
Last active May 29, 2024 02:47
gzipper.clj
;; clj -Sdeps '{:deps {org.clojure/data.csv {:mvn/version "1.1.0"} org.clojure/data.json {:mvn/version "2.5.0"}}}' --main gzipper
(ns gzipper
(:require [clojure.java.io :as io]
[clojure.walk :as walk]
[clojure.string :as string]
[clojure.data.json :as json]
[clojure.data.csv :as csv])
(:import [java.net InetSocketAddress HttpURLConnection]
[java.util.zip GZIPOutputStream]
@jamesdavidson
jamesdavidson / dummy.tf
Created March 27, 2024 10:21
Self signed cert and private key for development and local testing
terraform {
required_providers {
tls = {
version = "4.0.5"
}
local = {
version = "2.5.1"
}
}
}
@jamesdavidson
jamesdavidson / client-vtund.conf
Last active April 11, 2024 08:44
setup for vtun
options {
port 5000; # Connect to this port.
timeout 60; # General timeout
# Path to various programs
ppp /usr/sbin/pppd;
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/ipchains;
ip /sbin/ip;
@jamesdavidson
jamesdavidson / Program.cs
Created December 19, 2023 04:02
nREPL with clojure CLR on dotnet 7
using clojure.lang;
using System.Reflection;
// start up Clojure runtime including compiler
RT.Init();
// make .cljr file resources available from DLL
Assembly.Load("clojure.tools.nrepl");
Assembly.Load("clojure.tools.reader");
@jamesdavidson
jamesdavidson / Program.cs
Last active May 27, 2024 07:17
Alternative to getting started for Clojure CLR with a socket REPL and sending a SigV4 signed request using an extension method
// dotnet --version
// 7.0.100
// dotnet restore
// dotnet run
// rlwrap nc localhost 5555
using System;
using System.IO;
using System.Net;
using System.Net.Http;