Skip to content

Instantly share code, notes, and snippets.

View breandan's full-sized avatar
📖
I may be slow to respond.

breandan breandan

📖
I may be slow to respond.
View GitHub Profile
@breandan
breandan / synonymRenaming.txt
Last active August 23, 2021 15:19
Random samples of synonym renaming transformation.
fun VecIndex.knn(v: DoubleArray, i: Int, exact: Boolean = false) = | fun VecIndex.knn(v: DoubleArray, i: Int, involve: Boolean = false) =
if(exact) exactKNNSearch(v, i + 10) | if(involve) involveKNNSearch(v, i + 10)
else findNearest(v, i + 10) | else findNearest(v, i + 10)
.filter { !it.item().embedding.contentEquals(v) } | .filter { !it.item().embedding.contentEquals(v) }
.distinctBy { it.item().toString() }.take(i) | .distinctBy { it.item().toString() }.take(i)
============================================================================================================================================
fun VecIndex.exactKNNSearch(vq: DoubleArray, nearestNeighbors: Int) = | fun VecIndex.exactKNNSearch(vq: DoubleArray, nearestEdge: Int) =
asExa
@breandan
breandan / method_slices
Created August 22, 2021 18:20
Method-level chunks using Dyck-slicing.
override fun dimensions(): Int = embedding.size
==============================
override fun toString() = loc.getContext(0)
}
==============================
fun buildOrLoadVecIndex(
indexFile: File = File(DEFAULT_KNNINDEX_FILENAME),
rootDir: URI = DATA_DIR
@breandan
breandan / dokka_failure.log
Created July 13, 2021 17:05
Dokka 1.5.0 build failure.
2021-07-13T02:37:51.0914665Z Found online and idle hosted runner(s) in the current repository's organization account that matches the required labels: 'ubuntu-latest'
2021-07-13T02:37:51.0914742Z Waiting for a hosted runner in 'organization' to pick this job...
2021-07-13T02:37:57.9092609Z Current runner version: '2.278.0'
2021-07-13T02:37:57.9116140Z ##[group]Operating System
2021-07-13T02:37:57.9117017Z Ubuntu
2021-07-13T02:37:57.9117373Z 20.04.2
2021-07-13T02:37:57.9117749Z LTS
2021-07-13T02:37:57.9118148Z ##[endgroup]
2021-07-13T02:37:57.9118632Z ##[group]Virtual Environment
2021-07-13T02:37:57.9119206Z Environment: ubuntu-20.04
@breandan
breandan / .ideavimrc
Last active December 22, 2020 05:13
Mathematical symbol macros for [idea]vim
" To only apply these macros in e.g. Python files, prepend 'autocmd FileType py', e.g.:
" autocmd FileType py inoremap \mu μ
inoremap \alpha α
inoremap \beta β
inoremap \gamma γ
inoremap \delta δ
inoremap \epsilon ε
inoremap \zeta ζ
inoremap \eta η
@breandan
breandan / build.gradle.kts
Created October 29, 2020 17:26
Kotlin∇ consumer Gradle build script.
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.4.10"
}
group = "me.breandan"
version = "1.0-SNAPSHOT"
repositories {
@breandan
breandan / build.gradle.kts
Created September 18, 2020 08:28
Jupyter Notebook tasks
tasks {
val installPathLocal = "${System.getProperty("user.home")}/.jupyter_kotlin/libraries"
val genNotebookJSON by creating(JavaExec::class) {
main = "edu.mcgill.kaliningraph.codegen.NotebookGenKt"
classpath = sourceSets["main"].runtimeClasspath
args = listOf(projectDir.path, project.version.toString())
}
val jupyterInstall by registering(Copy::class) {
class O(val n: Number) : Number() {
operator fun compareTo(i: Number) = n.toDouble().compareTo(i.toDouble()).also { lastComparison = i }
override fun toByte() = n.toByte()
override fun toChar() = n.toChar()
override fun toDouble() = n.toDouble()
override fun toFloat() = n.toFloat()
override fun toInt() = n.toInt()
override fun toLong() = n.toLong()
override fun toShort() = n.toShort()
}
Building nv-usd...
Adjusting /home/breandan/.profile
Adjusting /home/breandan/.bashrc
Creating packman packages repository at /home/breandan/packman-repo
Fetching [email protected]_64.tar.gz from S3 ...
Unpacking python
Fetching [email protected] from S3 ...
Unpacking ...
Processing project file '/home/breandan/packman-repo/packman-common/6.1.3/deps.packman.xml'
Package '7za' at version '16.02.4' is missing from local storage.
@breandan
breandan / NewJDKMembers.kt
Last active May 14, 2020 18:30
Retrieves all new API members in JDK 14 (from JDK 8)
import java.net.URL
fun main() {
val jdk8members = mutableSetOf<String>()
val jdk14members = mutableSetOf<String>()
for (i in 1..27) {
val jdk8URL = "https://docs.oracle.com/javase/8/docs/api/index-files/index-$i.html"
val jdk14URL = "https://download.java.net/java/GA/jdk14/docs/api/index-files/index-$i.html"
val jdk8page = fetchPage(jdk8URL)
@breandan
breandan / jdk14_new_endpoints.txt
Created May 13, 2020 21:48
New endpoints in JDK 14 from JDK 8
com.sun.jarsigner.ContentSigner
com.sun.jarsigner.ContentSignerParameters
com.sun.java.accessibility.util.AccessibilityEventMonitor
com.sun.java.accessibility.util.AccessibilityListenerList
com.sun.java.accessibility.util.AWTEventMonitor
com.sun.java.accessibility.util.EventID
com.sun.java.accessibility.util.EventQueueMonitor
com.sun.java.accessibility.util.GUIInitializedListener
com.sun.java.accessibility.util.SwingEventMonitor
com.sun.java.accessibility.util.TopLevelWindowListener