Skip to content

Instantly share code, notes, and snippets.

‏‏ ‏ ‏‏‏‏ ‏ ‏‏

Stephen Levi O'Neil Stephen-ONeil

‏‏ ‏ ‏‏‏‏ ‏ ‏‏
View GitHub Profile
Stephen-ONeil /
Last active May 1, 2019 22:39
Quick and dirty bash script for running a multi-find-and-replace on a csv (using another csv containing mapping definitions)
# Takes a mapping csv with the first column containing the values to replace-with and the 2nd to nth columns containing the patterns
# to replace-by. The target document is matched by cell against each pattern, and a cell that matches is replaced in the output (mfr_output.csv)
# by the replace value corresponding to the first pattern it matches on.
# Known issues:
# Seems to be bad at matching certain accented chars, encoding issues? Maybe deburr before matching if you have that problem
Stephen-ONeil / bandcamp_purchase_history_total.js
Created March 17, 2019 04:39
Morbidly curious about your lifetime total spending on Bandcamp? I was. To get an answer, I wrote some JS that I can run in my browser's dev console to extract that info from Bandcamp's purchase history page.
View bandcamp_purchase_history_total.js
// Don't go pasting scripts from internet strangers in your dev consoles, ok?
Procudeure (for my own sake, because YOU wouldn't go and paste scripts from a stranger in to your dev console, right?):
1) visit<username>/purchases
2) run the code under the SETTING UP THE PAGE heading in the dev tool's console
3) run the code under the ACTUALLY SCRAPING heading in the dev tool's console
optional: change "CAD" argument on final line to alternate desired currency code
4) raise your eyebrows at the output (and keep in mind that you're applying current
conversion rates retroactively, and thus getting a skewed result)