Skip to content

Instantly share code, notes, and snippets.

View why-not's full-sized avatar

why-not why-not

  • San Francisco, CA
View GitHub Profile
@why-not
why-not / stateless.md
Last active January 2, 2026 00:08
AI as Protocol, Implications for Alignment.

AI as Protocol, Implications for Alignment.

Computation seems to have two flavors, and we have been using "algorithm" as the catch-all word for all procedures capable of simulation on a Turing machine. The word "protocol" naturally showed up when we covered network computation during my academic CS training. We never used "protocol" in any other context.

I think this is a mistake

Let's reserve the word "algorithm" only for a certain specific flavor. Think of a Grandmaster chess player, looking at the entire board with all the pieces and positions. What they do depends on this knowledge and a cloud of knowledge around previous moves by them and the opponent. This is a great prototype for when to invoke the word "algorithm". In their naive first pass, algorithms resist parallelization. They depend on the computation of a previous step, and they have to be done step by step.

In Distributed Systems coursework, the motivation typically begins with the need for speed. We start to accept "good enough" soluti

@why-not
why-not / nn.py
Created August 3, 2025 23:48
Simple neural network.
import numpy as np
# 1. Activation function (sigmoid)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
# 2. Derivative of sigmoid (used during training)
def sigmoid_derivative(x):
return x * (1 - x)
@why-not
why-not / get_system_config.py
Last active February 21, 2025 03:41
get system config (linux aws ec2)
import boto3
import requests
import psutil
import subprocess
from tabulate import tabulate
from colorama import Fore, Style, init
# Initialize colorama for colored headers
init(autoreset=True)
@why-not
why-not / nagbot.py
Created January 14, 2025 23:23
Access dropbox, read a folder's files, prompt AI to read it and find the task list, send it to a whatsapp acct.
"""
Monitor a Dropbox folder daily at 5 PM. For each PDF file, send its contents to OpenAI GPT-3.5
to generate a two-sentence summary/action. Collect all summaries and send them via WhatsApp.
NOTE: This example code is written in a functional style with separate functions for each step.
Fill in the auth tokens and any additional settings in the commented sections.
Dependencies you might need to install:
pip install dropbox openai PyPDF2 requests schedule

Add Sublime Text to OS X Context Menu

  • Open Automator
  • Create a new Service
  • Add a Run Shell Script action
  • Set input to Service receives selected files or folders in any application
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n $@
  • Set Pass input to as arguments
  • Save as Open in Sublime Text
@why-not
why-not / test.md
Created May 15, 2024 05:26
Markdown file.

My Observable Framework Document

Here is some text before the React component.

<div id="my-react-component"></div>

Here is some text after the React component.

@why-not
why-not / gist:6d3f60b0eff1151297d75899d767a52d
Last active May 5, 2024 18:22
Country's Border Page Rank
Rank Country Name PageRank
------------------------------------------------------------------------
1. Namibia 0.1569
2. China 0.0147
3. Russian Federation 0.0119
4. Brazil 0.0099
5. Germany 0.0085
6. France 0.0084
7. Zambia 0.0083
8. Saudi Arabia 0.0078
@why-not
why-not / shakespeare.txt
Created July 17, 2023 01:47
shakespeare
This file has been truncated, but you can view the full file.
First Citizen:
Before we proceed any further, hear me speak.
All:
Speak, speak.
First Citizen:
You are all resolved rather to die than to famish?
@why-not
why-not / get_stats_youtube.py
Created March 10, 2023 02:35
Code to get basic stats from videos in a given list of playlists (youtube)
import time
import pandas as pd
from googleapiclient.discovery import build
# Enter your API key here
api_key = "API KEY HERE"
# Create a service object for the YouTube API
youtube = build('youtube', 'v3', developerKey=api_key)
@why-not
why-not / useful_bash_functions.sh
Created November 2, 2022 21:45
useful bash functions backup.
function addpythonpath {
PYTHONPATH=$PYTHONPATH:`pwd`
sed -i '' '/^PYTHONPATH/d' ~/.bashrc
sleep .5
echo PYTHONPATH=$PYTHONPATH >> ~/.bashrc
}
# install yt-dlp first for this to work.
# streams youtube videos via VLC.
function ytvlc {