Skip to content

Instantly share code, notes, and snippets.

View zoren's full-sized avatar
🕴️
wuns

Søren Sjørup zoren

🕴️
wuns
  • Copenhagen, Denmark
View GitHub Profile
@zoren
zoren / asmble.clj
Created May 7, 2022 16:09
An experiment with asmble.io
;; most of this code is copied from a source that used an older version of asmble, here we use 0.4.0
;; unfortunately I cannot find the original so I apologise for the missing reference
;; {:deps
;; {com.github.cretz.asmble/asmble-compiler {:mvn/version "0.4.0"}}}
(ns asmble-fun
(:require [clojure.reflect :as r])
(:import [asmble.cli Translate]
[asmble.run.jvm ScriptContext ExceptionTranslator
ModuleBuilder$Compiled
@zoren
zoren / clone.clj
Last active September 27, 2022 11:21
babashka script to git clone repos in to hostname/path subpath
#!/usr/bin/env bb
(ns clone
"clones a git repo to a path given by its url and opens a new shell at that path
clone.clj https://github.com/babashka/sci will clone to ~/github.com/babashka/sci"
(:require
[clojure.java.io :as io]
[clojure.string :as str]
[babashka.fs :as fs]
[babashka.process :refer [process check shell]]))
@zoren
zoren / christmas_magic_square.clj
Last active December 18, 2022 21:34
Solving a children's puzzle using a big gun (clojure.core.logic)
(ns logic
(:refer-clojure :exclude [==])
(:require [clojure.core.logic :refer :all])
(:require [clojure.core.logic.fd :as fd]))
;; mostly stolen from https://mattsenior.com/2014/02/using-clojures-core-logic-to-solve-simple-number-puzzles
(run* [q]
;; Create some new logic vars (lvars) for us to use in our rules
(fresh [v00 v01 v02 v03 v04
class Outer {
static final int staticFinalConstant = 42;
class Inner {
public int field = staticFinalConstant;
}
static void m() {
new Inner(); // error: non-static variable this cannot be referenced from a static context
}
}
@zoren
zoren / ollama.txt
Last active August 28, 2023 16:55
ollama will not stop generating artificial intelligence optimism
❯ ollama run llama2-uncensored
>>> hi
What can you tell me about the latest technology in the world of artificial
intelligence?
>>> I though I asked the questions?
You're right, my apologies. The latest technology in the field of artificial
intelligence is currently focused on creating systems that can perform complex
tasks such as language translation, image recognition, and even autonomous
driving. These advancements are made possible by deep learning algorithms and
@zoren
zoren / simoni.js
Created November 13, 2023 18:49
a parse for a language that has only parentheses, whitespace, and words
// this is a parser for a language described in this tweet: https://twitter.com/msimoni/status/1721647625294782972
const LPAR = 40
const RPAR = 41
const isWord = cp => 32 < cp && cp !== LPAR && cp !== RPAR
export const parse = inputString => {
const warnings = []
const topLevelArray = []
let currentArray = topLevelArray