Skip to content

Instantly share code, notes, and snippets.

View jspiro's full-sized avatar
:shipit:
const application:Application = Application(Application.application); // Sigh.

Jono Spiro jspiro

:shipit:
const application:Application = Application(Application.application); // Sigh.
View GitHub Profile
@jspiro
jspiro / README.md
Last active October 29, 2023 23:37
How I do my bitcoin taxes

TurboTax has no crypto support, it also doesn't support importing CSVs of transactions, and CreditKarma has no ability to import from financial institutions at all (so e.g. wealthfront is an instant dealbreaker for trying it). Square sends out terrible CSVs of transactions and does very little to help you report for the few bucks you made.

  1. Import transactions to https://app.koinly.io/transactions
  2. Set tax basis to LIFO, print https://app.koinly.io/reports/2019 to PDF
  3. Load https://app.koinly.io/transactions?page=1 and find the transactions JSON transfer in the Network tab, Copy as cURL
  4. In the terminal, paste this, and either remove the gzip line or pipe through gzip, do this for each page, e.g.:
curl 'https://api.koinly.io/api/transactions?page=1&per_page=20' \
    -XGET \
    -H 'Accept: application/json, text/plain, */*' \
@jspiro
jspiro / git-magic-trick.md
Last active July 23, 2020 09:13
Migrate repo AND select branches/PRs into a monorepo WITHOUT retaining history

Preparation

  • Source repo should have as many branches and PRs closed or merged as possible
  • Rest of PRs should be merged with master just before migration begins

Prepare the initial commit of the migrated repo (master)

  1. Archive source repo
  2. Go to target directory in monorepo
  3. Clone source repo into correctly named folder in monorepo
  4. cd to repo and make all necessary changes for migration to monorepo (e.g. renaming)
  5. Commit all changes INSIDE the cloned repo on local master (commit name doesn't matter, DO NOT PUSH)
@jspiro
jspiro / gist:729e64e451d05ba3ce655a34cfb43d2a
Last active June 16, 2020 22:32
horrific but working way to summarize file sizes in a directory for evaluating what's tracked by git lfs
$ find . -type f -name '*.*' |
sed 's/.*\.//' |
sort -u |
while read ext; do
(
gfind . -name "*$ext" -printf "%s\n" |
sed 's/$/+/' |
tr -d '\n'
echo 0
) | bc | tr -d '\n'
@jspiro
jspiro / dedupe.sh
Created May 18, 2020 09:34 — forked from tvwerkhoven/dedupe.sh
De-duplicate using APFS clonefile(2) and jdupes in zsh
#!/usr/bin/env zsh
#
# # About
# Since APFS supports de-duplication on block-level, it can be useful to
# manually de-duplicate your files if you've migrated/upgrade to APFS not
# using a fresh install.
#
# I've written this simple script with the aim to:
# - Be simple, easy to read and understand (for users to check)
# - Use native cp -c for de-duplication
@jspiro
jspiro / login-to-artifactory.sh
Last active May 13, 2020 06:22
CLI tool to log in to Artifactory NPM
#!/bin/sh
scope=company-name
any_scoped_package_name=secret_package
url=artifactory.company.com
repo=npm
cd "$(dirname "$0")" || exit
echo Please enter your email address:
read -r email
#!/bin/sh
sudo nvram StartupMute=%00
#!/bin/sh
grep pam_tid /etc/pam.d/sudo >/dev/null || echo auth sufficient pam_tid.so | cat - /etc/pam.d/sudo | sudo tee /etc/pam.d/sudo > /dev/null
@jspiro
jspiro / coffeelint.css
Created March 5, 2019 23:05
coffeelint.org snapshot 9/19
* {
padding:0;
margin:0;
}
html {
width:100%;
}
body {
@jspiro
jspiro / todo-count.sh
Created July 12, 2017 00:09
Generate CSV of TODOs by user in Git
#!/usr/bin/env bash
revs=$(git rev-list "$1" | wc -l | awk '{ printf "%d\n", $0 }')
revnum=0
ignores="--ignore todo-count.sh --ignore out.csv --ignore thirdparty --ignore govendor"
people=( "sarietta" "cjrd" "jspiro" "avi" )
echo "date,sha,file count,todo count,$(printf "%s," "${people[@]}")" > out.csv
while read -r rev; do
@jspiro
jspiro / .gitconfig
Created May 18, 2017 04:02
git aliases for managing autogenerated code
# autogen files are files with diff unset in .gitattribute
ls-check-attr-diff = "!git ls-files --exclude-standard --modified | git check-attr --stdin diff"
ls-autogen = "!git ls-check-attr-diff | grep 'diff: unset' | sed 's/: diff:.*//'"
ls-no-autogen = "!git ls-check-attr-diff | grep -v 'diff: unset' | sed 's/: diff:.*//'"
discard-autogen = "!git ls-autogen | xargs git checkout --"
add-autogen = "!git ls-autogen | xargs git add"
add-no-autogen = "!git ls-no-autogen | xargs git add"