Skip to content

Instantly share code, notes, and snippets.

View quoll's full-sized avatar
💭
Back to Asami

Paula Gearon quoll

💭
Back to Asami
View GitHub Profile
@quoll
quoll / error.cljs
Created August 24, 2022 16:01
Error->map function for ClojureScript
(ns error.core)
(defn name-of
"Identifies the name of an error object, the configured name of a type, or just the object type name"
[o]
(or (.-name o)
(let [t (type o)
type-name (.-name t)]
(if (seq type-name)
type-name
@quoll
quoll / count-plan
Created August 9, 2022 19:35
Query plan for count based intersection
# select ?s ?inter
# from <tag:stardog:api:context:default>
# from :entailed
# WHERE
# { { SELECT ?inter (COUNT(DISTINCT ?c) AS ?inter_cnt)
# WHERE
# { ?inter owl:intersectionOf/rdf:rest*/rdf:first ?c }
# GROUP BY ?inter
# }
# { SELECT ?s ?inter (COUNT(DISTINCT ?c) AS ?instance_cnt)
@quoll
quoll / intersection.rq
Created August 9, 2022 13:47
An inefficient approach to identifying intersection membership
construct { ?x a ?i }
where { ?i owl:intersectionOf ?l .
?l rdf:rest*/rdf:first ?c .
?x a ?c
MINUS {
?l rdf:rest*/rdf:first ?d .
?l rdf:rest*/rdf:first ?d2 .
FILTER ( ?d != ?d2 )
?x a ?d MINUS { ?x a ?d2 }
} }
(require '[clojure.string :as string])
(defn f
[n]
(let [s (str n)]
(js/parseFloat
(if-let [[[_ a b]] (re-seq #"(\d*)\.(\d*)" (if (string/starts-with? s "0") (subs s 1) s))]
(let [al (- (count a) 3)]
(if (> al 0)
(str (subs a 0 al) "." (subs a al) b)
string_heap() {
pid=$1
range=`grep heap /proc/${pid}/maps | cut -d' ' -f1`
dd status=none if=/proc/${pid}/mem ibs=4096 skip=$((16#${range/-*/}/4096)) count=$(((16#${range/*-/}-16#${range/-*/})/4096)) | strings
}
assert = require('assert');
const LEFT = -1;
const RIGHT = 1;
function other(side) {
return side == LEFT ? RIGHT : LEFT;
}
class Node {
package avl;
import java.io.File;
import java.io.Closeable;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.List;
@quoll
quoll / keybase.md
Created December 2, 2019 04:05
keybase.md

Keybase proof

I hereby claim:

  • I am quoll on github.
  • I am quoll (https://keybase.io/quoll) on keybase.
  • I have a public key ASDVtiTLdMZvRPQL4frKicNVRHjKf9rdGuo2h2skISu31wo

To claim this, I am signing this object:

package tree;
import java.io.File;
import java.io.Closeable;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
@quoll
quoll / BufferList.java
Created August 22, 2019 05:57
Linked Lists on Mapped File Buffers
package mapped;
import java.io.File;
import java.io.Closeable;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;