text stringlengths 1 93.6k |
|---|
import Quartz
|
from pynput import keyboard
|
# cmd-shift-p
|
COMBINATION = {keyboard.Key.cmd, keyboard.Key.shift, keyboard.KeyCode.from_char('p')}
|
current_keys = set()
|
def on_key_down(key):
|
if any([key in COMBINATION, key in current_keys]):
|
current_keys.add(key)
|
if all(k in current_keys for k in COMBINATION):
|
perform_action()
|
def on_key_up(key):
|
if key in current_keys:
|
current_keys.remove(key)
|
def perform_action():
|
print("Hotkey pressed!")
|
str = pb.get_contents(diff=True)
|
prompt = f'Clean up this copy-paste from Slack and make it suitable for pasting into Notion as meeting notes:\n\n {str}\n'
|
suggestion = ""
|
for chunk in openai.Completion.create(
|
engine="text-davinci-003",
|
prompt=prompt,
|
temperature=0,
|
max_tokens=150,
|
top_p=1,
|
frequency_penalty=0,
|
presence_penalty=0,
|
stream=True):
|
sys.stdout.write(chunk.choices[0].text)
|
suggestion += chunk.choices[0].text
|
# flush stdout
|
sys.stdout.flush()
|
sys.stdout.write('\n')
|
# Using pynput to capture key events
|
with keyboard.Listener(on_press=on_key_down, on_release=on_key_up) as listener:
|
listener.join()
|
# <FILESEP>
|
import django.conf.global_settings as DEFAULT_SETTINGS
|
SECRET_KEY = 'bootstrap4isawesome'
|
DATABASES = {
|
'default': {
|
'ENGINE': 'django.db.backends.sqlite3',
|
'NAME': ':memory:',
|
},
|
}
|
INSTALLED_APPS = (
|
# Default Django apps
|
'django.contrib.admin',
|
'django.contrib.auth',
|
'django.contrib.contenttypes',
|
'django.contrib.sessions',
|
'django.contrib.messages',
|
'django.contrib.staticfiles',
|
# We test this one
|
'bootstrap4',
|
)
|
MIDDLEWARE_CLASSES = DEFAULT_SETTINGS.MIDDLEWARE_CLASSES
|
TEMPLATES = [{
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'APP_DIRS': True,
|
'OPTIONS': {
|
'context_processors': [
|
"django.contrib.auth.context_processors.auth",
|
"django.template.context_processors.debug",
|
"django.template.context_processors.i18n",
|
"django.template.context_processors.media",
|
"django.template.context_processors.static",
|
"django.template.context_processors.tz",
|
"django.contrib.messages.context_processors.messages"
|
]
|
}
|
}]
|
ROOT_URLCONF = None
|
BOOTSTRAP4 = {
|
'javascript_in_head': True,
|
'required_css_class': 'bootstrap4-req',
|
'error_css_class': 'bootstrap4-err',
|
'success_css_class': 'bootstrap4-bound',
|
}
|
# <FILESEP>
|
import argparse
|
import datetime
|
import math
|
import os
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.