This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The function: | |
get_headers = lambda curl: {k:v for k, v in | |
[[i.strip().strip(r"'-H \$'") for i in | |
[x.split(': ')[0], ': '.join(x.split(': ')[1:])]] | |
for x in curl.split('\n') | |
if '-H' in x]} | |
# You get a curl request in this kind of format from eg: Chrome Developer Tools | |
# Important: all arguments must be on a new line and it must be a raw string (the r before the triple quotes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Timer: | |
def __init__(self, indent = 30): | |
self.start = time.time() | |
self.rj = indent | |
self.report = 'Start:'.rjust(self.rj) + '0.000000'.rjust(10) | |
self.current = self.start | |
def diff(self, msg): | |
tmp = self.current | |
self.current = time.time() | |
return msg.rjust(self.rj) +':'+str(round(self.current - tmp, 6)).rjust(10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a solver for The Password Game: https://neal.fun/password-game/, | |
# Specifically the section "The elements in your password must have atomic numbers that add up to 200" | |
# It's written as a Flask app because I was sharing it with my friends that were also playing. | |
# However you can just use the function `get_required_elements_for_password_game(password)` | |
# to do it locally | |
# Got ChatGPT to write the element list for me | |
elements = [ | |
{"name": "Hydrogen", "symbol": "H", "atomic_number": 1}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, sys, os | |
from openai import OpenAI | |
newsapi_apikey = os.environ.get('NEWS_APIKEY') | |
# This is a terrible excuse for a keywords function. Please replace. Most issues with this RAG can be blamed on this. | |
def get_keywords(input_text): | |
stripped = ''.join([i for i in input_text if i.isalpha() or i == ' ']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use client"; | |
import React, { useState, useRef, useEffect } from "react"; | |
interface HoverSVGProps { | |
src: string; | |
width: number; | |
height: number; | |
color: string; | |
alt: string; | |
hoverColor: string; |
OlderNewer