This file contains hidden or 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
from email.message import EmailMessage | |
import smtplib | |
from reminders.config import config | |
from_address = '[email protected]' | |
to_address = '[email protected]' | |
msg = EmailMessage() |
This file contains hidden or 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 | |
if ! git status 2&>/dev/null | |
echo "Must be run inside a git repo, run 'git init' first if need be" >&2 | |
exit 1 | |
end | |
begin | |
if ! test -f LICENSE.txt | |
echo "Downloading license text" | |
wget https://raw.githubusercontent.com/cca/koha_snippets/main/LICENSE.txt |
This file contains hidden or 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
''' | |
Translate KBART file from OAPEN into Serials Solutions Client Center aka 360 | |
Core database format. See the DatabaseTemplate.txt file for details. | |
''' | |
import csv | |
def get_first_isbn(isbns): | |
""" return the first in a list of semicolon-separated ISBNs |
This file contains hidden or 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 hidden or 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 fs = require('fs') | |
const path = require('path') | |
const readline = require('readline') | |
const todo_dir = process.env.TODO_DIR | |
// TODO we could make this optionally count todo.txt too e.g. with a CLI flag | |
const done_file = path.join(todo_dir, 'done.txt') | |
const projregex = /(\+[A-Za-z0-9]+)(\s|$)/g | |
const ctxregex = /(@[A-Za-z0-9]+)(\s|$)/g | |
let counts = {} |
This file contains hidden or 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 hidden or 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 hidden or 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
// run 1) on opac-detail pages & 2) if no user is signed in | |
if (!!location.pathname.match('/cgi-bin/koha/opac-detail.pl') && !$('.loggedinusername').length) { | |
// replace 856$u links with a link to login instead | |
// this would need to be tweaked if there are multiple URLs per record | |
$('.results_summary.online_resources a') | |
.replaceWith('<a href="/cgi-bin/koha/opac-user.pl">login to view PDF</a>') | |
} |
This file contains hidden or 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 hidden or 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: |