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
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
@Darkflib
Darkflib / deadline.md
Created September 4, 2024 13:37
Excerpt from 'the deadline'

What Kenoros proposed to teach the eighteen teams was a technique he called Last Minute Implementation, and it scared the hell out of Tompkins. The scheme involved deferring coding as long as possible, spending the middle forty percent or more of the project doing an elaborate, exaggeratedly detailed low-level design, one that would have perfect one-to- one mappings to the eventual code. It was this time spent on design that was supposed to result in a much reduced need for debugging.

from pyspark.sql import SparkSession
# Initialize a Spark session
spark = SparkSession.builder \
.appName("Read SQLite with PySpark") \
.config("spark.jars", "/path/to/sqlite-jdbc-3.34.0.jar") \
.getOrCreate()
# Define the JDBC URL for the SQLite database
jdbc_url = "jdbc:sqlite:/path/to/example.db"

Here's a roadmap split into Backend Technology and Backend Software Engineering, aimed at providing a structured path for someone new to the field.

Backend Technology

This section covers the core technologies that power backend systems.

  1. Fundamentals of Backend Development
    • Client-Server Model: Understand how the client-server architecture works, the role of HTTP/HTTPS, and how requests/responses are managed.
    • DNS and Networking Basics: Learn how DNS works, IP addressing, TCP/IP, and basic networking principles that affect backend services.