Skip to content

Instantly share code, notes, and snippets.

View jpjones76's full-sized avatar

Joshua Jones jpjones76

View GitHub Profile
@jpjones76
jpjones76 / set_useragent.jl
Last active August 29, 2020 06:00
Workaround for "500 Internal Server Error" returned by FDSN requests to California servers
# THE ISSUE: HTTP "500 Internal Server Error" for FDSN requests to California
# earthquke data centers (NCEDC, SCEC/SCEDC).
#
# THE CAUSE: against HTTP "best practices", and seemingly against common sense,
# California FDSN servers only accept requests from a small whitelist of
# user agents. Neither Julia nor SeisIO is on their lists, so SeisIO must
# emulate a web browser in the User Agent setting to be able to connect. This
# creates a sort of "arms race" wherein the User Agent value in SeisIO.webhdr
# must be updated whenever a web browser releases a new version. This is a
# complete waste of everyone's time: theirs, yours, and mine.
#! /usr/bin/env python
# Chutes & Ladders Player
import random, sys
N = 3
w = {
1:38, 4:14, 9:31, 16:7, 21:42,
28:84, 36:44, 47:26, 49:11, 51:67,
56:53, 62:18, 64:60, 71:91, 80:100,
87:24, 92:73, 85:75, 98:78
}