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 / 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.

JavaScript events can be broadly categorized into several types based on their origin or purpose. Here are examples of the different categories:

1. User-Generated Events

These events are triggered by direct user interaction with the webpage.

  • onclick: Triggered when a user clicks on an element.
    document.getElementById("myButton").onclick = function() {
        alert("Button clicked!");
    };

This question revolves around a variety of concepts commonly used in web development, particularly within the context of frameworks like Next.js. Each term addresses different aspects of optimizing web applications for performance, loading speed, and user experience. Here's a detailed breakdown of the terms:

1. Code Splitting

  • What it is: Code splitting is a technique where the application code is split into smaller chunks that can be loaded on demand, rather than loading the entire codebase in one go. This is often used in conjunction with dynamic imports.
  • Purpose: Improves the initial load time of an application by only loading the necessary code for the initial page or view, and loading other parts of the code when needed.

2. Streaming

  • What it is: Streaming in the context of web development, particularly in frameworks like React, refers to the ability to send parts of the HTML to the client as they become available, rather than waiting for the entire page to be g