Skip to content

Instantly share code, notes, and snippets.

View gist.md

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 Nov 26, 2021
general renaming script: change the script's file name to change how it works
View x2y.py
#!/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
View swedish numbers
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 Jul 21, 2021
how to seed a cabal from anywhere
View seed-cabal.sh
# 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 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 hypercore in the browser links.md