Skip to content

Instantly share code, notes, and snippets.

View eebmagic's full-sized avatar

Ethan Bolton eebmagic

View GitHub Profile
with open('homeworks.txt') as file:
content = file.read().strip()
homeworks = [int(x) for x in content.split('\n')]
with open('tests.txt') as file:
content = file.read().strip()
tests = [int(x) for x in content.split('\n')]
# Fill 100s for remaining grades
set tabstop=4 shiftwidth=4 expandtab
syntax on
nnoremap ; :
" Use tab key for indenting visual blocks
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
" duplicate highlighted selection under itself
############################################################################################################################
#### MY ALIASES ####
alias youtube-dl-mp3='youtube-dl -x --audio-format mp3 '
alias l='ls -1'
alias md5='md5 -r'
alias usg='du -chd 1 |sort -h'
alias count='ls . | wc -l'
alias counttypes='python3 ~/pythonTools/type_counts/counttypes'
alias typecounts='counttypes '
alias typecount='counttypes '
@eebmagic
eebmagic / ebolton.zsh-theme
Created May 9, 2021 01:23
zsh theme similar to my old bash theme
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
username() {
echo "%F{cyan}%n%{$reset_color%}"
}
directory() {
echo "%~"
}
#!/usr/bin/env python3
import os
remote = os.popen('git remote show').read()
if not remote:
quit()
response = os.popen(f'git remote show {remote}').read()
for line in response.split('\n'):
@eebmagic
eebmagic / musicIdeas.md
Created January 18, 2022 20:33
Colleciton of Music Ideas
set tabstop=4 shiftwidth=4 expandtab
syntax on
set clipboard=unnamed
set hlsearch incsearch
set number relativenumber
set ruler
set splitright
set splitbelow
set showcmd
@eebmagic
eebmagic / SafeInterface.py
Last active November 9, 2023 22:41
An interface for chromaDB that checks that documents are only added when there is some data change (doc or metadata). Should also minimze embedding function calls (although, still gets called for metadata changes that won't change embedding results).
import hashlib
import json
import threading
import math
import time
class SafeInterface():
def __init__(self, collection, batchSize=200, threaded=True):
self.col = collection
self.batchSize = batchSize
@eebmagic
eebmagic / 3D_scatter_template.md
Created February 1, 2024 03:41
Chroma to Plotly 3D scatter template

Reduce and Plot

Reduce data from a collection to 3D datapoints with PCA reduction.

Then use plotly to plot to a 3d scatter plot.

import plotly.express as px
from sklearn.decomposition import PCA
@eebmagic
eebmagic / DBSCAN Build Labels.md
Created February 1, 2024 16:56
DBSCAN basics
import chromadb

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import euclidean_distances
from sklearn.metrics import silhouette_score as sil_score
from sklearn.decomposition import PCA
from sklearn.cluster import DBSCAN