Slack doesn't provide a way to export or even print important threads that one may want to keep. Here's what I do save threads to PDF.
Open the thread in a web browser and print to PDF.
var csrfToken = getCsrfToken(); | |
console.log('crsfToken', csrfToken); | |
fetch('/api/v1/conversations/unread_count', { | |
method: 'GET', | |
credentials: 'include', | |
headers: { | |
"Accept": "application/json", | |
"X-CSRF-Token": csrfToken | |
} |
# MIT No Attribution | |
# | |
# Copyright 2022 Ben Kehoe | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
# software and associated documentation files (the "Software"), to deal in the Software | |
# without restriction, including without limitation the rights to use, copy, modify, | |
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
# permit persons to whom the Software is furnished to do so. | |
# |
# Expanding on YAML Path basic Python library example from | |
# https://github.com/wwkimball/yamlpath/blob/master/README.md#searching-for-yaml-nodes | |
from types import SimpleNamespace | |
from yamlpath import Processor | |
from yamlpath import YAMLPath | |
from yamlpath.common import Parsers | |
from yamlpath.exceptions import YAMLPathException | |
from yamlpath.wrappers import ConsolePrinter |
import csv | |
import sys | |
from operator import itemgetter | |
from types import SimpleNamespace | |
from yamlpath import Processor | |
from yamlpath import YAMLPath | |
from yamlpath.common import Parsers | |
from yamlpath.exceptions import YAMLPathException | |
from yamlpath.wrappers import ConsolePrinter |
# Add field | |
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}' | |
# { | |
# "hello": "world", | |
# "foo": "bar" | |
# } | |
# Override field value | |
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}' | |
{ |
Examples of processing QTI data with Python.
I attempted to use pyslet
, which was designed for this purpose,
but I found it awkward to use and its documentation unclear. Instead, I tried to use beautifulsoup4
, but I
learned that library doesn't support XPath to query for specific elements of the data. I turned to using the
simple XML processing library lxml
. It has similarities to other XML parsing libraries I've used before, but
it has many unique features of its own.
Note that of the examples below, each does something a little differently. They don't all have the same output.
That's because they were mostly tests to see whether we preferred working with one library over another. Some
from typing import Optional, Any, Sequence | |
import pyslet.qtiv2.xml as qti | |
from pyslet.xml.namespace import NSElement | |
from pyslet.xml.structures import Document, Element | |
def getChildElements(node: NSElement) -> Sequence[NSElement]: | |
# skips strings not enclosed within elements (e.g., linebreaks in XML file) | |
return [child for child in node.get_children() if |
ARG BASE_CONTAINER=jupyter/minimal-notebook | |
FROM $BASE_CONTAINER | |
# Is this a good place for this? This directory was available and | |
# seemed like a good location for this. | |
WORKDIR /home/jovyan/work | |
ENV JUPYTER_ENABLE_LAB='yes' | |
RUN git clone https://github.com/educational-technology-collective/hwf-jupyterlab-telemetry && \ |