Skip to content

Instantly share code, notes, and snippets.

View davestgermain's full-sized avatar
💭
typing typing typing

Dave St.Germain davestgermain

💭
typing typing typing
View GitHub Profile
#!/usr/bin/env python
"""
Program that demostrates the protocol negotiation explained in https://github.com/nostr-protocol/nips/pull/351
requires aionostr: pip install aionostr
"""
import asyncio
from aionostr.key import PrivateKey, PublicKey
from aionostr.event import Event
from aionostr import Manager
"""
When these validators are enabled:
* any pubkey in pubkey_whitelist can post
* any other pubkey can post, as long as someone in the whitelist is tagged
* only events from pubkeys in the whitelist can be read by clients
* authenticated pubkeys in the whitelist can view/post
Configuration file:

First wiki page:

{
    "id": "1a622cfb3e2d3d0549915d3526f2e0d04e40a0ef0b810f2f3f167a77f7807b01",
    "pubkey": "aba3eff5ac43d745e2949a2df8cdd09c9e4366578872a20b6b4ec320320370ab",
    "created_at": 1674174264,
    "kind": 5929,
    "tags": [
        [
            "w",

Keybase proof

I hereby claim:

  • I am davestgermain on github.
  • I am timelessway (https://keybase.io/timelessway) on keybase.
  • I have a public key ASAFxw9K1cjxkFfJhtmaA1g9_gvihY_cyq73EKAfNUWIZAo

To claim this, I am signing this object:

from django.apps import apps
from django.db.utils import IntegrityError
def create_oauth_credentials(name):
"""
Automatically create oauth credentials for applications
"""
username = 'oauth_api_%s' % name
try:
auth_user = get_user_model().objects.create_user(username)
import psycopg2
create_table = '''
create table if not exists test_bt (
v BYTEA
);'''
binary = b'\xff\xd8\xff\xe0\x00\x10'
conn = psycopg2.connect('postgresql://root@localhost:26257/test?sslmode=disable')
import requests
import json
import socket
import sys
from wsgiref.simple_server import make_server
import cgi
from pprint import pprint
def submit_to_xqueue(xqueue_server, queue_name, grader, submission, username='lms', password='lms'):
my_address = socket.gethostbyname(socket.gethostname())