Skip to content

Instantly share code, notes, and snippets.

View treethought's full-sized avatar
💃

Cam Sweeney treethought

💃
View GitHub Profile
@treethought
treethought / main.py
Created June 8, 2024 04:34
farcaster unique channel casters
import requests # Import the requests library for making HTTP requests
import argparse # Import the argparse library for parsing command-line arguments
import os # Import the os library for accessing environment variables
import json
# Function to make a GET request to the Neynar API
def get(endpoint, args, api_key=None):
url = f"https://api.neynar.com/{endpoint}" # Construct the full URL for the endpoint
params = args.copy() # Copy the arguments to avoid modifying the original dictionary
if api_key is None:
@treethought
treethought / scan.py
Last active May 22, 2018 14:20
pipfetch
import os
import sys
import re
import click
import subprocess
def get_py_files(dir):
for dirname, dirnames, filenames in os.walk(dir):
# path to all subdirectories first.
for subdirname in dirnames:

Are events being used most effectively

The EventState classes are being used to trigger other intents, which then set dialogue checkpoints and perform logic. This divides the bot experience into sensible components (Report Items, Show Items, Gathering Info about an Item, etc). However, it also requires that each step/state of these components be completed in a specific order.

While I appreciate the serparation of logic and the EventStates' purpose of starting the next segmnet of dialogue, I feel that it may be overly complex and redundant, without providing potential advantages. We could simply use the EventState phrases for the targeted Intent itself, which accomplishes the same triggering.

With the following Events, "Phrases", and Intents to report a found phone

Instead of:

Keybase proof

I hereby claim:

  • I am treethought on github.
  • I am treethought (https://keybase.io/treethought) on keybase.
  • I have a public key ASCywsChCvU0Zl40uAXyxRXhL2RvZ0M87hdkKORpnvz5vgo

To claim this, I am signing this object:

@treethought
treethought / Makefile
Created September 11, 2017 07:01
Simple Makefile for Quasar/Cordova workflow
BASEDIR=$(CURDIR)
CORDOVADIR = $(BASEDIR)/cordova
ABDDIR = ~/Library/Android/sdk/platform-tools
KEYSTORE = YOURSTORE
STOREPWD = YOURPASSWORD
KEYALIAS = YOURALIAS
KEYPWD = YOURPASSWORD
@treethought
treethought / rich_list.py
Created June 3, 2017 19:23
An example of an API.AI webhook rich response for Actions on Google integration
# Providing the following resposne to API.AI from a webhook produces a rich response list
# API.AI parses the messages and sends an appropriately formmated response to Actions.abs
# However, the API and Actions appear to be on different api versions currently.abs
# Therefore, in API.AI when a user selects a list object, the object's "key" is sent to API.AI
# as a user query to trigger thenext intent. In Actions, the items title is sent
@treethought
treethought / get_or_creat.py
Created March 30, 2017 06:48
Get or create an object with SQLAlchemy
# http://stackoverflow.com/questions/2546207/does-sqlalchemy-have-an-equivalent-of-djangos-get-or-create
# credit to Wolf
def get_or_create(session, model, defaults=None, **kwargs):
instance = session.query(model).filter_by(**kwargs).first()
if instance:
return instance, False
else:
params = dict((k, v) for k, v in kwargs.iteritems() if not isinstance(v, ClauseElement))
params.update(defaults or {})
@treethought
treethought / alexa_schema.py
Created November 9, 2016 01:35
Generates ASK Intent Model Schema from flask-ask application by inspecting intent functions
#!/usr/bin/env
import os
import inspect
from flask import json
from project import ask
def generate_schema(skill):