Skip to content

Instantly share code, notes, and snippets.

View Darkflib's full-sized avatar
🏠
The real problem is not whether machines think, but whether men do.

Mike Preston Darkflib

🏠
The real problem is not whether machines think, but whether men do.
View GitHub Profile
@Darkflib
Darkflib / LICENCE.txt
Last active December 10, 2024 21:23 — forked from superboum/LICENCE.txt
Install Debian with Debootstrap + Grub EFI
MIT LICENSE
Copyright 2018 Quentin Dufour
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH

Here's a quick reference for Tmux, covering sessions, panes, and windows along with the command you mentioned.

Tmux Basics

  • Start a new session:
    tmux new -s <session_name>
  • Attach to an existing session:

tmux attach -t

import random
import os
def load_words():
# Get a random word from the system dictionary.
# Check if the file exists and is readable.
if not os.access('/usr/share/dict/words', os.R_OK):
return []
# Check if the file is not empty.
import pysmartthings
import asyncio
import logging
import os
import dotenv
import aiohttp
dotenv.load_dotenv()
# Enable default logging
@Darkflib
Darkflib / RAG.md
Last active November 6, 2024 13:25

Embeddings and dimensionality reduction in the context of RAG (Retrieval Augmented Generation).

Vector embeddings typically have many dimensions (e.g., 768, 1024, or 1536 dimensions depending on the model), but you're correct that they can often be compressed while maintaining much of their utility. Here's why and how this works:

  1. Primary Principles:
  • Embeddings encode semantic meaning across their dimensions
  • The dimensions aren't necessarily ordered by importance in their raw form
  • However, we can transform them to be ordered by importance
  1. Dimensionality Reduction Methods:
@Darkflib
Darkflib / test-st.py
Created October 26, 2024 22:57
smartthings test
import pysmartthings
import asyncio
import logging
import os
import dotenv
import aiohttp
dotenv.load_dotenv()
# Enable default logging

Can you explain what the following script does?

#!/usr/bin/env python3

import os
import signal
import subprocess
import sys
@Darkflib
Darkflib / adhd.md
Created October 21, 2024 18:18
ADHD

ADHD "superpowers" and how to leverage them.

  1. Introduction: People with ADHD have "secret superpowers" that can be unlocked and used to build successful lives.

  2. Superpower 1 - Broad Attention and Quick Connections:

    • People with ADHD have an abundance of attention rather than a deficit.
    • They can take in more external information at once.
    • This allows for quick connections and "aha" moments.
    • It's described as having a "sixth sense" or "ADHD intuition."
from langchain.llms import OpenAI
from langchain.callbacks.base import BaseCallbackHandler
# Example Callback Handler
class CustomCallbackHandler(BaseCallbackHandler):
def on_llm_start(self, serialized, prompts, **kwargs):
print("LLM is starting...")
print("Prompts:", prompts)
def on_llm_new_token(self, token, **kwargs):
@Darkflib
Darkflib / vsc-ext-man.bash
Created September 18, 2024 19:43
vscode ext manager
#!/bin/bash
# MIT License - [email protected]
vsc-ext-man() {
VSCODE_BINARY=${VSCODE_BINARY:-code}
COMMAND=$1
FILE=$2 # FILE is set if provided