Who owns data on you? Google Maps has tracked nearly every location you’ve been in the last decade. But you cannot query it in any way. Have you ever wanted to know: “How many times have I been to the gym this week?” or “How many days did I spend in California this year?” You…
All posts in Uncategorized
python reference sheet
[list] -> [list] [list] -> num
How to avoid overwriting files in python
Strategy 1: increment a suffix so like “file.pdf(1)” Version: Simple Version: Guards against race conditions The above is safe if there is only one process writing to the location but it can include a race condition. This is the safer version that “opens” the file. Strategy 2: attach a timestamp
How to use the python rank-bm25 library
Note: this library is called rank-bm25 on pypi (pypi) and NOT bm25 Official docs (github) say: However, you often want to clean the corpus (lowercase, remove punctuation) before indexing the corpus. Once you do that you must keep the original corpus around that index into the original unedited strings. This works for most cases! Note,…
How to invert docker ps output
How Step: Create a new bash script (“.docker_ps_invert.sh) Step: allow executing Why? Alternative You can choose specific columns to show (like below)… But what if you want to see every column? That’s where the script about shines.
install nginx on mac with homebrew
Q: How do I install nginx? Q: Where is nginx configured? Q: Where is nginx hosted on homebrew?
local inference with llama-cpp-python
Step: install the package Step: download a model “TheBloke” on huggingface (link) has a ton of models in “GGUF” format (format introduced by llama.cpp) Click on any of these different quantized (reduced precision) models and find the “download” link Put them in your project somewhere like a “models” directory Step: create your python (.py) or…
How to convert mov to mp4 with ffmpeg
When you record on Quicktime, that saves as .mov which is a SUPER huge file size. Notes:
Mac and Docker Desktop: “Cannot connect to the Docker daemon”
Why is this happening? Solution: Run this command to create a symbolic link inside of the “/var” directory Source: https://github.com/nektos/act/issues/1658 Deep dive: Here’s a breakdown of the command and its components:
Cache your OpenAI responses with CachedGPT
Check out this github repo: https://github.com/theptrk/cachedgpt It’s a single file server that uses FastAPI to cache your calls to save on resources while you are developing. A hidden benefit, all responses return INSTANTLY on the second call.