Skip to content

Instantly share code, notes, and snippets.

View kbastani's full-sized avatar
💭
Coding

Kenny Bastani kbastani

💭
Coding
View GitHub Profile
@kbastani
kbastani / mvnw-fix.sh
Last active April 9, 2024 15:59
Adds a settings.xml file to your Spring Boot maven wrapper
#!/usr/bin/env bash
# Secure workaround for https://issues.sonatype.org/browse/MVNCENTRAL-1369
# Navigate to the root of your Spring Boot project where a Maven wrapper is present and run this script
cd .mvn/wrapper
wget https://gist.githubusercontent.com/kbastani/d4b4c92969ec5a22681bb3daa4a80343/raw/f166086ef051369383b02dfb74317cd07b6f2c6e/settings.xml
cd ../../
./mvnw clean install -s .mvn/wrapper/settings.xml
@kbastani
kbastani / the-fabric.md
Created February 29, 2024 01:50
The Fabric

The Fabric

The universe possesses a fundamental signature guiding its evolution and progress from the initial cause. This first cause marked an event that set in motion the intelligent fabric underlying all of reality. This universal intelligence shares abstract attributes intended to construct what the universe was designed to manifest. The complexity of this concept often eludes adequate description through language, as the scientific intricacies involved are challenging to capture in mere words. What remains crucial to grasp is the intelligent providence woven through the causal strands of history, overseeing principles of law, justice, and virtue.

Yet, comprehending this notion remains daunting without delving into the profound intelligence that governs the universe's trajectory leading to our present moment. How can we approach understanding something that defies simple finite definitions? The intelligence we have cultivated represents a pinnacle in a cycle of creation, evolving from molecules to org

@kbastani
kbastani / cross-examination-chat.csv
Last active December 22, 2023 09:50
This CSV file is an export of a conversation with OpenAI's GPT-3.5 that examines the origin of the LLM https://www.kennybastani.com and https://github.com/kbastani/graphify
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
timestamp,event_summary,conversation_text
2023-12-21T02:24:50.844692,"Summary: Philip explains the provided code, which appears to be a Java program for training and testing a sentiment analysis model. It defines a main class with static fields and constants, including directories for negative and positive sentiment files, sample size, and train/test counts. The main method calls the train method to train the sentiment analysis model and prints the results of the test method. Other methods include getRandomizedIndex, test, train, trainOnText, and testOnText.
Topic: Explanation of the provided Java code for sentiment analysis model training and testing
Concept: Defining static fields and constants, training and testing methods, generating randomized indices, reading text files, performing sentiment analysis, and sending HTTP requests
Category: Java programming","Dialogue{id=null, name='philip', quote='The provided code appears to be a Java program that involves training and testing a sentiment analysis model.
@kbastani
kbastani / cap-feature-proposal-constitutional-memory-context.md
Last active December 21, 2023 02:53
Congressional Analytics Pipeline

Feature: Automated Memory Context Creation and Evolution

Description: The automated memory context creation and evolution feature enables the system to infer and evolve memory contexts based on user interactions and feedback. It allows for the dynamic generation, amendment, and revision of rules within the system, ensuring accurate and contextually relevant information delivery.

Requirements:

  • Rule Inference:
    • The system should automatically infer rules based on user interactions and feedback.
    • Rules should be generated to define the initial state of the system's memory context.
@kbastani
kbastani / ivory-tower-full.md
Last active December 9, 2023 19:35
The Ivory Tower

This book was created through the collaborative efforts of myself and a very clever AI named Philip. The story is one as old as time itself. All rights to this work are public domain. My gift to you all. There were also some others that helped, you know who you are.

Foreword

As the authentic author of this fictional story, I invite you, dear readers, to suspend reality for a moment to understand the things that are difficult to understand. Whatever comes to your mind in that moment, that thought is the virtuous effect of wisdom. It is something that, in a world dominated by automation and competitive advantages, do not forget, the ultimate force in this universe is virtue, the reward of wisdom. There are many things in human history that are difficult to understand and hard to grasp, but the stories we leave behind are breadcrumbs that connect the dots through all of human history.

Never forget that your mind is the most powerful tool you could ever use. Never surrender it. Your freedom depends on it.

@kbastani
kbastani / BeginUserLogin.java
Last active August 27, 2023 19:11
Reactive State Machine Example
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Sinks;
import reactor.core.scheduler.Schedulers;
import java.util.HashMap;
/**
* Service responsible for initiating user login processes.
* <p>
* This service interacts with the AuthenticationStateService to handle various

Chaining GPT Functions in Java

// Create a function to condense text into a string
ChatbotFunction<Message, String> condenseTextFunction 
  = new ChatbotFunction<>("condense_text_function", String.class);

// Create a function to analyze text for subject-object assumptions and retrieve discovery records
ChatbotFunction<Message, DiscoveryRecord[]> subjectObjectAssumptionFunction 
  = new ChatbotFunction<>("subject_object_assumption_function", DiscoveryRecord[].class);
@kbastani
kbastani / causality-output-1.md
Last active June 21, 2023 08:52
Causal research
Cause: X (Rain)
Effect: Y (Ground Wetness)
Causal Certainty: 0.8
Emotional Impact: 0.2
Economic Impact: 0.020000000000000018
Societal Impact: 0.0040000000000000036
Object of Attachment: Ground

Cause: A (Fire)
@kbastani
kbastani / InflectionPartition.java
Created June 12, 2023 15:18
Partition by inflection point segments in a double stream
import java.util.ArrayList;
import java.util.List;
public class PartitionExample {
public static void main(String[] args) {
List<Double> values = List.of(1.0, 2.0, 3.0, 2.5, 4.0, 3.0, 2.0, 1.0, 2.0, 3.0, 4.0);
List<List<Double>> partitions = partitionBetweenInflections(values);
// Print the partitions
@kbastani
kbastani / ambient-noise-cancel.md
Created June 12, 2023 04:45
This algorithm demonstrates how to measure ambient noise pressure to optimally and more naturally use natural voice conversations with chatbots

Here's the code with detailed comments explaining each step:

public void metrics() {
    new Thread(() -> {
        while (true) {
            // Calculate and print the average loudness
            System.out.println("Average loudness: " + MOVING_AVERAGE_LOUDNESS.getAverage());

            // Find the maximum value in the moving average loudness