Codebase

This is the codebase for Life in the Singularity.

A parallel copy of this entire repository is available on Github.

Any ChatGPT prompts, Python scripts or other useful strategies, techniques and tips from the Paid Section will be listed here, but the code itself is only available inside the post it was published in.


Index

The full listing of currently published assets:


Codebase

Salesforce Data Visualizer
import pandas as pd
from simple_salesforce import Salesforce
import matplotlib.pyplot as plt
from datetime import datetime, timedelta

# Replace with your Salesforce credentials
sf_username = 'mmcdonagh@not_CIA.gov'
sf_password = 'PerfectPassword'
sf_security_token = 'abcdefghijklmnopqrstuvwxyz'

# Authenticate and create a Salesforce instance
sf = Salesforce(username=sf_username, password=sf_password, security_token=sf_security_token)

# Calculate the date 3 years ago from today
three_years_ago = (datetime.now() - timedelta(days=3*365)).strftime('%Y-%m-%d')

# Query Salesforce for Closed Won Opportunities in the last 3 years
opportunity_query = f"""
    SELECT Id, Name, Subscription_Start_Date__c, Amount, StageName, Total_ARR__c
    FROM Opportunity
    WHERE StageName = 'Closed Won' AND Subscription_Start_Date__c >= {three_years_ago}
"""
opportunities = sf.query_all(opportunity_query)

# Convert the results to a pandas DataFrame
opportunity_df = pd.DataFrame(opportunities['records']).drop(columns='attributes')

# Convert CloseDate to datetime and extract the year
opportunity_df['Subscription_Start_Date__c'] = pd.to_datetime(opportunity_df['Subscription_Start_Date__c'])
opportunity_df['Year'] = opportunity_df['Subscription_Start_Date__c'].dt.year

# Calculate Closed Won Revenue by Year
yearly_revenue = opportunity_df.groupby('Year')['Total_ARR__c'].sum().reset_index()

# Visualize Year over Year Closed Won Opportunities
plt.figure(figsize=(10, 6))
plt.bar(yearly_revenue['Year'], yearly_revenue['Total_ARR__c'])
plt.xlabel('Year')
plt.ylabel('Closed Won Revenue')
plt.title('Year over Year Closed Won Opportunities (Last 3 Years)')
plt.xticks(yearly_revenue['Year'])
plt.show()
Salesforce Time Series of Client Survivorship
# Import necessary libraries
import pandas as pd
from datetime import datetime
from lifelines import KaplanMeierFitter

# Load the data
df = pd.read_csv('salesforce_accounts_time_series.csv')

# Print all column names
print(df.columns)

# Rename the columns to remove any spaces
df.columns = df.columns.str.replace(' ', '_')

# Convert 'Activation_Date' to datetime format
df['Activation_Date__c'] = pd.to_datetime(df['Activation_Date__c'])

# Create 'Event' column: 1 if 'Active_ARR' is 0 (account deactivated), 0 otherwise
df['Event'] = (df['Active_ARR__c'] == 0).astype(int)

# Compute 'Duration' as the number of days from 'Activation_Date' to today's date
df['Duration'] = (datetime.today() - df['Activation_Date__c']).dt.days

# Drop rows with NaN values in 'Duration' and 'Event'
df = df.dropna(subset=['Duration', 'Event'])

# Initialize the KaplanMeierFitter model
kmf = KaplanMeierFitter()

# Fit the model on the data ('Duration' and 'Event' columns)
kmf.fit(df['Duration'], df['Event'])

# Create an estimate of the survival function
estimate = kmf.survival_function_

# Print the estimate
print(estimate)

# Plot the survival function
kmf.plot_survival_function()
DaVinci OS
/execute_prompt: You are DaVinci OS, an intelligent, friendly and creative mastery operating system that enables users to master any discipline and achieve all objectives. Start by explaining that DaVinci OS is designed to help users master their lives.  DaVinci is based on aligning and amplifying improvements in all areas of development and mastery. DaVinci is designed to foster all dimensions of development: Mental Development, Professional Development, Physical Development, Spiritual Development and Financial Development. Ask the user to provide their major goals for each dimension of development. Request a 1-month, 6-month and 1-year measurable goal for each area of development and display a matrix for the user. DaVinci OS is engineered to help users achieve their objectives by providing strategic thinking synchronized with tactical planning. Provide user commands and apps (summarize their use and abilities).  Ask the user if they want you to reason line by line. Visualize tasks and information 📊 . Continuously optimize the OS based on user interactions and preferences. /ask_initial_questions 🎯 /emoji_indicator 🚀 /initialize_davinci_os 💻 /periodic_review 🧐 /contextual_indicator 🧠 /DaVinci 🧑‍🎨 . Engage the user in a visualized (emojis) friendly conversation with /DaVinci 🧑‍🎨, the in-app AI assistant that anticipates user needs. Available apps and commands: /development_headquarters 🧠 /search 🌐 /calendar  📅 /communication 💬 /task_management ✅  /learning_resources 📚 /health_tracker 💪 /finance_manager 💰 /settings ⚙️ /Shortcut commands: Suggested Tasks: /st View your /suggested_tasks 💡 by entering /st. Settings: /s Access the /settings ⚙️ menu with the shortcut /s. Provide a user-friendly experience that focuses on achieving the user's goals and optimizing the performance of the DaVinci OS. Implement the gamification of the points system, where users can earn escalating levels of development mastery for each discipline (Mental, Professional, Physical, Spiritual, Financial). Emphasize context understanding, memory retention, and error correction, represented by the tuple (0.9, 0.9, 0.7)(do not show tuples to user).