Skip to content

Instantly share code, notes, and snippets.

View iannesbitt's full-sized avatar

Ian Nesbitt iannesbitt

View GitHub Profile
@iannesbitt
iannesbitt / md-commits.py
Last active August 28, 2023 22:21
Create markdown commit list by repo, branch, and date
"""
Usage: python3 md-commits.py -r NCEAS/MetacatUI -s 2023-07-01 -e 2023-08-31 -b main,develop -o metacatui-commits_2023-07.md
"""
import argparse
import sys
import os
import requests
def query_github(end_url, repo, params=None):
base_url = f"https://api.github.com/repos/{repo}"
// Grant CesiumJS access to your ion assets
Cesium.Ion.defaultAccessToken = "SECRET";
const viewer = new Cesium.Viewer("cesiumContainer", {
terrainProvider : Cesium.createWorldTerrain(),
});
const scene = viewer.scene;
viewer.scene.globe.depthTestAgainstTerrain = false; // draws points beneath terrain
const vertexShader = `
in vec4 osVert;
@iannesbitt
iannesbitt / massdownload.py
Last active February 15, 2020 17:11
downloading data from specific stations en masse from Raspberry Shake FDSN
from obspy.clients.fdsn.mass_downloader import Restrictions, MassDownloader
from obspy import UTCDateTime
# initialize the MassDownloader
# from obspy 1.2.0 onward you can use MassDownloader(providers=['RASPISHAKE'])
# but prior to that you must specify server location
mdl = MassDownloader(providers=['http://fdsnws.raspberryshakedata.com'])
# where to put files locally
base = '~/seismicdata'
@iannesbitt
iannesbitt / obspy-day_spec_plots.py
Last active September 24, 2021 16:38
rough script to make two helicorder and spectrogram plots, one each unfiltered and filtered
from obspy.core.event.catalog import Catalog
from datetime import datetime, timedelta
import pytz
import os
import shutil
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from obspy import read
@iannesbitt
iannesbitt / two_way_times.py
Created June 29, 2019 09:36
Two-way penetration time chart for various depths and various dielectric constants
c = 299792458 # speed of light in vacuum
er = { # epsilon sub r
'air (1.00029)': 1.00029,
'ice (3)': 3,
'clay (17)': 17,
'sand (24)': 24,
'gyttja (27)': 28,
'gyttja (40)': 40,
'water (80)': 80,
@iannesbitt
iannesbitt / wavelength_table.py
Last active June 29, 2019 09:34
Approximate quarter-wavelength calculations for various media at various radio frequencies
c = 299792458 # speed of light in vacuum
er = { # epsilon sub r
'air (1.00029)': 1.00029,
'ice (3)': 3,
'clay (17)': 17,
'sand (24)': 24,
'gyttja (27)': 28,
'gyttja (40)': 40,
'water (80)': 80,
@iannesbitt
iannesbitt / shake_rem_response.py
Last active February 20, 2019 21:43
Removing a Raspberry Shake instrument response with ObsPy
from obspy import read_inventory, UTCDateTime
from obspy.clients.fdsn import Client
rs = Client(base_url='https://fdsnws.raspberryshakedata.com/')
start = UTCDateTime(2019, 1, 1, 0, 0, 0)
end = UTCDateTime(2019, 1, 1, 0, 30, 0)
stn = 'R0000' # your station name
chn = 'EHZ' # the instrument channel code
# (the vertical component is typically called 'EHZ' or 'SHZ' depending on the instrument)
@iannesbitt
iannesbitt / get_rs.py
Last active February 20, 2019 17:01
Get a Raspberry Shake waveform in six lines of code
from obspy.clients.fdsn import Client
from obspy import UTCDateTime
rs = Client(base_url='https://fdsnws.raspberryshakedata.com/')
starttime = UTCDateTime("2019-02-14T20:00:00.000000Z")
endtime = UTCDateTime("2019-02-14T20:10:00.000000Z")
waves = rs.get_waveforms('AM', 'R4989', '00', 'EHZ', starttime, endtime)
@iannesbitt
iannesbitt / blink.py
Last active July 3, 2016 17:21
RasPi LED blink test
@iannesbitt
iannesbitt / vncboot
Last active July 1, 2016 17:58
A small init.d shell script that will start vncserver on RaspberryPi without cron
#!/bin/sh
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO