Skip to content

Instantly share code, notes, and snippets.

Michael Milton TMiguelT

Block or report user

Report or block TMiguelT

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@TMiguelT
TMiguelT / aws-creds.bash
Created Nov 5, 2018 — forked from ddgenome/aws-creds.bash
Fetch AWS STS keys and set environment variables
View aws-creds.bash
#!/bin/bash
# Fetch 24-hour AWS STS session token and set appropriate environment variables.
# See http://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html .
# You must have jq installed and in your PATH https://stedolan.github.io/jq/ .
# Add this function to your .bashrc or save it to a file and source that file from .bashrc .
# https://gist.github.com/ddgenome/f13f15dd01fb88538dd6fac8c7e73f8c
#
# usage: aws-creds MFA_TOKEN [OTHER_AWS_STS_GET-SESSION-TOKEN_OPTIONS...]
function aws-creds () {
local pkg=aws-creds
@TMiguelT
TMiguelT / .vimrc
Created Aug 18, 2017
Colemak Vim Config
View .vimrc
" Always use the system clipboard
set clipboard=unnamed
" X deletes without adding to the register
noremap x "_x
vnoremap x "_x
" Colemak key bindings
noremap n h
noremap e j
View suppress_outputs.py
@contextlib.contextmanager
def suppress_outputs(suppress_stdout=True, suppress_stderr=True):
"""
Context manager that can be used to suppress any printing to sdtout or stderr from any python
code within its context
"""
#Open /dev/null
null = open(os.devnull, 'w')
@TMiguelT
TMiguelT / dna_nexus_debug.sh
Created Feb 27, 2017
Script to run a DNA Nexus app from inside the app, with the same environment as it would be run automatically
View dna_nexus_debug.sh
# Replace the job-* file with the right job ID
sudo -E PYTHONPATH=$PYTHONPATH bash job-F2kfkk804G2KyYvvF3fKffy2
@TMiguelT
TMiguelT / tcgplayer_to_csv.js
Last active May 2, 2017
Script to create a CSV out of the Cart Review Page of TCGPlayer
View tcgplayer_to_csv.js
(function(){
let str = ''
let tables = Array.from($('.sellerWrapMarket'))
for (let table of tables){
let $table = $(table)
let rows = Array.from($table.find('table.sellerTable'))
for (let row of rows){
let $row = $(row)
// Card name
str += $row.find('.itemsContents h3').text() + '\t'
@TMiguelT
TMiguelT / mtgjson to csv
Created Sep 11, 2016
Bash script to convert mtgjson's AllCards.json into a csv format
View mtgjson to csv
# Download the database
wget https://mtgjson.com/json/AllCards.json.zip
# Unzip it
unzip AllCards.json.zip
# Convert to CSV
jq -r 'to_entries[] | [.key, (.value | tostring ) ] | @csv' AllCards.json > AllCards.csv
# Load into postgres
You can’t perform that action at this time.