Skip to content

Instantly share code, notes, and snippets.

View TaylorMutch's full-sized avatar

Taylor Mutch TaylorMutch

  • Unity Technologies
  • Snohomish, WA
  • 05:18 (UTC -07:00)
View GitHub Profile
@TaylorMutch
TaylorMutch / SdrToCsvUtil
Created May 23, 2016 01:35
METEK SOdar (.sdr) to CSV converter. Includes support for gzipped files.
"""
Created by Taylor Mutch on 22 May, 2016
Simple SOdar to CSV file converter.
"""
import os
import sys
import csv
import gzip
@TaylorMutch
TaylorMutch / hashset.go
Last active April 7, 2023 14:47
Golang Hashset Example
package main
import (
"crypto"
_ "crypto/sha512"
"fmt"
)
func main() {

Keybase proof

I hereby claim:

  • I am taylormutch on github.
  • I am taylorm (https://keybase.io/taylorm) on keybase.
  • I have a public key ASAkprTThdWPtgBs-w2JCFq6dzV2KLZ0mfiXuFbs2SlyBQo

To claim this, I am signing this object:

@TaylorMutch
TaylorMutch / MapControls.js
Last active September 28, 2017 01:09
Three.js OrbitControls that are used for moving in a flat, map-like fashion
// See line 300 for changes that differ from OrbitControls.js
// @author TaylorMutch / https://github.com/TaylorMutch
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com
*/
@TaylorMutch
TaylorMutch / conditionals.glsl
Last active September 27, 2017 23:47
WebGL Conditionals optimized for performance. Use these instead of canonical 'or' and 'and' statements in GLSL code.
float when_eq(float x, float y) {
return 1.0 - abs(sign(x - y));
}
float when_neq(float x, float y) {
return abs(sign(x - y));
}
float when_gt(float x, float y) {
return max(sign(x - y), 0.0);
@TaylorMutch
TaylorMutch / extract-pdf-jpgs.py
Created September 7, 2017 17:08
Extracts JPEG images from a PDF.
"""
Extracts JPGs from a PDF. Inspired by this StackOverflow post:
https://stackoverflow.com/questions/2693820/extract-images-from-pdf-without-resampling-in-python
"""
import sys
with open(sys.argv[1],"rb") as file:
file.seek(0)
pdf = file.read()
@TaylorMutch
TaylorMutch / analytics.py
Created July 13, 2017 21:48
Print out file statistics from a directory
import os, sys
exts = ['.py', '.ini', '.c', '.h']
count_empty_line = True
here = os.path.abspath(os.path.dirname(sys.argv[0]))
def read_line_count(fname):
count = 0
for line in open(fname).readlines():
if count_empty_line or len(line.strip()) > 0:
@TaylorMutch
TaylorMutch / jerilyn_usage.txt
Created December 1, 2016 02:36
Example of how to use jerilyn.py
>>> from jerilyn import build_night_classification
>>> data = build_night_classification('path/to/sodar_data', 'path/to/classification.csv')
# Keys for accessing the top layer of data
>>> data[0].keys()
dict_keys(['mcrae_speeds', 'date', 'meta', 'primet_directions', 'mcrae_directions', 'primet_speeds'])
# Keys for accessing the criterion
>>> data[0]['meta'].keys()
dict_keys(['pulsing', 'mesoscale_forcing', 'date', 'direction', 'year', 'month', 'day', 'valley_jet', 'similar'])
@TaylorMutch
TaylorMutch / jerilyn.py
Created December 1, 2016 02:26
Generates a classification data structure from a CSV declaring the classification.
'''
Collect each of Jerilyn's nights into a dictionary structure, and packs and reloads it from a db if necessary for speed.
'''
import os
import sys
import csv
import sqlite3
import datetime
from sodar_utils import SodarCollection, register_adapters, datetime_to_name
@TaylorMutch
TaylorMutch / generate_figures.py
Last active November 26, 2016 23:39
Generates all sodargram figures for Jerilyn's thesis.
# Compare two nights
from sodar_utils import SodarCollection
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.colors as col
import matplotlib as mpl
def cyclic_colormap():