Skip to content

Instantly share code, notes, and snippets.

View ryanlovett's full-sized avatar

Ryan Lovett ryanlovett

  • University of California, Berkeley
  • United States
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ryanlovett on github.
  • I am ryanlovett (https://keybase.io/ryanlovett) on keybase.
  • I have a public key ASD6OHT44IE3YERoVU0V1zLwadd6v5Ay8BybP6Fgc6JwcQo

To claim this, I am signing this object:

#!/usr/bin/python3
# vim: set et sw=4 ts=4:
# Given a listen of courses, where each has a term, department, & course number:
# - fetch the course roster from sis
# - replace members of the calgroup roster with those from the sis
# Requires SIS and CalGroups API secrets.
# CalGroups API
@ryanlovett
ryanlovett / sis-enrollments.py
Last active April 25, 2018 17:14
Download and display an SIS course's enrollments
#!/usr/bin/env python
# Example usage:
# $0 -H headers.json -s compsci -c c8
# $0 -H headers.json -s stat -c c100
import argparse
import json
import requests
@ryanlovett
ryanlovett / enrollment-emails
Created August 18, 2017 20:47
Get the official campus emails for students in a Berkeley course
#!/usr/bin/python
# Example usage:
# $0 -H headers.json -s compsci -c c8
# $0 -H headers.json -s stat -c c100
import sys
import os
import json
import requests
#!/bin/bash
set -e
POOL_NAME="pool0"
MOUNT_POINT="/export/${POOL_NAME}"
log() {
# Un-comment the following if you would like to enable logging to a service
#curl -X POST -H "content-type:text/plain" --data-binary "${HOSTNAME} - $1" https://logs-01.loggly.com/inputs/<key>/tag/es-extension,${HOSTNAME}
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
2m 2m 1 default-scheduler Normal Scheduled Successfully assigned hub-deployment-2251915166-3r2q7 to k8s-agent-5b771e27-1
1m 1m 2 controller-manager Warning FailedMount Failed to attach volume "pvc-3ec04964-3760-11e7-85c7-000d3a363479" on node "k8s-agent-5b771e27-1" with: Attach volume "tmp1cluster-dynamic-pvc-3ec04964-3760-11e7-85c7-000d3a363479.vhd" to instance "k8s-agent-5B771E27-1" failed with compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=200 -- Original Error: Long running operation terminated with status 'Failed': Code="AcquireDiskLeaseFailed" Message="Failed to acquire lease while creating disk 'tmp1cluster-dynamic-pvc-3ec04964-3760-11e7-85c7-000d3a363479.vhd' using blob with URI https://dg3ds7fetp2k6mstr0.blob.core.windows.net/vhds/tmp1cluster-dynamic-pvc-3ec04964-3760-11e7-85c7-000d3a363479.vhd. Blob is
#!/usr/bin/python
import sys
import os
import json
import requests
import argparse
def get_courses(term_id, uid, sa_filter=''):
'''Fetch a UID's enrollments in a specified term. Optionally filter by
@ryanlovett
ryanlovett / sns-aid-convert
Last active March 11, 2016 18:04
Converts SNS AID data to a list of hosts.
#!/usr/bin/env python3
'''
Convert SNS AID data to a list for ipf.
'''
import os
import itertools
import json
from optparse import OptionParser
@ryanlovett
ryanlovett / get-sns-aid
Last active March 11, 2016 18:05
A script that downloads SNS AID data from Berkeley's ISP
#!/usr/bin/env python3
'''
Download and cache SNS AID list.
API filter examples:
# last_seen_ts (returns entries where last_seen_ts >= '2015-04-09'):
# Note: The time stamp can be made even more precise using the format of
# <Date>T<hour>:<min>:<sec><TZ offset (optiona l)>
@ryanlovett
ryanlovett / canvas-roster.py
Last active February 23, 2016 21:06
Download course roster from Canvas LMI
#!/usr/bin/python
'''
To obtain an access token in the Canvas LMI (e.g. bcourses, uconline),
click own user name at top, scroll down to Approved Integrations, click New
# Tests with curl
curl https://cole2.uconline.edu/api/v1/courses/NNNNNN/users -X GET \
-F "per_page=5000" -F "include[]=email" -F "enrollment_type=student" \
-H "Authorization: Bearer <token>"
curl https://bcourses.berkeley.edu/api/v1/courses/NNNNNNN/users -X GET \