Skip to content

Instantly share code, notes, and snippets.

@benjamin-james
benjamin-james / Positions.csv
Created September 27, 2025 16:21
Fidelity portfolio auto-rebalancing by only buying
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 16 columns, instead of 1 in line 4.
Account Number,Account Name,Symbol,Description,Quantity,Last Price,Last Price Change,Current Value,Today's Gain/Loss Dollar,Today's Gain/Loss Percent,Total Gain/Loss Dollar,Total Gain/Loss Percent,Percent Of Account,Cost Basis Total,Average Cost Basis,Type
Z00000000,Roth IRA,CORE**,FDIC-INSURED DEPOSIT SWEEP,,,,$7000.00,,,,,100.00%,,,Cash
Z00000000,Roth IRA,FSKAX,FIDELITY TOTAL MARKET INDEX FUND,,,,$10000.00,,,,,62.5%,,,Cash
Z00000000,Roth IRA,FTIHX,FIDELITY TOTAL INTERNATIONAL INDEX FUND,,,,$6000.00,,,,,37.5%,,,Cash
"Sample text and legal disclaimer"
"Second legal disclaimer"
"Date downloaded Sep-27-2025 12:00 p.m ET"
@benjamin-james
benjamin-james / preprocess_atac.py
Created September 12, 2024 17:42
6.780 Fall 2024 Problem Set 1 preprocessing
#!/usr/bin/env python3
def preprocess_atac(h5ad, metadata_tsv, cell_metadata_tsv, peak_bed_list, min_idr_quantile:float=0.9, min_tss:float=1., level:int=6, **kwargs):
import os
import gzip
import tempfile
import requests
from tqdm.auto import tqdm
import numpy as np
import pandas as pd
@benjamin-james
benjamin-james / conda_create.sh
Last active January 25, 2024 20:51
Conda environment
#!/usr/bin/env bash
### Use this file to download the newest benj conda environment
### Usage: sbatch conda_create.sh my_env_name
### where my_env_name is the name of the environment you want to create
#SBATCH -p kellis
#SBATCH --nice=10000
#SBATCH --mem=20G
#SBATCH -J conda_env
which module && module load r/4.2.0 ## for ./configure
@benjamin-james
benjamin-james / Makefile
Created August 26, 2016 20:24
Sample makefile
TARGET_EXEC ?= a.out
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
#include <stdio.h>
#include <string.h>
#ifndef _LOG_STRLEN
#define _LOG_STRLEN 1024
#endif
/*
* to be implemented by the client
@benjamin-james
benjamin-james / emacs-patch.diff
Created October 1, 2015 15:51
emacs patch to load files faster
diff --git a/src/lread.c b/src/lread.c
index e1a4b33..4f17e39 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -467,7 +467,7 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
}
block_input ();
- c = getc (instream);
+ c = getc_unlocked (instream);
#include <stdio.h>
#define windows return
#define google puts
#define chrome "hello world\n"
#define twitter int
#define facebook main
twitter facebook()
{
google(chrome);
@benjamin-james
benjamin-james / PKGBUILD
Created June 18, 2015 01:31
gitd PKGBUILD v3
# Maintainer: Benjamin James <benjamin-james@utulsa.edu>
pkgname=gitd
pkgver=0.3.0
pkgrel=1
pkgdesc="A way of notifying you of git commits"
arch=('any')
url="https://github.com/benjamin-james/gitd"
license=('GPL3')
install='gitd.install'