Skip to content

Instantly share code, notes, and snippets.

View branw's full-sized avatar
🐠
<º)))><

Brandon W branw

🐠
<º)))><
View GitHub Profile
@branw
branw / _robofidelity.md
Last active October 12, 2024 00:18
Semi-automated portfolio contribution rebalancer for Fidelity Investments (last updated April 2024)

robofidelity

A bookmarklet for semi-automating ETF and Mutual Fund purchases through Fidelity.

  • Distributes your contribution across all positions to best achieve your desired portfolio
    • This is in contrast to traditional rebalancing, which involves selling shares to achieve a balanced portfolio
  • Assumes that cash-to-invest has already been transfered into the core positions of relevant accounts
  • Ignores non-brokerage and non-Fidelity accounts

Usage

@branw
branw / README.md
Last active June 25, 2024 23:01
Finding the most annoying Discord emoji to use for TTS

By Duration

Duration (s) Description
1.28 backhand index pointing down medium-dark skin tone
1.28 backhand index pointing left medium-dark skin tone
1.27 backhand index pointing right medium-dark skin tone
1.26 backhand index pointing down medium-light skin tone
1.25 backhand index pointing left medium-light skin tone
1.25 person playing water polo medium-dark skin tone
@branw
branw / disco_logger.py
Created September 24, 2020 01:46
Logs all text messages and metadata in a Discord channel
import requests
import json
"""
Visit https://discord.com/, go to the Network tab of your Developer Tools, and
then open a channel. Find the latest request that looks like:
GET https://discord.com/api/v8/channels/12345678/messages?limit=50
"12345678" is the CHANNEL_ID
@branw
branw / gta_car_value_inflator.cpp
Created September 2, 2020 23:23
Adjust GTA 5/Online car values while on the Los Santos Custom's Sell Vehicle screen (GTA 1.50)
#include <Windows.h>
#include <iomanip>
#include <iostream>
#include <optional>
#include <psapi.h>
#include <tlhelp32.h>
DWORD find_process_by_name(const std::wstring &processName) {
PROCESSENTRY32 process_info;
process_info.dwSize = sizeof(process_info);
@branw
branw / npraytrace.cpp
Created May 21, 2020 17:39
Basic C++17 ray-tracer that renders onto Notepad's multiline edit control
#include <Windows.h>
#include <iostream>
#include <sstream>
#include <tuple>
#include <optional>
#include <cmath>
#include <string>
#include <thread>
#include <chrono>
@branw
branw / cat_facts.py
Created May 11, 2020 18:23
Old TextNow API and Cat Fact SMS bot (Dec. 2018) -- current APIs use reCaptcha (for web/Electron app) and SafetyNet (Android app)
from datetime import datetime, timedelta
from fuzzywuzzy import fuzz
import textnow
import random
import time
def matches(*accepted):
for value in accepted:
if fuzz.partial_ratio(text, value) > 80:
return True
@branw
branw / app.py
Created April 27, 2020 17:40
Web app interface for scraping Chegg textbook solutions (Sept. 2018)
import requests
from requests.auth import HTTPBasicAuth
from pprint import pprint
import secrets
import uuid
from urllib.parse import urlparse
from flask import Flask, jsonify, render_template, request, abort, redirect
from collections import deque
s = requests.Session()
@branw
branw / scrape_chegg.py
Last active September 14, 2024 19:48
Chegg textbook solutions scraper (Sept. 2018) -- exploited client-side enforcement of trial mode on old Android app (hardcoded account is now deleted)
import requests
from requests.auth import HTTPBasicAuth
from pprint import pprint
import secrets
import uuid
from urllib.parse import urlparse
from collections import deque
import pickle
import sys
@branw
branw / scrape_virdocs.py
Last active January 19, 2023 21:15
RedShelf/Virdocs digital content scraper (Sept. 2018) -- requires authentication cookies; downloaded images can be trivially combined into a PDF and OCR'd
from mimetypes import guess_extension
from urllib.parse import urlparse
from os.path import splitext
import requests
import pathlib
import pickle
# 6-digit ID from book URL (/api/v1/book/<BOOK_ID>)
BOOK_ID = REDACTED
# Cookies from request header
@branw
branw / decode_example.js
Created March 24, 2020 14:13
Virginia Tech University DataCommons API payload encoding scheme
// from https://udc.aie.vt.edu/api/irdata/College/
var encoded = "H4sIALK1el4C/21TTW/aQBD9KysOPYWWz6b0RgkEpKSg8nGpomqzHsxI9m40XqOiqv89M7vGAeSjPe+9ffNm5l+rMAfIdev779bEZRmk8MfqHFp39adxCbRe7lqJ9gKrccrt1TglNGXmSwKlbaKecA9qbRCsgYI1Ol1mXjPIHNCDqSlbetVWrX2ZYKT0AmWl87cMrbqg/igLtFAEUP9Wd2pTLgKhTaU+DPWF9UAVSP5+vWU94SuQztiVL4KbeZmLm4sO7m85VVFq325rO/BiQdNJPUOChi0JbnSL+6m5f373FxSuJH4pPD61RyRnc7CeWd1OYD0AG4pWSVPMqBtj3aEBtSIoMGFKm0XRWVad6Df0QT3lH4zvDQJ++hdM6fEIapzkaLHwFCiCiIGt6bO6Vg3GVuSOrhBTvRhhXZZf901mlqUn0OagPqkwBXs2N97vNZJ00Yvx7TYz9YDEK+HocsxnJCtMnPUk6ZHQRk3vjZOj5qlU2Q0aA1rYvaM8GFEbMAfrMpeeBN5rgstOSgIfjgf95qdvwhwMmmA8a9C8/QIYNgFmvDjcQkh8MlsKLqb9SDoptZfLOjiXSaEpcw4qLAs3qbY2AUrPvGlSmtpctYxM4A1sby3vAxXoT2pW2kS6HFUBT5bP7Vr8i0hzcV4lu+EtI8wkyuhKRnex890Y6dxZxyP8uMFeFeFKzUFn/lDfWmj7air9GsrS8TDre+HysHMuS8Mrl6E5cQSP7ijbFi90GN1eNLmw6FHLEQQNdvny/x260Zp9BQUAAA==";
var decoded = JSON.parse(pako.inflate(atob(encoded), {to: "string"}));
/*
{
"schema": ["College_name", "College_code"],
"data": [
["College of Agriculture