Skip to content

Instantly share code, notes, and snippets.

@Koenvh1
Koenvh1 / canvas-scraper.py
Created April 13, 2019 12:56
Scrape your Canvas website and download all content to a folder. Tested on 2019-04-13.
import argparse
import os
import re
from pathvalidate import sanitize_filename
from canvasapi import Canvas
from canvasapi.course import Course
from canvasapi.exceptions import Unauthorized, ResourceDoesNotExist
from canvasapi.file import File
from canvasapi.module import Module, ModuleItem
@staltz
staltz / introrx.md
Last active July 25, 2024 16:52
The introduction to Reactive Programming you've been missing
@jacobtomlinson
jacobtomlinson / remove_empty_folders.py
Last active October 19, 2022 04:56
Python Recursively Remove Empty Directories
#! /usr/bin/env python
'''
Module to remove empty folders recursively. Can be used as standalone script or be imported into existing script.
'''
import os, sys
def removeEmptyFolders(path, removeRoot=True):
'Function to remove empty folders'
if not os.path.isdir(path):
@ararog
ararog / TransformXml.groovy
Created November 5, 2013 10:34
A tool to apply a xml stylesheet into a source file and output the styled version to another file.
import javax.xml.transform.TransformerFactory
import javax.xml.transform.stream.StreamResult
import javax.xml.transform.stream.StreamSource
def cli = new CliBuilder( usage: 'groovy TransformXml.groovy -h -i inputfile -o output -x xsltfile...')
cli.h(longOpt:'help', 'usage information')
cli.i(argName:'input', longOpt:'input', args:1, required:true, type:GString, 'Directory/file for input')
cli.o(argName:'output', longOpt:'output', args:1, required:true, type:GString, 'Direcoty/file for output')
cli.x(argName:'xsltfile', longOpt:'xsltfile', args:1, required:true, type:GString, 'The transformation file')