Skip to content

Instantly share code, notes, and snippets.

@33mhz
33mhz / acl.json
Last active November 4, 2016 20:10
ACL example
"owner":{},
"acl": {
"full": {
"immutable": true,
"user_ids": [1,2,4],
"you": false
},
"write": {
"immutable": false,
"user_ids": [8,"@user"],
Channel
{
"type":"vidcast",
"owner":{},
"acl":{
"full":{"user_ids":[]},
"write":{"any_user"}
},
"raw":[
{
# Author: @33MHz
# 2017-03-04 hackday
# Polls, printing to USB receipt printer
from pnutpy import api
import subprocess
from shlex import quote
api.add_authorization_token('TOKEN HERE')
@33mhz
33mhz / reverse_markdown.md
Created October 6, 2017 13:26
reverse markdown from pnut entities

Setup

This is pseudocode.

post has been retrieved from the API.

Be sure to make substrings and other string operations by "multibyte" divisions.

Operation

@33mhz
33mhz / poll.md
Created March 26, 2018 01:25
Create Pnut.io Poll
curl "https://api.pnut.io/v0/polls" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "Content-Type: application/json" \
    -d "{
  \"type\":\"general.poll\",
  \"prompt\":\"What is Pnut to you?\",
  \"options\":[
    {
 \"text\":\"My jam\"
@33mhz
33mhz / me.rafaelcosta.user.profiles.md
Last active November 1, 2018 14:47
Proposed core user contacts raw

External User Profiles

me.rafaelcosta.user.profiles

This raw lists a user's external profiles.

By convention, these are common options, but users or clients can specify their own also:

@33mhz
33mhz / crosspost-with-source.md
Last active October 16, 2019 20:45
Pnut crosspost detail with source

I believe all but canonical_url would be optional. But if including source, both url and name would be required. If including user, id would be required.

{
    "type": "io.pnut.core.crosspost",
    "value": {
        "canonical_url": "https://some-matrix-service.org/howeverthisgoes/123",
        "user": {
            "id": "@alice:example.com",
 "username": "alice",
@33mhz
33mhz / st.longpo.longpost.json
Last active June 11, 2021 02:20
Longpost channel
{
"type": "st.longpo.longpost",
"raw": {
"st.longpo.longpost": [
{
"title": "String",
"category": "String"
}
]
}
@33mhz
33mhz / st.longpo.content.json
Last active June 11, 2021 02:19
Longpost message
{
"text": "String",
"raw": {
"st.longpo.content": [
{
"body": "String"
}
]
}
}
@33mhz
33mhz / st.longpo.broadcast.json
Last active June 11, 2021 02:17
Longpost broadcast post
{
"text": "String",
"raw": {
"st.longpo.broadcast": [
{
"longpost_id": "Channel ID"
}
]
}
}