Skip to content

Instantly share code, notes, and snippets.

@cblgh
cblgh / md-to-anki.go
Last active Jun 4, 2021
convert a file containing prompts with markdown to a tsv file with cards containing html (easy to import via anki)
View md-to-anki.go
package main
import (
"github.com/gomarkdown/markdown"
"strings"
"path/filepath"
"time"
"fmt"
"io"
"os"
"log"
View kappa-view-level-basics.js
const kappa = require('kappa-core')
const View = require('kappa-view-level')
const ram = require('random-access-memory')
const level = require('level-mem')
const core = kappa(ram, { valueEncoding: 'json' })
const lvl = level()
let view = View(lvl, {
map: function (msg) {
View promise-reject.js
return new Promise((res, rej) => {
rej ("mistaken")
console.log("Nope :)")
res("hehe")
}).then(() => {
console.log("execution continued without problem")
}).catch(() => {
console.log("lol im a noob")
})
View moderation stuff.txt
/ban
/mute
/purge
/ignore
**with optional stated reason**
hide all posts
hide future posts
hide locally only
View img-2-ascii.js
var asciify = require('asciify-image')
var options = {
fit: 'box',
width: process.stdout.columns,
height: process.stdout.rows
}
asciify('cabal.png', options)
.then(function (asciified) {
View cabal-client.md

cabal-client definitely stores:

  • what channels you have joined
  • for each channel you've joined: what was the latest message you read in that channel
  • last viewed channel

cabal-client probably stores:

  • what cabals you have joined
  • what aliases (human friendly names for cabal:// keys) you have for those cabals
View single-chat.js
var hypercore = require('hypercore')
var pump = require("pump")
var disco = require("discovery-swarm")
var feed = hypercore('./single-chat-feed', {
valueEncoding: 'json'
})
var swarm = disco()
feed.ready(function () {
console.log("pub", feed.key.toString("hex"))
View cabal architecture.md

ARCHITECTURE

cabal clients
  cabal-core

cabal-core
  discovery-swarm
    dat-swarm-defaults
  kappa-view-level
  kappa-core