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
# Most of this is copied from Sphinx | |
# Credit: | |
# - https://gist.github.com/agoose77/e8f0f8f7d7133e73483ca5c2dd7b907f | |
# - https://gist.github.com/asmeurer/5009f8845f864bd671769d10e07d1184 | |
from typing import Generator, List, TypeVar, Union | |
import sphinx.environment.collectors.toctree as toctree_collector | |
from docutils import nodes | |
from docutils.nodes import Element | |
from sphinx import addnodes |
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 python | |
# -*- coding: utf-8 -*- | |
import json | |
import toml | |
def read_pipenv_lock(): | |
with open('Pipfile.lock') as lock: | |
return json.loads(lock.read()) |
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
def drop_into_pdb(app, exception): | |
import sys | |
import pdb | |
import traceback | |
traceback.print_exc() | |
pdb.post_mortem(sys.exc_info()[2]) | |
# somewhere in your code (probably if DEBUG is True) | |
flask.got_request_exception.connect(drop_into_pdb) |
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
# Install ARCH Linux with encrypted file-system and UEFI | |
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
# Download the archiso image from https://www.archlinux.org/ | |
# Copy to a usb-drive | |
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
# Set swedish keymap |
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
from contextlib import contextmanager | |
from django.contrib.messages.storage.base import BaseStorage, Message | |
from django.test.client import RequestFactory | |
from django.utils.decorators import method_decorator | |
class TestMessagesBackend(BaseStorage): | |
def __init__(self, request, *args, **kwargs): | |
self._loaded_data = [] | |
super(TestMessagesBackend, self).__init__(request, *args, **kwargs) | |
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
define([ | |
"underscore", | |
"backbone", | |
"marionette", | |
"vent" | |
], | |
/** | |
* Creates the primary `Marionette.Application` object that runs the admin framework. Provides a central point | |
* from which all other sub-applications are started, shown, hidden, and stopped. |