Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tony's full-sized avatar
💭
I may be slow to respond.

Tony Narlock tony

💭
I may be slow to respond.
View GitHub Profile
# 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
@tony
tony / pipfile-to-poetry.py
Last active December 16, 2019 15:15 — forked from sobolevn/pipfile-to-poetry.py
Formatting, check for errors for git packages
#!/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())
@tony
tony / flask_pdb.py
Created April 2, 2018 21:38 — forked from alonho/flask_pdb.py
Flask: drop into pdb on exception
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)
@tony
tony / arch-linux-install
Created December 29, 2015 05:24 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# 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
@tony
tony / messages_test_mixin.py
Last active August 29, 2015 14:07 — forked from ojii/messages_test_mixin.py
messages_request() accepts args, kwargs
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)
@tony
tony / Application.root.js
Last active August 29, 2015 14:01 — forked from isochronous/Application.root.js
Updated for Backbone 1.1, Marionette 1.8.x. Update to use wreqr, bindTo -> listenTo
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.