Skip to content

Instantly share code, notes, and snippets.

View aholmes's full-sized avatar

Aaron Holmes aholmes

View GitHub Profile
@aholmes
aholmes / robinhood-cost-basis.js
Last active March 27, 2021 21:42
Get your cost basis from you Robinhood order history page at https://robinhood.com/account/history?type=orders
/*
Scroll all the way down on https://robinhood.com/account/history?type=orders
Paste this into the dev console
`totals` holds your overall cost basis for each position you've held
Do note that this is just a quick bang out and likely isn't 100% correct
*/
const headers = Array.from(document.querySelectorAll('[data-testid="rh-ExpandableItem-buttonContent"]')).map(e => e.querySelectorAll('h3, h3 ~ span'))
const action_regex = /(.+?) (Market|(Stop )?Limit|(\$\d+ (Call|Put) (\d+\/\d+\/\d+))) (Buy|Sell)/
@aholmes
aholmes / Async_Sync_Performance_comparison.cs
Created July 15, 2016 16:00
A comparison of performance between async/sync in C#
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
namespace AsyncPerf
{
class Program
{
const int MAXRUNS = 10000000;
@aholmes
aholmes / Program.cs
Last active February 29, 2016 23:43
Comparison of FP and OOP approaches to benchmark a simple operation. https://www.reddit.com/r/javascript/comments/48alyu/functional_programming_for_javascript_people/d0inhqq
using System;
using System.Diagnostics;
using System.Linq;
namespace ConsoleApplication3
{
class Program
{
static int add(int x , int y)
{
// ==UserScript==
// @name Remove Custom Subreddit Themes
// @namespace http://aaronholmes.net/
// @version 0.1
// @description Remove custom subreddit themes from every subreddit
// @author Aaron Holmes
// @match https://www.reddit.com/r/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
@aholmes
aholmes / trampoline.js
Created May 9, 2015 06:20
Trampoline (indirect jump) implementation in TypeScript
var Trampoline = (function ()
{
function Trampoline(func, baseConditionReachedFunc)
{
var _this = this;
this.func = func;
this.baseConditionReachedFunc = baseConditionReachedFunc;
if (typeof func !== 'function') throw new Error('Wrong type');
@aholmes
aholmes / print_ascii_art.js
Last active January 17, 2022 13:44
Prints ASCII art in your console.
var art=' :.+8.\n\
I=.$= O\n\
7O?7D?O~I$\n\
,+Z?+OI+:77\n\
~Z+?OO$OO7I\n\
.IOD?=$ZZO,\n\
OI~IZ+~8=,\n\
DDDDDDDDDDDDDDDDDDDD DDDD8 8DDDDDDDDDDDDDDDDDDDDD 7Z~+Z+$7D+?\n\
DDDDDDDDDDDDDDDDDDDD8 DDDD8 8DDDDDDDDDDDDDDDDDDDDD =$II$Z~IZ+\n\
DDDD8 DDDDD DDDD8 DDDDD ?$:==:~$O\n\
@aholmes
aholmes / while_loop_comparisons.c
Created February 17, 2015 01:28
Benchmarks of different ways to calculate the end parameters of a while loop.
#include <stdio.h>
#include <conio.h>
#ifdef WIN32
#include <windows.h>
double get_time()
{
LARGE_INTEGER t, f;
QueryPerformanceCounter(&t);
@aholmes
aholmes / T-Mobile-925.xml
Created February 14, 2015 04:46
Phone registry information for the Nokia 925 on T-Mobile.
<RegistryInformation
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<DeviceUpdateKey>
<KeyName>Software\Microsoft\Windows\CurrentVersion\DeviceUpdate</KeyName>
<Subkeys>
<RegistryKey>
<KeyName>Software\Microsoft\Windows\CurrentVersion\DeviceUpdate\Agent</KeyName>
<Subkeys>
<RegistryKey>
<KeyName>Software\Microsoft\Windows\CurrentVersion\DeviceUpdate\Agent\Engine</KeyName>
@aholmes
aholmes / load_stylesheets.js
Created February 6, 2015 18:18
Load stylesheets after DOM render
var cb = function ()
{
var s = document.querySelector('head style:last-of-type');
['/path/to/stylesheet/one.css','/path/to/stylesheet/two.css']
.forEach(function (v)
{
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = v;
s.parentNode.appendChild(l, s);
});
@aholmes
aholmes / delete_posts.js
Created February 1, 2015 22:46
Delete old reddit posts
// Change this to the URL of your profile where you'd like to start deleting posts.
var startUrl = 'http://www.reddit.com/user/YOUR_USER_NAME/?count=100&after=WHATEVER_THE_TAG_IS';
function reload(cb)
{
var newdoc=undefined;
$.ajax(startUrl).success(function(data)
{
newdoc=$(data);