Skip to content

Instantly share code, notes, and snippets.

@tony
tony / pipfile-to-poetry.py
Last active Dec 16, 2019 — forked from sobolevn/pipfile-to-poetry.py
Formatting, check for errors for git packages
View pipfile-to-poetry.py
#!/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 Apr 2, 2018 — forked from alonho/flask_pdb.py
Flask: drop into pdb on exception
View flask_pdb.py
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 Dec 29, 2015 — 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
View arch-linux-install
# 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 Aug 29, 2015 — forked from ojii/messages_test_mixin.py
messages_request() accepts args, kwargs
View messages_test_mixin.py
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 Aug 29, 2015 — forked from isochronous/Application.root.js
Updated for Backbone 1.1, Marionette 1.8.x. Update to use wreqr, bindTo -> listenTo
View Application.root.js
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.