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 bash | |
# accepts three files that are just the copy-pasted email column from a Google Sheet | |
# some of the rows can be empty, also note that the course shortnames change year to year | |
FRESH=$1 | |
GRAD=$2 | |
TRSFR=$3 | |
# delete empty lines, remove "cca.edu" from emails | |
sed -e '/^$/d' -e 's|@cca\.edu||' -i '.bak' $FRESH | |
sed -e '/^$/d' -e 's|@cca\.edu||' -i '.bak' $GRAD |
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 | |
//jshint node:true | |
// useful for finding location of files on server, for non-advanced storage config location is | |
// {{data dir}}/Institutions/{{institution name}}/Attachments/${hashCode(uuid)}/${uuid}/${version} | |
// for advanced storage config it's | |
// {{data dir}}/Institutions/{{institution name}}/Attachments/${collection UUID}/${hashCode(uuid)}/${uuid}/${version} | |
const readline = require('readline') | |
let hashCode = function(str){ | |
let hash = 0 |
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
# used for instance when First Year wants to drop sophomores from their home & replace with new incoming students | |
# COURSE = course id | |
USERS=$(moosh -n user-list --course $COURSE --course-role student) | |
moosh -n course-unenrol $COURSE $USERS |
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 | |
const { exec } = require("child_process") | |
exec('npm ls --global --json', (err, stdout, stderr) => { | |
if (err) throw err | |
const deps = JSON.parse(stdout).dependencies | |
// dependencies hash looks like: | |
// "linked-pkg": { "version": "1.0.0", "resolved": "file:..." }, | |
// "global-pkg": { "version": "1.0.0" }, ... |
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
// taken from https://medium.com/html5-css3/7c80a4b731f8 | |
// and expanded, unreadable one-liners are kind of pointless | |
//pad zeroes | |
function pad(num) { | |
return ('0' + num).split('').reverse().splice(0,2).reverse().join('') | |
} | |
// get page query params | |
var qp = document.location.search.replace(/(^\?)/,'') |
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
SELECT table_name AS "Table", | |
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" | |
FROM information_schema.TABLES | |
-- replace DATABASE with the name of the db | |
WHERE table_schema = 'DATABASE' | |
ORDER BY (data_length + index_length) DESC |
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 python3 | |
import csv | |
import os | |
import subprocess | |
with open('files.csv', 'w') as csvfile: | |
writer = csv.writer(csvfile) | |
writer.writerow(['path', 'size (bytes)', 'time last accessed', 'time last modified', 'time created', 'mime type']) | |
with open('dbcheck-files.txt', 'r') as listfile: | |
for path in listfile: |
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 | |
set USER username | |
set PASS password | |
set COLLECTION 123456 | |
set JSONFILE data.json | |
set URLSFILE urls.txt | |
set DONEFILE done.txt | |
set LIMIT 8 |
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
#!python3 | |
import sys | |
import argparse | |
import requests | |
import urllib3 | |
from panopto_folders import PanoptoFolders | |
from os.path import dirname, join, abspath | |
sys.path.insert(0, abspath(join(dirname(__file__), '..', 'common'))) |
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
# NOTE: make sure the course-list query returns the courses you want and also that the right backup is | |
# referenced in the course-restore command. The query should probably use shortnames (e.g. example is | |
# all First Year 4D courses), as opposed to something like categories, because you can target metacourses. | |
for id in $(moosh -n course-list -i 'shortname LIKE "FYCST-1120%-2021SP"'); do | |
moosh -n course-restore --overwrite ~/backup-*.mbz $id; | |
done |