Skip to content

Instantly share code, notes, and snippets.

View jamestaylr's full-sized avatar

James Taylor jamestaylr

View GitHub Profile
@jamestaylr
jamestaylr / task.py
Last active September 11, 2018 16:33
Language-agnostic utility to standardize running snippets of code
#!/usr/bin/env python3
import argparse
from argparse import Namespace
import os
import os.path as path
import sys
import re
import logging
import tempfile
import subprocess
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
selenium = "*"
bs4 = "*"
[dev-packages]
[Unit]
Description=SSH tunnel
[Service]
Restart=always
RestartSec=3
User=jamestaylr
ExecStart=/usr/bin/autossh -M 40584 \
-o "compression=no" -o "cipher=aes128-gcm@openssh.com" \
-o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" \
@jamestaylr
jamestaylr / outfoxed-repeat.py
Created March 1, 2018 23:12
Repeatedly runs outfoxed until failure
#!/usr/bin/env python
import os
import signal
import subprocess
import tempfile
import sys
import threading
MAX_RUNS = 100
DEFAULT_TIMEOUT = 2
@jamestaylr
jamestaylr / plugin_driver.py
Created February 16, 2018 01:16
Runs all plugins in the student-plugins folder
#!/usr/bin/env python
import argparse
import glob
import os
import signal
import sys
from os.path import relpath, join
from subprocess import call
signal.signal(signal.SIGINT, lambda s,f: sys.exit(0))
command! -nargs=+ Hi call CustomHighlighter(<f-args>)
function! CustomHighlighter(name, ...)
let color_order = ['ctermfg', 'ctermbg', 'cterm']
let command = 'hi ' . a:name
if (len(a:000) < 1) || (len(a:000) > (len(color_order)))
echoerr "Problem parsing theme: wrong number of arguments"
else
for i in range(0,len(a:000)-1)
let command .= ' ' . color_order[i] . '=' . g:colors[a:000[i]]
#!/usr/bin/env python3
import os
import subprocess
import signal
from xml.etree.cElementTree import Element, ElementTree
import sys
import re
signal.signal(signal.SIGINT, lambda x,y: sys.exit(0))
def process_title(filepath, segment):
@jamestaylr
jamestaylr / histgen.py
Created February 25, 2017 23:13
Generate histograms from grade CSV files
#!/usr/bin/env python
import csv
import argparse
import os, sys
import string, random
# Parse CLI arguments
parser = argparse.ArgumentParser(
description='Turns grade CSV files into histogram images')
@jamestaylr
jamestaylr / hostgen.sh
Created January 1, 2017 08:29
Modified version of https://chr4.org/blog/2016/04/26/homebrew-betrayed-us-all-to-google/ including more blacklisted domains
#!/bin/sh
# This code is GPLv3
HOSTSFILE=hosts
TMPFILE=/tmp/aosp-hosts-file
echo "Updating ad-blocking hosts file..."
# Blacklisted domains lists
curl "http://www.joewein.net/dl/bl/dom-bl-base.txt" > $TMPFILE

Keybase proof

I hereby claim:

  • I am jamestaylr on github.
  • I am jamestaylr (https://keybase.io/jamestaylr) on keybase.
  • I have a public key whose fingerprint is 1BC9 E834 62BA 10C9 5911 B2F9 D084 59A7 CC26 700B

To claim this, I am signing this object: