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 genanki | |
my_model = genanki.Model( | |
1380120064, | |
'Example', | |
fields=[ | |
{'name': 'Object'}, | |
{'name': 'Image'}, | |
], | |
templates=[ |
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 genanki | |
my_model = genanki.Model( | |
1380120064, | |
'Example', | |
fields=[ | |
{'name': 'Object'}, | |
{'name': 'Image'}, | |
], | |
templates=[ |
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 os | |
import logging | |
class _Color: | |
PURPLE = '\033[95m' | |
CYAN = '\033[96m' | |
DARKCYAN = '\033[36m' | |
BLUE = '\033[94m' | |
GREEN = '\033[92m' |
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
""" | |
MissingFormatKey.py | |
Author: Jérémie Lumbroso <lumbroso@cs.princeton.edu> | |
Date: 2019-07-03 | |
Usage: | |
# Define replacement f"..." compatible with Python 2 and 3 | |
_f = _make_f(globals=lambda: globals(), locals=lambda: locals()) | |
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
""" | |
Helper code for the `clevercsv` package to help sniff the dialect of very large files. | |
Author: lumbroso@cs.princeton.edu | |
Date: 2020-05-19 | |
""" | |
import clevercsv | |
THRESHOLD_WHOLE_FILE = 10000 |
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 random | |
import pandas as pd | |
# Generate a random time series | |
def gapped_time_series(start=None, span=datetime.timedelta(days=30)): | |
if start is None: | |
start = datetime.datetime.now() | |
series = [] | |
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
# Snippet licensed under The Unlicense (https://unlicense.org/) | |
# Originally part of https://github.com/jlumbroso/restsdk (which is LGPLv3 licensed) | |
import functools | |
import inspect | |
import os | |
import sys | |
import time | |
import typing |
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
# How to use pyppeteer to screenshot an SPA | |
# Joseph Lou & Jérémie Lumbroso, 2021 | |
# | |
# This example code is hardcoded for https://codepost.io but should | |
# show how to use pyppeteer for other SPAs | |
import asyncio | |
# ref: https://github.com/miyakogi/pyppeteer/issues/219#issuecomment-563077061 | |
import pyppdf.patch_pyppeteer # needed to avoid chromium errors |
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
# the codePost Python SDK must be installed: pip install codepost | |
import codepost | |
# variable parameters | |
# get the API key here: https://codepost.io/settings | |
API_KEY = "... see above where to get this ..." | |
COURSE_NAME = "COS126" | |
COURSE_TERM = "S2022" | |
ASSIGNMENT = "Programming Exam 1" |
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 codepost | |
# variable parameters | |
# get the API key here: https://codepost.io/settings | |
API_KEY = "... see above where to get this ..." | |
COURSE_NAME = "COS126" | |
COURSE_TERM = "S2022" | |
ASSIGNMENT = "Programming Exam 1" | |
# authenticate |
OlderNewer