Skip to content

Instantly share code, notes, and snippets.

View almibe's full-sized avatar
😺

Alex Michael Berry almibe

😺
View GitHub Profile

Older Model

enum Value = Id | Int | String | Bytes
Statement = (Id, Id, Value)
Ligature = Map[DatasetName, Set[Statement]]

Graph-like Model

@almibe
almibe / progress-pride.gpl
Last active May 30, 2023 00:08
A GIMP palette file for the colors of the Progress Pride flag - Public Domain
GIMP Palette
Name: Progress Pride Flag
#
228 3 3 #E40303 Red
255 140 0 #FF8C00 Orange
255 237 0 #FFED00 Yellow
0 128 38 #008026 Green
36 64 142 #24408E Indigo
115 41 130 #732982 Violet
255 255 255 #FFFFFF While
@almibe
almibe / wasm-pack-with-vite.md
Last active November 27, 2022 15:51
Notes for getting wasm-pack and vite working well together
  • I'm only interested in using the output of wasm-pack after it has been deployed to npm (or used locally as an npm dep).
  • I ended up using vite-plugin-wasm-pack, I also tried vite-plugin-wasm but ran into issues.
  • Make sure you build your wasm-pack project with wasm-pack build --target web
  • Make sure that all the names used to build and deploy your project are the same (at first I was building x-wasm and then naming the npm dep x switching to x-wasm worked).
  • In the package.json for the generated wasm-pack output you'll need to add "type": "module" and "main": x_wasm.js.
    • 📝 TODO I need to look into how to do this automatically.
  • In vite.config.js add the following plugin wasmPack([], ['x-wasm'])
  • Below are two examples of using wasm code from js

Regular js

@almibe
almibe / Test.java
Created October 6, 2021 16:26
Java if statements vs if expressions
public class Test {
public static void main(String []args){
final var x = 5;
// You can do something like this in Kotlin/Scala etc but not Java
// final var t = if (x == 0) {
// "zero";
// } else if (x > 0) {
// "pos";
// } else {
// "neg";
marp
true

Everyday Linked Data

Alex Michael Berry github.com/almibe twitter.com/alexmiberry

@almibe
almibe / XodusInMemory.kt
Created November 5, 2020 05:11
Sample of using Xodus in memory
import jetbrains.exodus.env.Environment
import jetbrains.exodus.env.EnvironmentConfig
import java.nio.file.Path
import jetbrains.exodus.io.inMemory.MemoryDataWriter
import jetbrains.exodus.io.inMemory.MemoryDataReader
import jetbrains.exodus.io.inMemory.Memory
import jetbrains.exodus.log.LogConfig
import jetbrains.exodus.env.Environments
import org.libraryweasel.ligature.LigatureStore
import org.libraryweasel.ligature.ReadTx
@almibe
almibe / Address.kt
Created November 4, 2018 20:12
JGroups Example With Addressing
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.libraryweasel.pack
import org.jgroups.*
import java.io.Serializable
import java.lang.Exception
import java.lang.RuntimeException
@almibe
almibe / LocalHazelcast.kt
Created November 4, 2018 20:10
Local hazelcast config example
val config = Config()
config.networkConfig.join.multicastConfig.isEnabled = false
config.networkConfig.join.tcpIpConfig.isEnabled = true
config.networkConfig.publicAddress = "127.0.0.1"
val instance = Hazelcast.newHazelcastInstance(config)
package scratchpad.jgroups
import org.jgroups.*
import java.io.Serializable
fun createWithReceiver(receiver: Receiver): JChannel {
val ch = JChannel()
ch.receiver = receiver
@almibe
almibe / gist:91d4d17659c49095158944409ebd0948
Created October 12, 2018 00:29
revert to a specific version in git easily + keep history
git rm -r .
git checkout HEAD~3 .
git commit