Skip to content

Instantly share code, notes, and snippets.

View kmosher's full-sized avatar

Keith Mosher kmosher

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kmosher on github.
  • I am kmosher (https://keybase.io/kmosher) on keybase.
  • I have a public key ASDb4HbVeojgRFNa19eh-RNjILvRWNeATxwOnPA1WaAISwo

To claim this, I am signing this object:

@kmosher
kmosher / fix-etrade-csv.py
Last active April 16, 2019 05:07
Turns csv exports from etrade into sched D ready imports for TaxAct. This is of course provided with NO WARRANTY or guarantee that it is fit for any purpose. Use at your own risk
#!/usr/bin/env python
import csv
import sys
from pprint import pprint
with open(sys.argv[1]) as infile:
with open(sys.argv[2], 'wb') as outfile:
reader = csv.DictReader(infile)
writer = csv.DictWriter(outfile, ['Description', 'Date Acquired', 'Sales Proceeds', 'Date Sold', 'Cost', 'Adjustment Code', 'Adjustment Amount', 'Reporting Category'])
@kmosher
kmosher / wallpaper-tryiptych
Created October 6, 2016 23:20
Turn any image into a set of wallpapers to span multiple monitors
#!/bin/bash
display_height=1920
display_width=1200
display_count=3
bg=black
resolution="$(($display_count * $display_width))x$display_height"
convert "$1" -resize $resolution \
@kmosher
kmosher / keybase.md
Created July 7, 2016 23:25
keybase.md

Keybase proof

I hereby claim:

  • I am kmosher on github.
  • I am kmosher (https://keybase.io/kmosher) on keybase.
  • I have a public key whose fingerprint is FC98 08AE E9C9 F406 607D E40C 5152 BA66 67FD D423

To claim this, I am signing this object:

@kmosher
kmosher / pg_dumpall2git.py
Last active June 27, 2016 23:22
Turn a pg_dumpall file into a directory structure.
#!/usr/bin/env python
"""
Turns the output of pg_dumpall into a directory structure. The
format is intended to be suitable for committing to git.
The original pg_dumpall file can be reconstructed easily from the
TABLE_OF_CONTENTS file like so:
cd DUMP_DIR; cat $( <TABLE_OF_CONTENTS )
# Makes an image (namely this one: http://ksdenvironmental.co.uk/wp-content/uploads/2014/12/icon_shed.jpg) flash red and blue
# Creates a slack-friendly gif
#!/bin/bash
convert "$1" -fuzz '14%' -transparent white \
-gravity Center -crop 140x120-0-1 +repage \
-grayscale rec709luma \
\( +clone +level-colors red, \) \( -grayscale rec709luma +clone +level-colors blue, \) \
-delete 0 \
-morph 2 -set delay 15 \
#!/bin/zsh
set -e
setopt extendedglob
o_font=(--font /Library/Fonts/Impact.ttf)
o_pointsize=(--pointsize 42)
o_remote=(--remote "people.yelpcorp.com:public_html/dockercats/")
o_identity=(--identity "dockercats")
o_irc=(--irc)
o_tumblr=()
@kmosher
kmosher / style.css
Last active April 8, 2016 05:22
Positioning relative to perfect center with flexbox
body {
width: 100%;
height: 100%;
margin: 0;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
}
@kmosher
kmosher / gmail-label-rotate
Last active October 8, 2016 01:50
Gmail Bulk Deletion and Pruning
// A script for bulk deleting emails in the background and preventing future buildup
// Allows you to continue to use your gmail inbox while it runs.
//
// Instructions for use
// --------------------
// 1. Put this in a new project on script.google.com
// 2. Edit the LABELS or even the search construction to fit your needs
// 3. Set a trigger to run main() every 5 minutes. Why 5 minutes? That's the longest a script is allowed to run,
// so your script will also get killed every 5 minutes if it's busy trying to delete a lot of mail
@kmosher
kmosher / random_gmail_emoji.py
Created July 31, 2014 15:52
Random Gmail Emojis
#!/usr/bin/python
"""
Return a random unicode character likely to render as a valid emoji in gmail
Ranges are taken from
http://www.unicode.org/~scherer/emoji4unicode/20090804/utc.html
"""
import random