Skip to content

Instantly share code, notes, and snippets.

cblgh /
Created Jul 21, 2021
how to seed a cabal from anywhere
# make sure you are using node 12 (underlying stack needs to be updated a bit for latest node versions)
# here we are using nvm for that purpose
nvm install 12 && nvm use 12
# install cabal-cli globally
npm i -g cabal
# seed your cabal. default port that is used is 13331
cabal <cabalkey> --seed
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 (
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 :)")
}).then(() => {
console.log("execution continued without problem")
}).catch(() => {
console.log("lol im a noob")
View moderation stuff.txt
**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) {

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"))