Skip to content

Instantly share code, notes, and snippets.

View patcon's full-sized avatar

Patrick Connolly patcon

View GitHub Profile
@NewJerseyStyle
NewJerseyStyle / polis_api_template.py
Created February 21, 2025 00:39
FastAPI based polis compatible API spec in Python (draft)
from typing import Optional, List, Dict, Union
from fastapi import FastAPI, Query, Header, Cookie, Depends, HTTPException, status
from fastapi.responses import JSONResponse
from pydantic import BaseModel, validator
import re # For email validation
app = FastAPI()
# --- Helper Functions (Simplified for demonstration) ---
# Replace these with your actual helper function implementations
@eterps
eterps / output.txt
Last active November 25, 2024 21:01
Polislite algorithm (inspired by pol.is)
Consensus Statements:
- Climate change requires immediate action (strong agreement)
Divisive Statements:
- Nuclear power is necessary for clean energy
- Carbon tax should be implemented globally
- Individual actions matter for sustainability
- Companies should be held liable for emissions
Group Positions:
@mbjorkegren
mbjorkegren / gpt4_ideas_for_polis
Created March 25, 2023 07:19
How can intelligent large language models be used to improve Pol.is?
Intelligent large language models like OpenAI's GPT-3 can be used to improve Pol.is in several ways, enhancing the platform's capabilities and user experience. Here are some potential improvements:
1. Statement generation: Language models can generate high-quality, relevant, and diverse statements or questions based on the conversation topic. This can help stimulate more engaging and informative discussions among participants.
2. Summarization: Language models can automatically summarize conversation threads, identifying key points and areas of agreement or disagreement. This can make it easier for users to understand the overall flow of the conversation and track its progress.
3. Sentiment analysis: Language models can analyze the sentiment of participants' responses, providing insights into the emotional tone of the conversation. This can help organizers identify potential areas of contention or support and address them more effectively.
4. Moderation: Language models can help in automating content mode
@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB
@flatcap
flatcap / gmail.rc
Last active March 7, 2025 19:34
neomutt config gmail
# To use: change gmail's settings to:
# enable imap:
# Gmail Settings
# Forwarding and POP/IMAP
# create an app password
# App passwords
# https://myaccount.google.com/security
set imap_login = ""
set imap_pass = "XXXXXXXXXXXXXXXX"
@tomhicks
tomhicks / plink-plonk.js
Last active November 12, 2024 19:08
Listen to your web pages

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@VictorNine
VictorNine / fbMatter.py
Created February 7, 2019 20:22
facebook module for matterbridge
import json
import requests
from fbchat import log, Client
# Subclass fbchat.Client and override required methods
class FBListener(Client):
def onMessage(self, author_id, message_object, thread_id, thread_type, **kwargs):
self.markAsDelivered(thread_id, message_object.uid)
self.markAsRead(thread_id)
@easherma
easherma / did_i_do_that.md
Last active January 23, 2018 16:57
Did I Do That?

Did I do that?

Problem

Reduplication of work is very common in both the civic tech and open source space.

For lots of reasons (expand).

To address this, in the community it is often proposed to have a list of resources or existing projects. While an obvious solution, it has several fundamental challenges, such as:

  • It is hard for one or a small group of people to know everything that is going on
  • Someone has to maintain this resource or else relevance slowly declines and leads to stagnation
@twolfson
twolfson / README.md
Last active November 21, 2023 11:43
Audit logging via sequelize

We prefer to have audit logging in our services that leverage databases. It gives us clarity into sources of where ACL issues might originate as well as gives us a general timeline of activity in our application.

Audit logging is tedious to set up so this gist contains our latest iteration of audit logging support for a sequelize based service.