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
cblgh / x2y.py
Last active November 26, 2021 12:03
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. x2y.py -> renames files named with *.x suffixes to now end with *.y suffixes
or more usefully: jpeg2jpg.py -> renames files named with .jpeg suffix to end with .jpg
lowercases the matching suffix (e.g. jpeg2jpg.py will match both JPEG and jpeg)
"""
import sys
import os
0 noll
1 ett
2 två
3 tre
4 fyra
5 fem
6 sex
7 sju
8 åtta
9 nio
@cblgh
cblgh / seed-cabal.sh
Created July 21, 2021 08:50
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
cblgh / md-to-anki.go
Last active June 4, 2021 18:29
convert a file containing prompts with markdown to a tsv file with cards containing html (easy to import via anki)
package main
import (
"github.com/gomarkdown/markdown"
"strings"
"path/filepath"
"time"
"fmt"
"io"
"os"
"log"
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) {
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")
})
/ban
/mute
/purge
/ignore
**with optional stated reason**
hide all posts
hide future posts
hide locally only