Skip to content

Instantly share code, notes, and snippets.

View aenoble's full-sized avatar
:shipit:

Andrew Noble aenoble

:shipit:
  • Hamilton, Ontario.
View GitHub Profile
@aenoble
aenoble / ticats-stats-mysqldump.sh
Last active August 29, 2015 14:23
ticats-stats-mysqldump.sh
#!/bin/bash
DATABASE=cfl6
DB_FILE=ticats-stats.sql.gz
EXCLUDED_TABLES=(
analytics_content
analytics_event
analytics_traffic
article_links
article_quote
container
data:text/html, <html contenteditable style="font-family:courier;">
sudo rm -rf /*
@aenoble
aenoble / ht_cors_check.sh
Last active November 12, 2015 16:06
Check to see if HT has setup CORS for their feeds.
#!/bin/bash
URLS=(
whl.chl.andrew.pairshaped.ca
whl.puckshaped.me
wheatkings.puckshaped.me
hitmenhockey.puckshaped.me
oilkings.puckshaped.me
everettsilvertips.puckshaped.me
blazerhockey.puckshaped.me
kelownarockets.puckshaped.me
@aenoble
aenoble / 1_summary.md
Last active November 3, 2015 20:17
HT/LS Standings "Streaks" changes.

There's embedded HTML in the "stkoverall", "stkhome", and "stkaway" views of the Standings feed that doesn't have equivalent plaintext representations.

eg: http://cluster.leaguestat.com/feed/?feed=modulekit&view=statviewtype&type=standings&key=c680916776709578&fmt=json&client_code=whl&lang=&season_id=251&stat=stkoverall&fmt=json

I need that to be changed so everything in one of those HTML-strings is separated out. I'm including two JSON snippets that have the current and desired views so you can see the difference. Note: the "start_date" and "end_date" fields are now ISO 8601 representations of a particular date.

Let me know if you have any questions.

Keybase proof

I hereby claim:

  • I am aenoble on github.
  • I am aenoble (https://keybase.io/aenoble) on keybase.
  • I have a public key whose fingerprint is 5202 076F 6E43 C3A8 5CEC 7520 1F95 26B6 D479 6FCA

To claim this, I am signing this object:

>>>AAAMACEAAAADAwYAAAAEAAAAY29hbAMDAgoAAABjb3BwZXItb3Jl
AwMCCQAAAGNydWRlLW9pbAMDAgoAAABlbmVteS1iYXNlAwMCCAAAAGl
yb24tb3JlAwMCBQAAAHN0b25lAwMCzrtq6nZdAACZsgAAAAAAAAAAAA
ADABnsHcw=<<<
andrew:~ $ python
Python 2.7.3 (default, Mar 29 2013, 15:55:26)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 87 * 0.2
17.400000000000002
@aenoble
aenoble / postgresql_9.1_to_9.3_on_ubuntu_12.04
Last active June 20, 2017 15:36 — forked from mdpatrick/postgresql_9.1_to_9.3_on_ubuntu_12.04
Upgrade PostgreSQL from 9.1 to 9.3 on Ubuntu 12.04
# Probably excessive, but it makes these instructions simpler
sudo -i
# Add postgresql repo and update apt listing
echo "deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
# For some reason this is necessary with PostgreSQL on Ubuntu 12.04
update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz
@aenoble
aenoble / gist:9eea250d5b3a17ee17b2aac3634e6511
Last active September 19, 2017 15:46
Drop db connections because I always forget how.
#https://stackoverflow.com/a/5109190
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
pid <> pg_backend_pid()
AND datname = 'database_name';