Skip to content

Instantly share code, notes, and snippets.

# one line function for activating/deactivating venv in bash without having to install any other tools
# only meant to keep on hand for copy+pasting into bashrc when using normal dotfiles is not ideal, for better version in fish see: https://github.com/grahamannett/graham.fish-plugins/blob/main/functions/avenv.fish
function avenv() { if [[ $(type -t deactivate) == function ]]; then deactivate; elif [ -e .venv/bin/activate ]; then source .venv/bin/activate; fi }
@grahamannett
grahamannett / add_to_fish_config.fish
Created September 28, 2024 19:27 — forked from knyazer/add_to_fish_config.fish
Bringing AI to Git commit.
function gcm
# Check if llm is installed, if not, install it
if not type -q llm
echo "'llm' is not installed. Attempting to install it using pip..."
if pip install llm
echo "'llm' installed successfully."
else
echo "Failed to install 'llm'. Please install it manually and try again."
return 1
end
@grahamannett
grahamannett / reflex-component-example.py
Created June 2, 2024 21:38
reflex-component-example.py
class Component:
def __init__(self, *children, **attributes):
self.children = children
self.attributes = attributes
def compile(self, depth=0):
tag_name = self.__class__.__name__.lower()
attr_str = " ".join(
f'{key}="{value}"' for key, value in self.attributes.items()
)
import time
from rich.progress import Progress
n = 60
pbar = Progress()
pbar.start()
task = pbar.add_task("[cyan]Slowlyyyy update...", total=n)
for i in range(n):
#!/bin/sh
BASE_REPO_PATH="../cs321-resources"
RUBRIC_FILE=*-rubric.txt
! test -n "$PROJECT_NAME" && echo "PROJECT_NAME must be set" && exit 1
check_for() {
if ! test -e $1; then
echo "GETTING $1..."
from concurrent.futures import ThreadPoolExecutor
import cohere
import os
co = cohere.Client(os.environ.get("COHERE_KEY"), check_api_key=False)
import torch
import time
zipped_args = torch.load("zipped_args.pt")
import eyed3
import argparse
from pathlib import Path
def check_subdirectories(folder):
pass
def get_files_folder(path):
files = []
[
{
"trigger": {
"url-filter": "/_ads/",
"url-filter-is-case-sensitive": true,
"load-type": [
"third-party",
"first-party"
]
},
import random
def coinflip(l):
s = ''
for i in range(0, l):
flip = random.choice(['H', 'T'])
s += flip
return s
def montecarlo(i):
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb,scrextend}
\usepackage{fancyhdr}
\pagestyle{fancy}
\newcommand{\cont}{\subseteq}
% https://tex.stackexchange.com/questions/121061/working-with-arial-or-helvetica-fonts