Skip to content

Instantly share code, notes, and snippets.


general function docs for the interfaces of cabal-client: api docs

the file we'll likely serialize the out-of-log storage is client.js

file containing channel related logic & state channel-details.js

  • PMs are represented just like regular channels, except populated with messages from a different type of emitted event, see channel-details.js#L215
  • PM channels can't be renamed (the name of the channel is the public key of the person you are chatting with atm)
  • cabal-details.js contains the brunt of the logic for cabal-client's interactions. this is the place to remove a logic guard when you want enable leaving of PMs: [cabal-deta
cblgh /
Last active Nov 26, 2021
general renaming script: change the script's file name to change how it works
#!/usr/bin/env python3
uses the script's name to determine how to rename files in the directory it exists in
e.g. -> renames files named with *.x suffixes to now end with *.y suffixes
or more usefully: -> renames files named with .jpeg suffix to end with .jpg
lowercases the matching suffix (e.g. will match both JPEG and jpeg)
import sys
import os
View swedish numbers
0 noll
1 ett
2 två
3 tre
4 fyra
5 fem
6 sex
7 sju
8 åtta
9 nio
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 hypercore in the browser