Skip to content

Instantly share code, notes, and snippets.

View TristenHarr's full-sized avatar

Tristen Harr TristenHarr

View GitHub Profile
@TristenHarr
TristenHarr / rss_downloader.py
Created December 18, 2023 20:52
Simple example of downloading a RSS feed to use for creating a AutoBlogger Bot
import json
import xml.etree.ElementTree as ElementTree
import requests # pip3 install requests
from bs4 import BeautifulSoup # pip3 install bs4
def parse_rss_feed(rss_feed_url):
try:
# Fetch the RSS feed content
response = requests.get(rss_feed_url)
[
{
"definition": {
"name": "qdrant_connector",
"schema": {
"collections": [
{
"arguments": {
"negative": {
"type": {
@TristenHarr
TristenHarr / gist:cfff74beb7ade25f8b9ff189992604e7
Created November 23, 2023 02:48
turso-reinvent-demo-metadata.json
[
{
"definition": {
"name": "turso_connector",
"schema": {
"collections": [
{
"arguments": {},
"deletable": false,
"description": null,
[
{
"definition": {
"name": "duckdb_connector",
"schema": {
"collections": [
{
"arguments": {},
"deletable": false,
"foreign_keys": {},
# I've written this function to calculate the minimum number of moves required:
# stacks: List of List of Characters representing the pieces in the stack, stacks[0][0] is the top of stack[0]
# stack_ind: The index of the stack that the piece will be added to
# needs_piece: The piece that should be added to the stack
# needs_index: The index where the piece should be located
def calculate_min_moves(stacks, stack_ind, needs_piece, needs_index):
# Minimum moves needed to empty the stack that will receive the piece so that it can hold the piece
num_removals = 0
for s in stacks[stack_ind][:needs_index+1]:
if item != "-":
import random
import time
def mix_data(d):
new_arr = list()
for item in d:
for item2 in item:
new_arr.append(item2)
random.shuffle(new_arr)
import random
def mix_data(d):
new_arr = list()
for item in d:
for item2 in item:
new_arr.append(item2)
random.shuffle(new_arr)
unsorted_arr = []
@TristenHarr
TristenHarr / README-Template.md
Created April 28, 2017 07:16 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

import mpmath
def primeslist(x):
primeslist = [2]
my_pdict = {}
for i in range(2,x+1):
prime = True
for j in range(2, int(mpmath.sqrt(i)/mpmath.mpf(1)+2)):
if i%j == 0:
prime = False
if prime == True:
import timeit
x = timeit.timeit()
import sys
first = sys.stdin.read().split('\n')
n,q,box,values = list(map(lambda x: int(x), first[0].split(' ')))[0],list(map(lambda x: int(x), first[0].split(' ')))[1], list(map(lambda x: int(x), first[1].split(' '))), first[2:]
finals = []
for item in values:
try:
n,l,r,c = list(map(lambda x: int(x), item.split(' ')))
if n == 1: