Skip to content

Instantly share code, notes, and snippets.

View enorms's full-sized avatar

Eric Norman enorms

  • https://angel.co/ericnorman
  • San Francisco, CA
  • X @enxeth
View GitHub Profile
@enorms
enorms / config.py
Created November 25, 2023 06:52
config example
# https://github.com/MinaGhadimiAtigh/hyperbolic_representation_learning/blob/main/notebooks/2_Hyperbolic_Image_Embeddings.ipynb
class Config:
def __init__(self, shot=1, lr=0.001, step=50, gamma=0.8, c=0.05, model="convnet", hyperbolic = True, dim=1600,
query=15, way=5, validation_way=5, temperature=1, dataset="CUB", lr_decay=True, max_epoch=200):
self.lr = lr # learning rate
self.lr_decay = lr_decay # Boolean, if to perform learning rate scheduler
self.step_size=step # Period of learning rate decay
self.gamma = gamma # Multiplicative factor of learning rate decay
self.dataset= dataset # Dataset name
@enorms
enorms / copy_question_rating_to_clipboard.py
Created July 13, 2023 22:29
Check LLM output accuracy via reverse query
import pyperclip
def copy_question_rating_to_clipboard(answer: str, question: str) -> None:
rating_prompt = (
f"On a scale of 0 to 100, with 100 being perfect and 0 being completely wrong, "
f"rate how well this response `{answer}` answers this question `{question}`? "
"Give only the number rating."
)
pyperclip.copy(rating_prompt)
@enorms
enorms / copy_datetime_fun.sh
Created January 8, 2023 05:14
print and copy date with fun confirmation line in color and emoji (macos zshell)
#!/bin/zsh
grn="$(tput setaf 2)"
didcopymsg='👆 copied to clipboard 📋 ✅ 🐶'
alias copy="tr -d '\n' | pbcopy"
alias DATE='echo "$(date '\''+%F %T %Z'\'')" | tee /tmp/output.txt; cat /tmp/output.txt | copy; rm /tmp/output.txt; echo "$grn $didcopymsg"'
DATE
# 2023-01-07 21:08:53 PST
# 👆 copied to clipboard 📋 ✅ 🐶
@enorms
enorms / unique_voters.py
Created April 9, 2022 15:32
Unique wallets count
# Count unique wallets with votes recorded in all proposals
# for orangedaoxyz.eth
#
# https://docs.snapshot.org/graphql-api
#
import requests
import pandas as pd
# pip install
nbstripout
# .git/config
[include]
path = ../.git.config/repo.config
# .git.config/repo.config
[filter "nbstripout"]
clean = venv/bin/nbstripout
import pickle
a = {'hello': 'world'}
with open('data.pickle', 'wb') as file:
pickle.dump(a, file)
with open('data.pickle', 'rb') as file:
b = pickle.load(file)
@enorms
enorms / ipfs-cid-in-b32.sh
Created August 2, 2021 05:56
IPFS CID v2 > v1 for browser
ipfs cid format -v 1 -b base32 [CID]
ipfs dag get bafybeiccfclkdtucu6y4yc5cpr6y3yuinr67svmii46v5cfcrkp47ihehy | python -m json.tool
@enorms
enorms / git_alias.txt
Last active June 30, 2021 23:02
Git alias
# add
git config --global alias.st status
# view
git config --get-regexp alias
<!--- cspell:dictionaries python --->
<!--- cspell:ignore variable_name --->