Skip to content

Instantly share code, notes, and snippets.

View aryamccarthy's full-sized avatar

Arya McCarthy aryamccarthy

View GitHub Profile
@aryamccarthy
aryamccarthy / TBP_faculty.md
Created November 7, 2016 04:29
Tau Beta Pi faculty alumni at SMU

CEE Dr. Brett A. Story

CSE Dr. Jennifer L. Dworak Dr. Daniel W. Engels Dr. David W. Matula

EE Dr. Jerome K. Butler

@aryamccarthy
aryamccarthy / readinglist.py
Created April 13, 2018 20:41
Retrieve and list the files in the Safari reading list.
#!/usr/bin/env python
"""
Retrieve and list the files in the reading list.
"""
import plistlib
from shutil import copy
import subprocess
import os
from tempfile import gettempdir
# Function lookfor
# searches current directory for given text.
# Highlights result on each line where it appears.
# Usage: lookfor someword
function lookfor() {
grep --color -nriwI "$@" .
}
@aryamccarthy
aryamccarthy / tacl_parser.py
Created March 30, 2019 19:37
parse that TACL metadata
#! /usr/bin/env python3
"""
Convert MIT Press XML files for TACL to Anthology XML.
"""
import logging
import xml.etree.ElementTree as etree
from pathlib import Path
from typing import List, Optional, Tuple
from dataclasses import astuple, dataclass
from typing import Callable, List, NewType, Set, Tuple
import numpy as np
np.random.seed(1337)
# Dummy typings; feel free to switch to PyTorch.
Word = str
Phrase = NewType('Phrase', Tuple[Word])
Score = float # or th.float, etc.
@aryamccarthy
aryamccarthy / cycle-decomposition.py
Last active March 26, 2022 16:22
Find connected components in a set of cycles, then print the corresponding cycle decomposition.
from typing import Dict, Iterator, List, Set
# Type aliases...if Python 3.10+, then declare them as such. ;-)
Cycle = List[int]
CycleDecomposition = List[Cycle]
Permutation = Dict[int, int]
# Another reasonable (and more compact) structure is an array,
# but this helps keep the one-indexing and lets you sub in other graph types.
@aryamccarthy
aryamccarthy / qsub.py
Last active August 26, 2022 18:17
Submit jobs to qsub, the easy way.
#! /usr/bin/env python3
from __future__ import print_function
import argparse
from collections import OrderedDict
from datetime import datetime
from getpass import getuser
import os
import re
import readline