This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
# usage: vlog [date string] e.g. `vlog yesterday` or just `vlog` (for today's logs) | |
# requires SSH aliases for both app nodes (v1 & v2) | |
set today (gdate "+%Y-%m-%d") | |
if test -n "$argv[1]" | |
# need to use gnu date to get the human readable --date parameter | |
set d (gdate --date="$argv[1]" "+%Y-%m-%d") | |
# there can be multiple logs per day, rsync does this in only 1 ssh connection (requires rsync 3+) | |
rsync -ruzvhP v1:/opt/equella/logs/resource-centre/$d/ :/opt/equella/logs/tomcat/$d/ v1-$d | |
rsync -ruzvhP v2:/opt/equella/logs/resource-centre/$d/ :/opt/equella/logs/tomcat/$d/ v2-$d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// custom function for Google Sheets | |
// usage: TRANSPOSE(VAULTSEARCH("Student, Name")) returns data from Supplemental Portfolio Review collection | |
function VAULTSEARCH(query) { | |
var token = '...', // oauth access token | |
opts = { | |
contentType: 'application/json', | |
headers: { 'X-Authorization': 'access_token=' + token } | |
}, | |
data = UrlFetchApp.fetch('https://vault.cca.edu/api/search/?collections=3eaf9745-e7d4-4cf6-be07-44691daa4714&order=modified&info=metadata,detail&q=' + encodeURIComponent(query), opts), | |
results = JSON.parse(data).results, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# request URL looks like | |
# https://moodle.cca.edu/webservice/rest/server.php?wstoken=...&wsfunction=core_course_get_categories&moodlewsrestformat=json&criteria[0][key]=name&criteria[0][value]=2019SP | |
def get_mdl_categories(filter): | |
""" obtain a list of JSON representations of Moodle course categories | |
returns an array of category dicts (see their fields below) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
I tested a few options for testing for inclusion in a very large (millions of items) set. Results if you're curious: | |
¿ python3 heapq-test.py | |
> List took 71.93408012390137s time | |
> Heap took 160.27557826042175s time | |
> Sorted Containers took 0.004794120788574219s time | |
sortedcontainers is _real_ fast. | |
""" | |
from heapq import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# ################################# # | |
# UploadTaxonomy.py # | |
# # | |
# added CLI by Eric Phetteplace # | |
# California College of the Arts # | |
# vault.cca.edu | libraries.cca.edu # | |
# 2014-07-32 # | |
# # | |
# Pearson's notes below # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- attachment.value1 is the file size for "file" type attachments | |
-- does not capture a) zip files, b) generated thumbnails | |
-- but the item.total_file_size column which should include this is inaccurate | |
SELECT be.uuid, be_name.text AS collection, SUM(CAST(a.value1 AS bigint)) AS "disk space" | |
FROM item i | |
INNER JOIN base_entity be ON be.id = i.item_definition_id | |
LEFT JOIN language_string i_name ON i.name_id = i_name.bundle_id | |
LEFT JOIN language_string be_name ON be.name_id = be_name.bundle_id | |
JOIN (SELECT * FROM attachment WHERE attachment.type = 'file') a ON i.id = a.item_id | |
WHERE i.institution_id = 1165188 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// support ticket text, to be copied to clipboard later | |
var text = 'The link to this article\n\n' | |
// angular doc with metadata details | |
var doc = angular.element('.documentSummary').scope().document | |
var authors = doc.authors.reduce((text, author, idx, arr) => { | |
text += author.fullname | |
// it's _not_ the last author in the list | |
if (arr.length - idx != 1) { | |
text += ', ' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// given a set of item UUIDs, download all their attached files | |
// .equellarc file with credentials for API use | |
let options = require('rc')('equella', {}) | |
let headers = { 'X-Authorization': 'access_token=' + options.token } | |
const fs = require('fs') | |
const request = require('request') | |
// construct API URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector('.about-us-image-wrapper .about-us-image').src = '/media/images/GSuite_service.width-404.jpg' | |
document.addEventListener('DOMContentLoaded', main) | |
function main() { | |
var url = '/services/instructional-services-technology/g-suite-service/g-suite-news-updates/' | |
fetch(url).then((resp) => resp.text()) | |
.then((text) => { | |
// parse text of page to HTML we can navigate | |
var parser = new DOMParser() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check if an item's staging directory contains the same files as its persistent storage does | |
function log(msg) { | |
logger.log(currentItem.getUuid() + "/" + currentItem.getVersion() + " LOGGER: " + msg); | |
} | |
// use staging API to check those files | |
if (staging.isAvailable()) { | |
var stagingFilesAndDirs = staging.listFiles("", "**"); | |
for(var i = 0; i < stagingFilesAndDirs.size(); i++) { | |
log(stagingFilesAndDirs.get(i)); |