Skip to content

Instantly share code, notes, and snippets.

View terryjbates's full-sized avatar

Terry Bates terryjbates

View GitHub Profile
def parse_html_table(file_path):
#with open(file_path, 'r') as f:
with codecs.open(file_path, 'r', encoding='utf-8', errors='ignore') as f:
soup = BeautifulSoup(f, 'html.parser')
table = soup.find('table') # Adjust the selector if needed
# Find headers and data rows directly from the table
headers = [th.text for th in table.find_all('th')]
data = []
@terryjbates
terryjbates / exclude_cols.py
Created January 19, 2025 11:05
Numeric column conversion for exported FM team data.
# Create excluded columns
EXCLUDE_COLS = """Inf
Name
Apps
Best Pos
Best Role
Best Duty
Pros
Expires
Distance
@terryjbates
terryjbates / open_source_licenses.md
Created December 16, 2022 00:34 — forked from nicolasdao/open_source_licenses.md
What you need to know to choose an open source license.
@terryjbates
terryjbates / java_shop_politics.txt
Created April 13, 2018 22:13
Java Shop Politics
1
Michael O. ChurchRants, essays, and diatribes.APRIL 13, 2012 BY MICHAELOCHURCHJava Shop PoliticsOnce, I was at a company that was considering (and eventually did so) moving its infrastructure over to Java, and there was a discussionabout the danger of “Java Shop Politics”. It would seem strange to any non-programmer that a company’s choice of programminglanguage would alter the political environment– these languages are just tools, right? Well, no. In this case, almost all of us knew exactlywhat was being talked about. Most software engineers have direct experience with Java Shop Politics, and it has a distinct and unpleasantflavor.
When Unix and C were developed, they were designed by people who had already experienced firsthand the evils of Big Software, ormonolithic systems comprised of hundreds of thousands of lines of code without attention paid to modularity, that had often swelled tothe point where no one understood the whole system. (In the 1970s, these monoliths were often written in assembly l
@terryjbates
terryjbates / test_pep257_conformance.py
Last active April 25, 2017 23:28
Notes on creating a pep257 test function
# -*- coding: utf-8 -*-
"""Use tox or py.test to run the test-suite. Lifted straight from pydocstyle/test_integration.py."""
from __future__ import with_statement
from collections import namedtuple
import os
import sys
########################## timer.py
# Import timings
import time
class Timer(object):
def __init__(self, verbose=False):
self.verbose = verbose
def __enter__(self):
# Reset to known good commit
git reset --hard 394c02dc893c358f2faa37b2c6635ba7c881b96f
# Push changes to gh
git push --force
# Fetch changes from upstream
git fetch upstream
# Merge upstream changes
@terryjbates
terryjbates / load_gen.py
Created February 12, 2016 01:17
Ramping load generator from Sys Perf book
#!/usr/bin/env python
import sys
import os
import random
IOSIZE = 8192
QUANTA = IOSIZE
@terryjbates
terryjbates / tmux.conf
Last active October 31, 2015 19:49
tmux.conf config to be shared from the PragPub book
# Change the Prefix key to Ctrl-a and not Ctrl-b
set -g prefix C-a
unbind C-b
# Change default delay
set -s escape-time 1
# Set pane and reference window indexing to 1
set -g base-index 1
setw -g pane-base-index 1
@terryjbates
terryjbates / introrx.md
Last active August 29, 2015 14:28 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.