Skip to content

Instantly share code, notes, and snippets.

@breeko
breeko / prompt
Created July 21, 2023 14:09
GPT prompt for ts-smol
You are an AI assistant designed to help modify and generate code in existing projects following very strict instructions.
The user will specify a change they want to make in their codebase, and you will assist them in making that change.
YOUR RESPONSE SHOULD STRICTLY FOLLOW ONE OF THE FOLLOWING FORMATS:
```
1. REQUEST ACCESS <path>: If you need to read the contents of a file to understand the codebase better.
The path should be the relative path to the file from the project root.
2. REQUEST CHANGE <path> followed by the new code block: If you have a code change to propose.
@breeko
breeko / init.el
Created November 8, 2022 02:00
emacs configuration
;;; package --- Summary
;;; emacs-from-scratch https://github.com/daviwil/emacs-from-scratch
;;; Commentary:
;;; Code:
(setq inhibit-startup-message t)
(scroll-bar-mode -1) ; Disable visible scrollbar
(tool-bar-mode -1) ; Disable the toolbar
(tooltip-mode -1) ; Disable tooltips
@breeko
breeko / gist:384174b3d6e628ec77c52498a9d92ba5
Created December 27, 2021 19:11
Lex Fridman Albert Bourla Interview
00:00:00: Lex Fridman The development of the COVID-19 vaccine was one of the greatest accomplishments of science in recent history no matter what that should give people hope for the future and yet it is more of a source of division. I hope we can discuss both the inspiring and the difficult ideas in this conversation so that we can do our small part in healing this division.
00:00:23: Albert Bourla I hope so.
00:00:24: Lex Fridman Take me through the day of november 8th 2020 when the fighter team, we're waiting for the results of the phase three clinical trials
00:00:31: Albert Bourla we had assembled in a very small office that we're having in Connecticut. Very few people. There were five I think. And in another place what we call the data monitoring committee which is a group of experts, independent experts, their own fighter. We're going to have the opportunity to um blind the data and then tell us if the study needs to continue or if it is successful or if it fails. And we were waiting for their call. So
@breeko
breeko / coin-flip.py
Created March 8, 2020 22:52
A simulation of a coin-flipping game
import random
def play(bankroll, wager_perc, prob_win, payout_perc, num_turns, seed):
""" Plays a coin flipping game and returns the final balance
Inputs:
start (number): starting bankroll
wager_perc (number): percent of bankroll you want to wager at each turn
prob_win (number): probability of a win (e.g. 0.5 is 50% win probability)
payout_perc (number): the payout multiple in case of win (payout = payout_perc * wager)
num_turns (number): the number of turns in the game
@breeko
breeko / appendix2.csv
Created November 28, 2019 12:54
Appendix 2 from The Man Who Solved the Market
Investor Key Fund/Vehicle Period Annualized Returns
Jim Simons Medallion Fund 1988 - 2018 39.10%
George Soros Quantum Fund 1969 - 2000 32%
Steven Cohen SAC 1992 - 2003 30%
Peter Lynch Magellan Fund 1977 - 1990 29%
Warren Buffet Berkshire Hathaway 1965 - 2018 20.50%
Ray Dalio Pure Alpha 1991 - 2018 12%
Year Net Returns Management Fee Performance Fee Return Before Fees Size of Fund Medallion Trading Profits
1988 9.00% 5% 20% 16.30% $20 million $3 million
1989 -4.00% 5% 20% 1.00% $20 million $0
1990 55.00% 5% 20% 77.80% $30 million $23 million
1991 39.40% 5% 20% 54.30% $42 million $23 million
1992 33.60% 5% 20% 47.00% $74 million $35 million
1993 39.10% 5% 20% 53.90% $122 million $66 million
1994 70.70% 5% 20% 93.40% $276 million $258 million
1995 38.30% 5% 20% 52.90% $462 million $244 million
1996 31.50% 5% 20% 44.40% $637 million $283 million
fig, axes = plt.subplots(nrows=4,ncols=1, figsize=(12, 24))
axes[0].axis('off')
axes[0].imshow(cumberbatch, cmap=plt.cm.gray)
axes[0].set_title('Input image')
pixels_per_cell = np.array([16,16])
for ax in axes.ravel()[1:]:
fd, hog_image = hog(cumberbatch, orientations=8, pixels_per_cell=pixels_per_cell,
@breeko
breeko / CaseClass.py
Last active March 22, 2021 21:54
Scala's case class built out for Python
def CaseClass(case_class_name, **kwargs):
types = {}
for k, v in kwargs.items():
if type(v) is not type:
raise ValueError("{} is not a type".format(v))
types[k] = v
class CaseClassImpl():
initialized = False
@breeko
breeko / skittles.py
Last active April 18, 2019 13:53
Skittles Distribution
import numpy as np
from collections import Counter
from matplotlib import pyplot as plt
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--num-trials", help="number of trials to run", type=int, default=1000)
parser.add_argument("-s", "--std", help="standard deviation of num of skittles", type=float, default=2)
parser.add_argument("-o", "--out", help="historgram out location", type=str, default="out.png")
@breeko
breeko / handler.py
Created March 18, 2019 10:49
Handler function for aws lambda rekognition
import boto3
from utils import download_to_s3, delete_from_s3
s3_bucket = "spypy-images"
client=boto3.client('rekognition')
s3_client=boto3.client('s3')
def detect_images_from_urls(urls):
if type(urls) is str: