Skip to content

Instantly share code, notes, and snippets.

@richdrummer33
richdrummer33 / openai-bing-search-assistant.py
Created November 30, 2023 17:41
OpenAI Assistant 🤖 with Bing Search 🔎
import os
import asyncio
import requests
import time
import json
import openai
from urllib.parse import quote_plus
from openai import OpenAI
from dotenv import load_dotenv
@avelican
avelican / yt-txt.py
Created April 30, 2023 08:19
Get YouTube transcript (from subtitles / caption file)
import sys
import subprocess
if len(sys.argv) < 2:
print("Please provide a YouTube video URL as the first argument.")
sys.exit(1)
video_url = sys.argv[1]
command = [
@avelican
avelican / keypoints.py
Created April 26, 2023 23:04
Keypoints.py - Summarize a long text document to bullet points
import os
import openai
prompt = "I'm a busy CEO, please summarize the following in 10-20 bullet points. Include only the most important, useful or interesting information.\n\n"
# model = 'gpt-3.5-turbo' # 'gpt-4' # moved to gpt_chat_completion since we use both
CONTEXT_SIZE = 4096 # 2048 for GPT-3 (as half the input.
# CONTEXT_SIZE = 1024 # tiny context for testing
MAX_TOKENS_IN = int(CONTEXT_SIZE*2/3)
MAX_TOKENS_OUT = CONTEXT_SIZE - MAX_TOKENS_IN
@Blackshome
Blackshome / bathroom-humidity-exhaust-fan.yaml
Last active April 18, 2024 21:19
bathroom-humidity-exhaust-fan.yaml
blueprint:
name: Bathroom Humidity Exhaust Fan
description: >
# 🚿 Bathroom Humidity Exhaust Fan
**Version: 2.3**
Step into the future of freshness - customize it your way and let the automated fan system handle the humidity control for you! 🌿🚿
@natmchugh
natmchugh / copying-Paxton-fobs.md
Last active March 31, 2024 23:21
How to copy, read and write Paxton fobs and cards with an RFIDler

How to copy, read and write Paxton fobs and cards with an RFIDler

A newer version of this info is available at https://badcfe.org/how-to-paxton-with-rfidler/

Paxton fobs and readers are popular in the UK especially the Net2 system where the fobs look like this with a blue ring: Paxton Fob

Paxton readers often look like this:

Paxton Reader

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>APNs</key>
<array>
<dict>
@sutlxwhx
sutlxwhx / backup.sh
Last active February 1, 2024 21:08
Backup all your MySQL / MariaDB databases with rclone
#!/usr/bin/env bash
# To run this script you need to install https://rclone.org/ first
# Use current date and time for future backup folder name
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
# Declare the directory where the temporary backup files will be stored
BACKUP_DIR="/backup/$TIMESTAMP/mysql"
# State the username for your MySQL / MariaDB instace that can access the neccessary databases
MYSQL_USER=""
# Point this script to mysql executable file
MYSQL=/usr/bin/mysql
@ttimasdf
ttimasdf / 00-Systemd_service_for_autossh.md
Last active May 6, 2024 02:21 — forked from thomasfr/autossh.service
Systemd service for autossh

Usage

curl -sSL https://gist.githubusercontent.com/ttimasdf/ef739670ac5d627981c5695adf4c8f98/raw/autossh@host1 | \
  sudo tee /etc/default/autossh@example
curl -sSL https://gist.githubusercontent.com/ttimasdf/ef739670ac5d627981c5695adf4c8f98/raw/autossh@.service | \
  sudo tee /etc/systemd/system/autossh@.service

sudo useradd -g nogroup -s /bin/false -m tunnel
sudo -u tunnel mkdir -p ~tunnel/.ssh # and copy your private key here
@riemers
riemers / dropbox.py
Last active May 22, 2020 02:15
Python uploader for dropbox (original found at https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=164166)
import os
import subprocess
from subprocess import Popen, PIPE
#The directory to sync
syncdir="/home/homeassistant/.homeassistant/"
#Path to the Dropbox-uploaded shell script
uploader = "/home/homeassistant/.homeassistant/extraconfig/shell_code/dropbox_uploader.sh"
#If 1 then files will be uploaded. Set to 0 for testing
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*