Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
RangerMauve / filesystem.js
Created Mar 27, 2021
Test opening a write stream for the FileSystem API
View filesystem.js
// Execute this in Chrome Dev Tools on an HTTPs web page
// Choose a file on your FS
[fileHandle] = await window.showOpenFilePicker();
// This will throw an error on Electron 12
writable = await fileHandle.createWritable();

GNOME Palette

  • Kinda like web-palette but for Linux desktop
  • Use GJS's AT-SPI bindings
  • Search for every button / heading / hyperlink on the page
  • Generate a palette which lets you fuzzy match
  • Integrate with shell as a search providr? Look at this extension
RangerMauve / DatArchive.dream.js
Created Aug 27, 2019
Dream DatArchive API for extensions / peers
View DatArchive.dream.js
const archive = await DatArchive.load('someurl', {
// Gets passed down to hyperdrive constructor
extensions: ['example', 'foo', 'bar']
archive.addEventListener('extension', ({detail}) => {
const {type, message, peer} = detail
if(type === 'foo') {
// Similar to the hypercore API:
RangerMauve /
Last active Jul 30, 2019
Corestore API proposal

Corestore API Proposal


  • Storing multiple hypercores in a single "group"
  • Purging storage for a given hypercore key
  • Able to replicate whole group
  • Specifying which key should be used for replication handshake

API (from the SDK)

View gist:62501c98b42c63f2de6ee0644a6852ff
WebRTC, unlike Dat, requires doing a handshake through a third party.
With beaker, that third party can be the existing P2P connections that you have.
To connect between two peers you need to do the following:
- Create a Dat Archive for the call website
- Listen on messages in the [dat-peers API](
- Have the user enter a "room"
- Set up the WebRTC connection, send the SDP handshake and the `room` through datPeers
- When you get messages for your room, pass them to the local PeerConnection as being remote SDP or ICE
RangerMauve /
Last active Apr 9, 2019
Tools in the Dat Toolbelt

Dat Toolbelt

Dat has a cool ecosystem with a bunch of different people working on interesting things. This is a list of what I'd like to have in an official Dat Toolbelt along with tutorials on how to use these tools.


  • Files
    • Create a file, share it with a dat:// link
    • All archives should be multiwritable, with mounts / etc
RangerMauve / dirty-dat-fetch.js
Last active Oct 26, 2018
Patch `window.fetch` to support dat:// URLs
View dirty-dat-fetch.js
window._fetch = fetch
window.fetch = async function(url) {
if(url.startsWith("dat://")) {
const parsed = new URL(url)
const archive = await DatArchive.load(`dat://${parsed.hostname}`)
return {
text: async () => {
return archive.readFile(parsed.path, "utf8")
RangerMauve / clink_prompt.lua
Last active Apr 8, 2020
Clink script for having a nice command prompt with git branch support and home directory aliasing
View clink_prompt.lua
RangerMauve /
Created Mar 29, 2016
Ideas for programming language


A simple, lisp-like, and functional language for experimenting with making a language.

Variable declarations

Variables are declared on the stack, declaring one can be done with the = function. Variables are marked as being constant upon being assigned, and cannot be reassigned again within the current function. The assignment function takes two arguments, name:String and value:Any. Since it's just a function, you can pass in a variable for the name to have dynamically resolved names within the current scope.

Assigning to a variable example:

RangerMauve / mqtt.pegjs
Created Mar 21, 2016
MQTT-Regex parser in PEG.js
View mqtt.pegjs
path = items:(pathStart pathEnd?) {return items[0].concat(items[1])}
pathStart = (items:(pathItem / singleParam / single)+)
pathEnd = item:(multiParam / multi / lastItem) {return item}
pathItem = text:pathName "/" {return {type: "text", content: text}}
lastItem = text:pathName "/"?