Skip to content

Instantly share code, notes, and snippets.

" Basic settings
set nocompatible " Disable compatibility with old vi
filetype on " Enable filetype detection
filetype plugin on " Enable filetype-specific plugins
filetype indent on " Enable filetype-specific indentation
set tabstop=4 " Number of spaces a tab counts for
set shiftwidth=4 " Number of spaces for indentation
set expandtab " Use spaces instead of tabs
set autoindent " Auto indent new lines
@buckmaxwell
buckmaxwell / downloader.py
Created December 7, 2023 18:34
AI Research Paper Downloader
import csv
import requests
import glob
import time
import os
import hashlib
from urllib.request import urlretrieve
from PyPDF2 import PdfReader
from PyPDF2.errors import PdfReadError
@buckmaxwell
buckmaxwell / babysitter_success_progress_groups.sql
Created September 26, 2022 15:13
Get Common Sitter Groups From BSP
-- users in city without complete profile
with city as (
select poly from sitter_area area where area.name = 'Cincinnati'
)
select u.id, u.first_name, u.last_name from sitter_user u
join sitter_babysitter b on b.user_id = u.id
join sitter_babysittersuccessprogress bsp on bsp.babysitter_id = b.id
join sitter_address a on a.user_id = u.id and ST_WITHIN(a.point, (select poly from city))
where bsp.completed_profile is null
python-dispatch==0.2.0
python-rtmidi==1.4.9
websocket-client==1.3.3; python_version >= "3.7"
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
provider "aws" {
@buckmaxwell
buckmaxwell / testing_grafana_number_of_messages_before_phone_number.sql
Created December 8, 2021 19:19
Testing for sql query, number of messages exchanged before sharing phone number(s)
/* My db is clean -- all the messages just say 'Test', this is my starting point */
select * from sitter_message;
-- Threads longer than 1 message
select thread_id, l from (
select message_thread.thread_id, jsonb_agg(message_thread.added_at order by message_thread.added_at) l from
(
with sitter_ids as (select user_id id from sitter_babysitter),
messages_w_context as (
select m.*, (case when sender_id in (select id from sitter_ids) then true else false end) sender_is_sitter
SELECT
l
FROM (
SELECT
jsonb_agg(score ORDER BY added_at) l
FROM
sitter_jobscorehistory
GROUP BY
ongoing_request_id) tab1
WHERE
@buckmaxwell
buckmaxwell / pizza.py
Last active September 28, 2020 11:04
Cassidoo problem of the week 28.09.2020
# Given an array of people objects (where each person has a name and a number
# of pizza slices they're hungry for) and a number for the number of slices
# that the pizza can be sliced into, return the number of pizzas you need to
# buy.
import math
def gimme_pizza(people, slices_per_pie):
if people and slices_per_pie > 0:
@buckmaxwell
buckmaxwell / asteroids.py
Created September 22, 2020 13:26
2020.09.21 problem of the week
# Given an array of integers representing asteroids in a row, for each
# asteroid, the absolute value represents its size, and the sign represents its
# direction (positive = right, negative = left). Return the state of the
# asteroids after all collisions (assuming they are moving at the same speed).
# If two asteroids meet, the smaller one will explode. When they are the same
# size, they both explode. Asteroids moving in the same direction will never
# meet.
def asteroids(a):
@buckmaxwell
buckmaxwell / app.py
Created August 31, 2020 21:52
2020.08.31
#!/usr/bin/env python3
def stock_buy_sell(tst):
"""Given an array of numbers that represent stock prices (where each
number is the price for a certain day), find 2 days when you should buy
and sell your stock for the highest profit."""
i = len(tst) - 1
high_idx, low_idx = i, i